Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaning up build warnings. #284

Merged
merged 1 commit into from
Jul 2, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ object ADAMVariantContext {
assert(genotypes.map(ReferencePosition(_)).forall(_ == position),
"Genotypes do not all have the same position.")

val variant = genotypes.head.variant
val variant = genotypes.head.getVariant

new ADAMVariantContext(position, variant, genotypes, None)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ import org.apache.spark.rdd.RDD

object SingleReadBucket extends Logging {
def apply(rdd: RDD[ADAMRecord]): RDD[SingleReadBucket] = {
for (((recordGroup, readName), reads) <- rdd.groupBy(p => (p.getRecordGroupId, p.getReadName))) yield {
val (mapped, unmapped) = reads.partition(_.getReadMapped)
val (primaryMapped, secondaryMapped) = mapped.partition(_.getPrimaryAlignment)
// TODO: consider doing validation here (e.g. read says mate mapped but it doesn't exist)
new SingleReadBucket(primaryMapped, secondaryMapped, unmapped)
}
rdd.groupBy(p => (p.getRecordGroupId, p.getReadName))
.map(kv => {
val ((recordGroup, readName), reads) = kv

// split by mapping
val (mapped, unmapped) = reads.partition(_.getReadMapped)
val (primaryMapped, secondaryMapped) = mapped.partition(_.getPrimaryAlignment)

// TODO: consider doing validation here (e.g. read says mate mapped but it doesn't exist)
new SingleReadBucket(primaryMapped, secondaryMapped, unmapped)
})
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,9 @@ object GenotypesSummaryFormatting {

private def sortedGenotypeAlleles(stats: GenotypesSummaryCounts): Seq[List[ADAMGenotypeAllele]] = {
def genotypeSortOrder(genotype: List[ADAMGenotypeAllele]): Int = genotype.map({
case ADAMGenotypeAllele.Ref => 0
case ADAMGenotypeAllele.Alt => 1
case ADAMGenotypeAllele.NoCall => 10 // arbitrary large number so any genotype with a NoCall sorts last.
case ADAMGenotypeAllele.Ref => 0
case ADAMGenotypeAllele.Alt | ADAMGenotypeAllele.OtherAlt => 1 // alt/otheralt sort to same point
case ADAMGenotypeAllele.NoCall => 10 // arbitrary large number so any genotype with a NoCall sorts last.
}).sum
stats.genotypesCounts.keySet.toList.sortBy(genotypeSortOrder(_))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ private[rdd] object MarkDuplicates extends Serializable {
p._1.read2refPos
}

for (
((leftPos, library), readsByLeftPos) <- rdd.adamSingleReadBuckets().keyBy(ReferencePositionPair(_)).groupBy(leftPositionAndLibrary);
buckets <- {
rdd.adamSingleReadBuckets().keyBy(ReferencePositionPair(_)).groupBy(leftPositionAndLibrary)
.flatMap(kv => {
val ((leftPos, library), readsByLeftPos) = kv

leftPos match {
val buckets = leftPos match {
// These are all unmapped reads. There is no way to determine if they are duplicates
case None =>
markReads(readsByLeftPos.toSeq.unzip._2, areDups = false)
Expand Down Expand Up @@ -108,9 +108,9 @@ private[rdd] object MarkDuplicates extends Serializable {
Seq.empty
}
}
};
read <- buckets.allReads
) yield read

buckets.flatMap(_.allReads)
})
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class IlluminaOptics(val tile: Long, val x: Long, val y: Long) {}

class RichADAMRecord(val record: ADAMRecord) {

lazy val referenceLength: Int = RichADAMRecord.referenceLengthFromCigar(record.cigar.toString)
lazy val referenceLength: Int = RichADAMRecord.referenceLengthFromCigar(record.getCigar.toString)

lazy val readRegion = ReferenceRegion(this)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class PileupTraversable(reads: RDD[ADAMRecord]) extends Traversable[Pileup] with
pileups --= locationsToFlush
}

for (read: ADAMRecord <- reads) {
reads.foreach((read: ADAMRecord) => {

def updateCurrentInfo(read: ADAMRecord) = {
currentReference = Some(read.getContig.getContigName.toString)
Expand Down Expand Up @@ -254,7 +254,7 @@ class PileupTraversable(reads: RDD[ADAMRecord]) extends Traversable[Pileup] with

// Flush all pileups before the start of this read since they are completed
flushPileups(Some(read.getStart))
}
})

// Flush any remaining pileups
flushPileups()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.bdgenomics.formats.avro.ADAMContig
object Util {
def isSameContig(left: ADAMContig, right: ADAMContig): Boolean = {
left.getContigName == right.getContigName && (
left.getContigMD5 == null || right.contigMD5 == null || left.getContigMD5 == right.getContigMD5)
left.getContigMD5 == null || right.getContigMD5 == null || left.getContigMD5 == right.getContigMD5)
}

def hashCombine(parts: Int*): Int =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class IndelRealignmentTargetSuite extends SparkFunSuite {
sparkTest("creating targets for artificial reads: one-by-one") {
def check_indel(target: IndelRealignmentTarget, read: ADAMRecord): Boolean = {
val indelRange: NumericRange[Long] = target.indelSet.head.getIndelRange()
read.start.toLong match {
read.getStart.toLong match {
case 5L => ((indelRange.start == 34) && (indelRange.end == 43))
case 10L => ((indelRange.start == 54) && (indelRange.end == 63))
case 15L => ((indelRange.start == 34) && (indelRange.end == 43))
Expand All @@ -266,10 +266,10 @@ class IndelRealignmentTargetSuite extends SparkFunSuite {
read => {
val read_rdd: RDD[ADAMRecord] = sc.makeRDD(Seq(read), 1)
val targets = RealignmentTargetFinder(read_rdd)
if (read.start < 105) {
if (read.getStart < 105) {
assert(targets != null)
assert(targets.size === 1) // the later read mates do not have indels
assert(targets.head.getIndelSet().head.readRange.start === read.start)
assert(targets.head.getIndelSet().head.readRange.start === read.getStart)
assert(targets.head.getIndelSet().head.readRange.end === read.end.get - 1)
assert(check_indel(targets.head, read))
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class GenomicRegionPartitionerSuite extends SparkFunSuite {
val count = 1000
val pos = sc.parallelize((1 to count).map(i => adamRecord("chr1", "read_%d".format(i), rand.nextInt(100), readMapped = true)))
val parts = 200
val pairs = pos.map(p => (ReferencePosition(p.contig.getContigName, p.getStart), p))
val pairs = pos.map(p => (ReferencePosition(p.getContig.getContigName, p.getStart), p))
val parter = new RangePartitioner(parts, pairs)
val partitioned = pairs.sortByKey().partitionBy(parter)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class RealignIndelsSuite extends SparkFunSuite {
{
if (read.getStart <= 25) {
var result: Boolean = (2 == target.indelSet.size.toInt)
result = result && (target.getReadRange().start.toLong <= read.start.toLong)
result = result && (target.getReadRange().start.toLong <= read.getStart.toLong)
result && (target.getReadRange().end >= read.end.get - 1L)
} else {
target.isEmpty
Expand Down