Moved some of the java to scala conversions from production to test code as it's not needed in production and slows down the code.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5769 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
28b897d5de
commit
4d08d39849
|
|
@ -41,6 +41,6 @@ class ContigScatterFunction extends GATKScatterFunction with InProcessFunction {
|
||||||
|
|
||||||
def run() {
|
def run() {
|
||||||
val gi = GATKScatterFunction.getGATKIntervals(this.referenceSequence, this.intervals)
|
val gi = GATKScatterFunction.getGATKIntervals(this.referenceSequence, this.intervals)
|
||||||
IntervalUtils.scatterContigIntervals(gi.samFileHeader, gi.javaLocs, this.scatterOutputFiles)
|
IntervalUtils.scatterContigIntervals(gi.samFileHeader, gi.locs, this.scatterOutputFiles)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,9 +42,7 @@ case class GATKIntervals(reference: File, intervals: List[String]) {
|
||||||
header
|
header
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy val locs: List[GenomeLoc] = javaLocs.toList
|
lazy val locs: java.util.List[GenomeLoc] = {
|
||||||
|
|
||||||
lazy val javaLocs: java.util.List[GenomeLoc] = {
|
|
||||||
val parser = new GenomeLocParser(referenceDataSource.getReference)
|
val parser = new GenomeLocParser(referenceDataSource.getReference)
|
||||||
val parsedLocs =
|
val parsedLocs =
|
||||||
if (intervals.isEmpty)
|
if (intervals.isEmpty)
|
||||||
|
|
@ -55,11 +53,11 @@ case class GATKIntervals(reference: File, intervals: List[String]) {
|
||||||
Collections.unmodifiableList(parsedLocs)
|
Collections.unmodifiableList(parsedLocs)
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy val contigs = locs.map(_.getContig).distinct
|
lazy val contigs = locs.map(_.getContig).distinct.toList
|
||||||
|
|
||||||
def getSplits(size: Int) = {
|
def getSplits(size: Int) = {
|
||||||
splitsBySize.getOrElse(size, {
|
splitsBySize.getOrElse(size, {
|
||||||
val splits: java.util.List[java.lang.Integer] = IntervalUtils.splitFixedIntervals(javaLocs, size)
|
val splits: java.util.List[java.lang.Integer] = IntervalUtils.splitFixedIntervals(locs, size)
|
||||||
splitsBySize += size -> splits
|
splitsBySize += size -> splits
|
||||||
splits
|
splits
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,12 @@ class GATKIntervalsUnitTest {
|
||||||
private final lazy val hg18Reference = new File(BaseTest.hg18Reference)
|
private final lazy val hg18Reference = new File(BaseTest.hg18Reference)
|
||||||
private final lazy val hg18GenomeLocParser = new GenomeLocParser(new CachingIndexedFastaSequenceFile(hg18Reference))
|
private final lazy val hg18GenomeLocParser = new GenomeLocParser(new CachingIndexedFastaSequenceFile(hg18Reference))
|
||||||
private final lazy val hg18ReferenceLocs = GenomeLocSortedSet.
|
private final lazy val hg18ReferenceLocs = GenomeLocSortedSet.
|
||||||
createSetFromSequenceDictionary(new ReferenceDataSource(hg18Reference).getReference.getSequenceDictionary).toList.toList
|
createSetFromSequenceDictionary(new ReferenceDataSource(hg18Reference).getReference.getSequenceDictionary).toList
|
||||||
|
|
||||||
private final lazy val hg19Reference = new File(BaseTest.hg19Reference)
|
private final lazy val hg19Reference = new File(BaseTest.hg19Reference)
|
||||||
private final lazy val hg19GenomeLocParser = new GenomeLocParser(new CachingIndexedFastaSequenceFile(hg19Reference))
|
private final lazy val hg19GenomeLocParser = new GenomeLocParser(new CachingIndexedFastaSequenceFile(hg19Reference))
|
||||||
private final lazy val hg19ReferenceLocs = GenomeLocSortedSet.
|
private final lazy val hg19ReferenceLocs = GenomeLocSortedSet.
|
||||||
createSetFromSequenceDictionary(new ReferenceDataSource(hg19Reference).getReference.getSequenceDictionary).toList.toList
|
createSetFromSequenceDictionary(new ReferenceDataSource(hg19Reference).getReference.getSequenceDictionary).toList
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
def testWithIntervals() {
|
def testWithIntervals() {
|
||||||
|
|
@ -51,7 +51,7 @@ class GATKIntervalsUnitTest {
|
||||||
val chr3 = hg18GenomeLocParser.parseGenomeInterval("chr3:3-5")
|
val chr3 = hg18GenomeLocParser.parseGenomeInterval("chr3:3-5")
|
||||||
|
|
||||||
val gi = new GATKIntervals(hg18Reference, List("chr1:1-1", "chr2:2-3", "chr3:3-5"))
|
val gi = new GATKIntervals(hg18Reference, List("chr1:1-1", "chr2:2-3", "chr3:3-5"))
|
||||||
Assert.assertEquals(gi.locs, List(chr1, chr2, chr3))
|
Assert.assertEquals(gi.locs.toList, List(chr1, chr2, chr3))
|
||||||
Assert.assertEquals(gi.contigs, List("chr1", "chr2", "chr3"))
|
Assert.assertEquals(gi.contigs, List("chr1", "chr2", "chr3"))
|
||||||
Assert.assertEquals(gi.getSplits(2).toList, List(2, 3))
|
Assert.assertEquals(gi.getSplits(2).toList, List(2, 3))
|
||||||
Assert.assertEquals(gi.getSplits(3).toList, List(1, 2, 3))
|
Assert.assertEquals(gi.getSplits(3).toList, List(1, 2, 3))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue