diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastq.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastq.scala index e8042553b5c32affee466c6372eeac29d1e5f7c6..57885eedfa68c7ac2c31312f1579f3b5fcda850b 100644 --- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastq.scala +++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastq.scala @@ -102,7 +102,7 @@ object ExtractAlignedFastq extends ToolCommand { val queries: Array[QueryInterval] = iv.toList // transform to QueryInterval - .map(x => new QueryInterval(getSequenceIndex(x.getSequence), x.getStart, x.getEnd)) + .map(x => new QueryInterval(getSequenceIndex(x.getContig), x.getStart, x.getEnd)) // sort Interval .sortBy(x => (x.referenceIndex, x.start, x.end)) // cast to array diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/VcfStats.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/VcfStats.scala index 7e3200d3e7d1525d53aeb4fa40abde0d0aecbaf8..d34e8cf9d99c7524c007799c67c04471ae0042f6 100644 --- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/VcfStats.scala +++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/VcfStats.scala @@ -358,7 +358,7 @@ object VcfStats extends ToolCommand { logger.info("Starting on: " + interval) for ( - record <- reader.query(interval.getSequence, interval.getStart, interval.getEnd) if record.getStart <= interval.getEnd + record <- reader.query(interval.getContig, interval.getStart, interval.getEnd) if record.getStart <= interval.getEnd ) { mergeNestedStatsMap(stats.generalStats, checkGeneral(record, adInfoTags)) for (sample1 <- samples) yield { @@ -376,7 +376,7 @@ object VcfStats extends ToolCommand { reader.close() if (commandArgs.writeBinStats) { - val binOutputDir = new File(commandArgs.outputDir, "bins" + File.separator + interval.getSequence) + val binOutputDir = new File(commandArgs.outputDir, "bins" + File.separator + interval.getContig) writeGenotypeField(stats, samples, "general", binOutputDir, prefix = "genotype-" + interval.getStart + "-" + interval.getEnd) writeField(stats, "general", binOutputDir, prefix = interval.getStart + "-" + interval.getEnd) @@ -439,7 +439,7 @@ object VcfStats extends ToolCommand { } protected def writeWiggle(intervals: List[Interval], row: String, column: String, outputFile: File, genotype: Boolean): Unit = { - val groupedIntervals = intervals.groupBy(_.getSequence).map { case (k, v) => k -> v.sortBy(_.getStart) } + val groupedIntervals = intervals.groupBy(_.getContig).map { case (k, v) => k -> v.sortBy(_.getStart) } outputFile.getParentFile.mkdirs() val writer = new PrintWriter(outputFile) writer.println("track type=wiggle_0") diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/WipeReads.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/WipeReads.scala index 4060560236166e49d80d104b09a682d116afb16f..f010c1cc743a499fbfed63e3de32e8edeb7ac7de 100644 --- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/WipeReads.scala +++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/WipeReads.scala @@ -149,12 +149,12 @@ object WipeReads extends ToolCommand { throw new IllegalArgumentException("Unexpected interval file type: " + inFile.getPath) iterFunc(inFile).toList - .sortBy(x => (x.getSequence, x.getStart, x.getEnd)) + .sortBy(x => (x.getContig, x.getStart, x.getEnd)) .foldLeft(List.empty[Interval])( (acc, x) => { acc match { case head :: tail if x.intersects(head) => - new Interval(x.getSequence, min(x.getStart, head.getStart), max(x.getEnd, head.getEnd)) :: tail + new Interval(x.getContig, min(x.getStart, head.getStart), max(x.getEnd, head.getEnd)) :: tail case _ => x :: acc } } @@ -193,16 +193,16 @@ object WipeReads extends ToolCommand { */ def makeQueryInterval(in: SamReader, iv: Interval): Option[QueryInterval] = { val getIndex = in.getFileHeader.getSequenceIndex _ - if (getIndex(iv.getSequence) > -1) - Some(new QueryInterval(getIndex(iv.getSequence), iv.getStart, iv.getEnd)) - else if (iv.getSequence.startsWith("chr") && getIndex(iv.getSequence.substring(3)) > -1) { + if (getIndex(iv.getContig) > -1) + Some(new QueryInterval(getIndex(iv.getContig), iv.getStart, iv.getEnd)) + else if (iv.getContig.startsWith("chr") && getIndex(iv.getContig.substring(3)) > -1) { logger.warn("Removing 'chr' prefix from interval " + iv.toString) - Some(new QueryInterval(getIndex(iv.getSequence.substring(3)), iv.getStart, iv.getEnd)) - } else if (!iv.getSequence.startsWith("chr") && getIndex("chr" + iv.getSequence) > -1) { + Some(new QueryInterval(getIndex(iv.getContig.substring(3)), iv.getStart, iv.getEnd)) + } else if (!iv.getContig.startsWith("chr") && getIndex("chr" + iv.getContig) > -1) { logger.warn("Adding 'chr' prefix to interval " + iv.toString) - Some(new QueryInterval(getIndex("chr" + iv.getSequence), iv.getStart, iv.getEnd)) + Some(new QueryInterval(getIndex("chr" + iv.getContig), iv.getStart, iv.getEnd)) } else { - logger.warn("Sequence " + iv.getSequence + " does not exist in alignment") + logger.warn("Sequence " + iv.getContig + " does not exist in alignment") None } } diff --git a/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastqTest.scala b/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastqTest.scala index 9b4958b4538c11693d1a91f4bfcb0c82427445ba..c62c6bd19c5980c0ffcba55223a974b78a946c24 100644 --- a/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastqTest.scala +++ b/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastqTest.scala @@ -58,7 +58,7 @@ class ExtractAlignedFastqTest extends TestNGSuite with MockitoSugar with Matcher @Test def testIntervalStartEnd() = { val obs = makeIntervalFromString(List("chr5:1000-1100")).next() val exp = new Interval("chr5", 1000, 1100) - obs.getSequence should ===(exp.getSequence) + obs.getContig should ===(exp.getContig) obs.getStart should ===(exp.getStart) obs.getEnd should ===(exp.getEnd) } @@ -66,7 +66,7 @@ class ExtractAlignedFastqTest extends TestNGSuite with MockitoSugar with Matcher @Test def testIntervalStartEndComma() = { val obs = makeIntervalFromString(List("chr5:1,000-1,100")).next() val exp = new Interval("chr5", 1000, 1100) - obs.getSequence should ===(exp.getSequence) + obs.getContig should ===(exp.getContig) obs.getStart should ===(exp.getStart) obs.getEnd should ===(exp.getEnd) } @@ -74,7 +74,7 @@ class ExtractAlignedFastqTest extends TestNGSuite with MockitoSugar with Matcher @Test def testIntervalStartEndDot() = { val obs = makeIntervalFromString(List("chr5:1.000-1.100")).next() val exp = new Interval("chr5", 1000, 1100) - obs.getSequence should ===(exp.getSequence) + obs.getContig should ===(exp.getContig) obs.getStart should ===(exp.getStart) obs.getEnd should ===(exp.getEnd) } @@ -82,7 +82,7 @@ class ExtractAlignedFastqTest extends TestNGSuite with MockitoSugar with Matcher @Test def testIntervalStart() = { val obs = makeIntervalFromString(List("chr5:1000")).next() val exp = new Interval("chr5", 1000, 1000) - obs.getSequence should ===(exp.getSequence) + obs.getContig should ===(exp.getContig) obs.getStart should ===(exp.getStart) obs.getEnd should ===(exp.getEnd) } diff --git a/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/WipeReadsTest.scala b/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/WipeReadsTest.scala index 4b98bba0c873a0ec5aa9c48a51c36475280adbfb..4919486d601415c307b44e4f016bd80fb05a97e8 100644 --- a/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/WipeReadsTest.scala +++ b/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/WipeReadsTest.scala @@ -140,10 +140,10 @@ class WipeReadsTest extends TestNGSuite with MockitoSugar with Matchers { @Test def testMakeIntervalFromBed() = { val intervals: List[Interval] = makeIntervalFromFile(BedFile1) intervals.length shouldBe 3 - intervals.head.getSequence should ===("chrQ") + intervals.head.getContig should ===("chrQ") intervals.head.getStart shouldBe 991 intervals.head.getEnd shouldBe 1000 - intervals.last.getSequence should ===("chrQ") + intervals.last.getContig should ===("chrQ") intervals.last.getStart shouldBe 291 intervals.last.getEnd shouldBe 320 } @@ -151,13 +151,13 @@ class WipeReadsTest extends TestNGSuite with MockitoSugar with Matchers { @Test def testMakeIntervalFromRefFlat() = { val intervals: List[Interval] = makeIntervalFromFile(RefFlatFile1) intervals.length shouldBe 5 - intervals.head.getSequence should ===("chrS") + intervals.head.getContig should ===("chrS") intervals.head.getStart shouldBe 101 intervals.head.getEnd shouldBe 500 - intervals(2).getSequence should ===("chrQ") + intervals(2).getContig should ===("chrQ") intervals(2).getStart shouldBe 801 intervals(2).getEnd shouldBe 1000 - intervals.last.getSequence should ===("chrQ") + intervals.last.getContig should ===("chrQ") intervals.last.getStart shouldBe 101 intervals.last.getEnd shouldBe 200 } @@ -165,10 +165,10 @@ class WipeReadsTest extends TestNGSuite with MockitoSugar with Matchers { @Test def testMakeIntervalFromGtf() = { val intervals: List[Interval] = makeIntervalFromFile(GtfFile1, "exon") intervals.length shouldBe 3 - intervals.head.getSequence should ===("chrQ") + intervals.head.getContig should ===("chrQ") intervals.head.getStart shouldBe 669 intervals.head.getEnd shouldBe 778 - intervals.last.getSequence should ===("chrP") + intervals.last.getContig should ===("chrP") intervals.last.getStart shouldBe 2949 intervals.last.getEnd shouldBe 3063 } @@ -176,10 +176,10 @@ class WipeReadsTest extends TestNGSuite with MockitoSugar with Matchers { @Test def testMakeIntervalFromBedOverlap() = { val intervals: List[Interval] = makeIntervalFromFile(BedFile2) intervals.length shouldBe 4 - intervals.head.getSequence should ===("chrQ") + intervals.head.getContig should ===("chrQ") intervals.head.getStart shouldBe 451 intervals.head.getEnd shouldBe 480 - intervals.last.getSequence should ===("chrQ") + intervals.last.getContig should ===("chrQ") intervals.last.getStart shouldBe 2 intervals.last.getEnd shouldBe 250 }