Package htsjdk.variant.variantcontext

Examples of htsjdk.variant.variantcontext.VariantContextComparator


     * (snp) queue is the same. Also make sure that the context is in the order
     * specified by the input files.
     */
    private void validateSnpAndIndelResults(final File output, final Queue<String> indelContigPositions, final Queue<String> snpContigPositions) {
        final VCFFileReader outputReader = new VCFFileReader(output, false);
        final VariantContextComparator outputComparator = outputReader.getFileHeader().getVCFRecordComparator();
        VariantContext last = null;
        final CloseableIterator<VariantContext> iterator = outputReader.iterator();
        while (iterator.hasNext()) {
            final VariantContext outputContext = iterator.next();
            if (outputContext.isIndel()) Assert.assertEquals(getContigPosition(outputContext), indelContigPositions.poll());
            if (outputContext.isSNP()) Assert.assertEquals(getContigPosition(outputContext), snpContigPositions.poll());
            if (last != null) Assert.assertTrue(outputComparator.compare(last, outputContext) <= 0);
            last = outputContext;
        }
        iterator.close();

        // We should have polled everything off the indel (snp) queues
View Full Code Here


        validateResultsForMultipleInputs(output, positionQueues);
  }

    private void validateResultsForMultipleInputs(final File output, final List<Queue<String>> positionQueues) {
        final VCFFileReader outputReader = new VCFFileReader(output, false);
        final VariantContextComparator outputComparator = outputReader.getFileHeader().getVCFRecordComparator();
        VariantContext last = null;
        final CloseableIterator<VariantContext> iterator = outputReader.iterator();
        while (iterator.hasNext()) {
            final VariantContext outputContext = iterator.next();
            final String position = getContigPosition(outputContext);
            for (final Queue<String> positionQueue : positionQueues) {
                if (position.equals(positionQueue.peek())) {
                    positionQueue.poll();
                    break;
                }
            }
            if (last != null) Assert.assertTrue(outputComparator.compare(last, outputContext) <= 0);
            last = outputContext;
        }
        iterator.close();

        for (final Queue<String> positionQueue : positionQueues) {
View Full Code Here

     * @param output VCF file representing the output of SortVCF
     * @param expectedVariantContextCount the total number of variant context entries from all input files that were merged/sorted
     */
    private void validateSortingResults(final File output, final int expectedVariantContextCount) {
        final VCFFileReader outputReader = new VCFFileReader(output, false);
        final VariantContextComparator outputComparator = outputReader.getFileHeader().getVCFRecordComparator();
        VariantContext last = null;
        int variantContextCount = 0;
        final CloseableIterator<VariantContext> iterator = outputReader.iterator();
        while (iterator.hasNext()) {
            final VariantContext outputContext = iterator.next();
            if (last != null) Assert.assertTrue(outputComparator.compare(last, outputContext) <= 0);
            last = outputContext;
            variantContextCount++;
        }
        iterator.close();
        Assert.assertEquals(variantContextCount, expectedVariantContextCount);
View Full Code Here

TOP

Related Classes of htsjdk.variant.variantcontext.VariantContextComparator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.