Skip to content

Commit

Permalink
Fix up merge conflicts, add forward reference to VariantAnnotation, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
heuermh authored and fnothaft committed Dec 29, 2016
1 parent 8ed8266 commit 9e38f17
Show file tree
Hide file tree
Showing 10 changed files with 176 additions and 220 deletions.

Large diffs are not rendered by default.

14 changes: 4 additions & 10 deletions adam-core/src/main/scala/org/bdgenomics/adam/rdd/ADAMContext.scala
Expand Up @@ -927,11 +927,8 @@ class ADAMContext(@transient val sc: SparkContext) extends Serializable with Log
// load vcf metadata
val (sd, samples, headers) = loadVcfMetadata(filePath)

val vcc = new VariantContextConverter()
val variantContextConvFn = vcc.makeHtsjdkVariantContextConverter(headers)
val genotypeConvFn = vcc.makeHtsjdkGenotypeConverter(headers)

VariantContextRDD(records.flatMap(p => vcc.convert(p._2.get, variantContextConvFn, genotypeConvFn)),
val vcc = new VariantContextConverter(headers)
VariantContextRDD(records.flatMap(p => vcc.convert(p._2.get, stringency)),
sd,
samples,
cleanAndMixInSupportedLines(headers, stringency))
Expand Down Expand Up @@ -971,11 +968,8 @@ class ADAMContext(@transient val sc: SparkContext) extends Serializable with Log
// load vcf metadata
val (sd, samples, headers) = loadVcfMetadata(filePath)

val vcc = new VariantContextConverter()
val variantContextConvFn = vcc.makeHtsjdkVariantContextConverter(headers)
val genotypeConvFn = vcc.makeHtsjdkGenotypeConverter(headers)

VariantContextRDD(records.flatMap(p => vcc.convert(p._2.get, variantContextConvFn, genotypeConvFn)),
val vcc = new VariantContextConverter(headers)
VariantContextRDD(records.flatMap(p => vcc.convert(p._2.get, stringency)),
sd,
samples,
cleanAndMixInSupportedLines(headers, stringency))
Expand Down
Expand Up @@ -17,6 +17,7 @@
*/
package org.bdgenomics.adam.rdd.variant

import htsjdk.samtools.ValidationStringency
import htsjdk.variant.variantcontext.writer.{
Options,
VariantContextWriterBuilder
Expand Down Expand Up @@ -58,9 +59,7 @@ private[variant] case class VCFInFormatter private (
protected val companion = VCFInFormatter

// make a converter
val converter = new VariantContextConverter()
val variantContextConvFn = converter.makeBdgVariantContextConverter(headerLines)
val genotypeConvFn = converter.makeBdgGenotypeConverter(headerLines)
val converter = new VariantContextConverter(headerLines)

/**
* Writes variant contexts to an output stream in VCF format.
Expand All @@ -83,7 +82,7 @@ private[variant] case class VCFInFormatter private (

// write the records
iter.foreach(r => {
val optVc = converter.convert(r, variantContextConvFn, genotypeConvFn)
val optVc = converter.convert(r, ValidationStringency.LENIENT)
optVc.foreach(vc => {
writer.add(vc)
})
Expand Down
Expand Up @@ -17,6 +17,7 @@
*/
package org.bdgenomics.adam.rdd.variant

import htsjdk.samtools.ValidationStringency
import htsjdk.variant.vcf.{
VCFCodec,
VCFHeaderLine
Expand Down Expand Up @@ -46,9 +47,7 @@ case class VCFOutFormatter(headerLines: Seq[VCFHeaderLine]) extends OutFormatter
def read(is: InputStream): Iterator[VariantContext] = {

// make converter and empty dicts
val converter = new VariantContextConverter
val variantContextConvFn = converter.makeHtsjdkVariantContextConverter(headerLines)
val genotypeConvFn = converter.makeHtsjdkGenotypeConverter(headerLines)
val converter = new VariantContextConverter(headerLines)

// make line reader iterator
val lri = new AsciiLineReaderIterator(new AsciiLineReader(is))
Expand All @@ -65,7 +64,7 @@ case class VCFOutFormatter(headerLines: Seq[VCFHeaderLine]) extends OutFormatter
iter.close()
records.toIterator
} else {
val nextRecords = records ++ converter.convert(codec.decode(iter.next), variantContextConvFn, genotypeConvFn)
val nextRecords = records ++ converter.convert(codec.decode(iter.next), ValidationStringency.LENIENT)
convertIterator(iter, nextRecords)
}
}
Expand Down
Expand Up @@ -113,11 +113,9 @@ case class VariantContextRDD(rdd: RDD[VariantContext],
val sampleIds = samples.map(_.getSampleId)

// convert the variants to htsjdk VCs
val converter = new VariantContextConverter()
val variantContextConvFn = converter.makeBdgVariantContextConverter(headerLines)
val genotypeConvFn = converter.makeBdgGenotypeConverter(headerLines)
val converter = new VariantContextConverter(headerLines)
val writableVCs: RDD[(LongWritable, VariantContextWritable)] = rdd.flatMap(vc => {
converter.convert(vc, variantContextConvFn, genotypeConvFn, stringency = stringency)
converter.convert(vc, stringency)
.map(htsjdkVc => {
val vcw = new VariantContextWritable
vcw.set(htsjdkVc)
Expand Down

0 comments on commit 9e38f17

Please sign in to comment.