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:
kshakir 2011-05-05 04:11:15 +00:00
parent 28b897d5de
commit 4d08d39849
3 changed files with 7 additions and 9 deletions

View File

@ -41,6 +41,6 @@ class ContigScatterFunction extends GATKScatterFunction with InProcessFunction {
def run() {
val gi = GATKScatterFunction.getGATKIntervals(this.referenceSequence, this.intervals)
IntervalUtils.scatterContigIntervals(gi.samFileHeader, gi.javaLocs, this.scatterOutputFiles)
IntervalUtils.scatterContigIntervals(gi.samFileHeader, gi.locs, this.scatterOutputFiles)
}
}

View File

@ -42,9 +42,7 @@ case class GATKIntervals(reference: File, intervals: List[String]) {
header
}
lazy val locs: List[GenomeLoc] = javaLocs.toList
lazy val javaLocs: java.util.List[GenomeLoc] = {
lazy val locs: java.util.List[GenomeLoc] = {
val parser = new GenomeLocParser(referenceDataSource.getReference)
val parsedLocs =
if (intervals.isEmpty)
@ -55,11 +53,11 @@ case class GATKIntervals(reference: File, intervals: List[String]) {
Collections.unmodifiableList(parsedLocs)
}
lazy val contigs = locs.map(_.getContig).distinct
lazy val contigs = locs.map(_.getContig).distinct.toList
def getSplits(size: Int) = {
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
splits
})

View File

@ -37,12 +37,12 @@ class GATKIntervalsUnitTest {
private final lazy val hg18Reference = new File(BaseTest.hg18Reference)
private final lazy val hg18GenomeLocParser = new GenomeLocParser(new CachingIndexedFastaSequenceFile(hg18Reference))
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 hg19GenomeLocParser = new GenomeLocParser(new CachingIndexedFastaSequenceFile(hg19Reference))
private final lazy val hg19ReferenceLocs = GenomeLocSortedSet.
createSetFromSequenceDictionary(new ReferenceDataSource(hg19Reference).getReference.getSequenceDictionary).toList.toList
createSetFromSequenceDictionary(new ReferenceDataSource(hg19Reference).getReference.getSequenceDictionary).toList
@Test
def testWithIntervals() {
@ -51,7 +51,7 @@ class GATKIntervalsUnitTest {
val chr3 = hg18GenomeLocParser.parseGenomeInterval("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.getSplits(2).toList, List(2, 3))
Assert.assertEquals(gi.getSplits(3).toList, List(1, 2, 3))