Package htsjdk.variant.variantcontext

Examples of htsjdk.variant.variantcontext.VariantContext


                Integer count = unClassifiedStatesMap.get(condition);
                if (count == null) count = 0;
                unClassifiedStatesMap.put(condition, ++count);
            }

            final VariantContext variantContextForLogging = tuple.truthVariantContext != null ? tuple.truthVariantContext : tuple.callVariantContext;
            progress.record(variantContextForLogging.getChr(), variantContextForLogging.getStart());
        }

        // Calculate and store the summary-level metrics
        final MetricsFile<GenotypeConcordanceSummaryMetrics,?> genotypeConcordanceSummaryMetricsFile = getMetricsFile();
        GenotypeConcordanceSummaryMetrics summaryMetrics = new GenotypeConcordanceSummaryMetrics(SNP, snpCounter, TRUTH_SAMPLE, CALL_SAMPLE);
View Full Code Here


    @Override
    public VcTuple next() {
        if (!hasNext()) throw new IllegalStateException("next() called while hasNext() is false.");

        final VariantContext truthVariantContext = this.truthIterator.hasNext() ? this.truthIterator.peek() : null;
        final VariantContext callVariantContext = this.callIterator.hasNext() ? this.callIterator.peek() : null;

        // If one or the other is null because there is no next, just return a one-sided tuple
        if (truthVariantContext == null) {
            return new VcTuple(null, this.callIterator.next().subContextFromSample(callSample));
        }
View Full Code Here

        int incorrectVariantCount = 0;

    final CloseableIterator<VariantContext> iterator = fileReader.iterator();
    while (iterator.hasNext()) {
      final VariantContext context = iterator.next();
      if (context.isIndel()) indelWriter.add(context);
      else if (context.isSNP()) snpWriter.add(context);
      else {
                if (STRICT) throw new IllegalStateException("Found a record with type " + context.getType().name());
                else incorrectVariantCount++;
            }

            progress.record(context.getChr(), context.getStart());
    }

        if (incorrectVariantCount > 0) {
            log.debug("Found " + incorrectVariantCount + " records that didn't match SNP or INDEL");
        }
View Full Code Here

    writer.writeHeader(new VCFHeader(VCFUtils.smartMergeHeaders(headers, false), sampleList));

    final MergingIterator<VariantContext> mergingIterator = new MergingIterator<VariantContext>(variantContextComparator, iteratorCollection);
    while (mergingIterator.hasNext()) {
      final VariantContext context = mergingIterator.next();
      writer.add(context);
      progress.record(context.getChr(), context.getStart());
    }

    CloserUtil.close(mergingIterator);
    writer.close();
    return 0;
View Full Code Here

        final VariantContextWriter writer = builder.build();
        writer.writeHeader(header);
      final CloseableIterator<VariantContext> iterator = reader.iterator();

      while (iterator.hasNext()) {
        final VariantContext context = iterator.next();
            writer.add(context);
            progress.record(context.getChr(), context.getStart());
        }

      CloserUtil.close(iterator);
      CloserUtil.close(reader);
        writer.close();
View Full Code Here

        vcfWriter.writeHeader(fileHeader);

        final ProgressLogger progress = new ProgressLogger(log, 10000);
        final CloseableIterator<VariantContext> iterator = fileReader.iterator();
        while (iterator.hasNext()) {
            final VariantContext context = iterator.next();
            vcfWriter.add(context);
            progress.record(context.getChr(), context.getStart());
        }

        CloserUtil.close(iterator);
        CloserUtil.close(fileReader);
        vcfWriter.close();
View Full Code Here

    return new ArrayList<String>(contigs);
  }

  @Test
  public void testIdentical() {
    final VariantContext contextOne = buildVariantContext("source", "one", 100);
    final List<String> contigs = getOrderedContigList(contextOne);
    Assert.assertEquals(0, new VariantContextComparator(contigs).compare(contextOne, contextOne));
  }
View Full Code Here

    Assert.assertEquals(0, new VariantContextComparator(contigs).compare(contextOne, contextOne));
  }

  @Test
  public void testPositions() {
    final VariantContext contextOne = buildVariantContext("source", "one", 100);
    final VariantContext contextTwo = buildVariantContext("source", "one", 150);
    final List<String> contigs = getOrderedContigList(contextOne, contextTwo);
    Assert.assertTrue(new VariantContextComparator(contigs).compare(contextOne, contextTwo) < 0);
    Assert.assertTrue(new VariantContextComparator(contigs).compare(contextTwo, contextOne) > 0);
  }
View Full Code Here

    Assert.assertTrue(new VariantContextComparator(contigs).compare(contextTwo, contextOne) > 0);
  }

  @Test
  public void testContigs() {
    final VariantContext contextOne = buildVariantContext("source", "one", 100);
    final VariantContext contextTwo = buildVariantContext("source", "two", 100);
    final List<String> contigs = getOrderedContigList(contextOne, contextTwo);
    Assert.assertTrue(new VariantContextComparator(contigs).compare(contextOne, contextTwo) < 0);
    Assert.assertTrue(new VariantContextComparator(contigs).compare(contextTwo, contextOne) > 0);
  }
View Full Code Here

    Assert.assertTrue(new VariantContextComparator(contigs).compare(contextTwo, contextOne) > 0);
  }

  @Test
  public void testCombinationOne() {
    final VariantContext contextOne = buildVariantContext("source", "one", 100);
    final VariantContext contextTwo = buildVariantContext("source", "two", 150);
    final List<String> contigs = getOrderedContigList(contextOne, contextTwo);
    Assert.assertTrue(new VariantContextComparator(contigs).compare(contextOne, contextTwo) < 0);
    Assert.assertTrue(new VariantContextComparator(contigs).compare(contextTwo, contextOne) > 0);
  }
View Full Code Here

TOP

Related Classes of htsjdk.variant.variantcontext.VariantContext

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.