Commit 64c8de96 authored by bow's avatar bow
Browse files

Merge branch 'feature-upgrade_queue_3.4' into 'develop'

Feature upgrade queue 3.4

see also #175

See merge request !203
parents ac634ac1 ab759337
......@@ -31,7 +31,7 @@
<dependency>
<groupId>org.broadinstitute.gatk</groupId>
<artifactId>gatk-queue-extensions-distribution</artifactId>
<version>3.3</version>
<version>3.4</version>
</dependency>
</dependencies>
</project>
......@@ -66,17 +66,17 @@
<dependency>
<groupId>org.broadinstitute.gatk</groupId>
<artifactId>gatk-queue</artifactId>
<version>3.3</version>
<version>3.4</version>
</dependency>
<dependency>
<groupId>org.broadinstitute.gatk</groupId>
<artifactId>gatk-queue-extensions-distribution</artifactId>
<version>3.3</version>
<version>3.4</version>
</dependency>
<dependency>
<groupId>org.broadinstitute.gatk</groupId>
<artifactId>gatk-utils</artifactId>
<version>3.3</version>
<version>3.4</version>
<exclusions>
<exclusion>
<groupId>org.broadinstitute.gatk</groupId>
......
......@@ -300,7 +300,7 @@ class BiopetQCommandLine extends CommandLineProgram with Logging {
}
private def getQueueVersion: String = {
val stingResources: ResourceBundle = TextFormattingUtils.loadResourceBundle("StingText")
val stingResources: ResourceBundle = TextFormattingUtils.loadResourceBundle("StingText", this.getClass)
if (stingResources.containsKey("org.broadinstitute.sting.queue.QueueVersion.version")) {
stingResources.getString("org.broadinstitute.sting.queue.QueueVersion.version")
......@@ -310,7 +310,7 @@ class BiopetQCommandLine extends CommandLineProgram with Logging {
}
private def getBuildTimestamp: String = {
val stingResources: ResourceBundle = TextFormattingUtils.loadResourceBundle("StingText")
val stingResources: ResourceBundle = TextFormattingUtils.loadResourceBundle("StingText", this.getClass)
if (stingResources.containsKey("build.timestamp")) {
stingResources.getString("build.timestamp")
......
......@@ -24,7 +24,7 @@ import org.broadinstitute.gatk.utils.commandline.{ Argument, Input, Output }
/** Extension for picard MarkDuplicates */
class MarkDuplicates(val root: Configurable) extends Picard with Summarizable {
javaMainClass = new picard.sam.MarkDuplicates().getClass.getName
javaMainClass = new picard.sam.markduplicates.MarkDuplicates().getClass.getName
@Input(doc = "The input SAM or BAM files to analyze. Must be coordinate sorted.", required = true)
var input: List[File] = Nil
......
......@@ -137,7 +137,7 @@ object AnnotateVcfWithBed extends ToolCommand {
logger.info("Start reading vcf records")
for (record <- reader) {
val overlaps = bedRecords.getOrElse(record.getChr, Nil).filter(x => {
val overlaps = bedRecords.getOrElse(record.getContig, Nil).filter(x => {
record.getStart <= x._2 && record.getEnd >= x._1
})
if (overlaps.isEmpty) {
......
......@@ -97,7 +97,7 @@ object CheckAllelesVcfInBam extends ToolCommand {
val countReports: Map[String, CountReport] = bamReaders.map(x => (x._1, new CountReport))
val refAllele = vcfRecord.getReference.getBaseString
for ((sample, bamReader) <- bamReaders) {
val queryInterval = new QueryInterval(bamHeaders(sample).getSequenceIndex(vcfRecord.getChr),
val queryInterval = new QueryInterval(bamHeaders(sample).getSequenceIndex(vcfRecord.getContig),
vcfRecord.getStart, vcfRecord.getStart + refAllele.length - 1)
val bamIter = bamReader.query(Array(queryInterval), false)
......
......@@ -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
......
......@@ -131,7 +131,7 @@ object MergeAlleles extends ToolCommand {
}
val alleles: mutable.Set[Allele] = mutable.Set()
val builder = new VariantContextBuilder
builder.chr(records.head.getChr)
builder.chr(records.head.getContig)
builder.start(records.head.getStart)
for (record <- records) {
......
......@@ -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")
......@@ -542,7 +542,7 @@ object VcfStats extends ToolCommand {
else addToBuffer(tag, value, found = true)
}
Map(record.getChr -> buffer.toMap, "total" -> buffer.toMap)
Map(record.getContig -> buffer.toMap, "total" -> buffer.toMap)
}
/** Function to check sample/genotype specific stats */
......@@ -593,7 +593,7 @@ object VcfStats extends ToolCommand {
else addToBuffer(tag, value, found = true)
}
Map(record.getChr -> buffer.toMap, "total" -> buffer.toMap)
Map(record.getContig -> buffer.toMap, "total" -> buffer.toMap)
}
/** Function to write 1 specific genotype field */
......
......@@ -109,7 +109,7 @@ object VcfToTsv extends ToolCommand {
writer.println(sortedFields.mkString("#", commandArgs.separator, ""))
for (vcfRecord <- reader) {
val values: mutable.Map[String, Any] = mutable.Map()
values += "CHROM" -> vcfRecord.getChr
values += "CHROM" -> vcfRecord.getContig
values += "POS" -> vcfRecord.getStart
values += "ID" -> vcfRecord.getID
values += "REF" -> vcfRecord.getReference.getBaseString
......
......@@ -141,10 +141,10 @@ object VcfWithVcf extends ToolCommand {
var counter = 0
for (record <- reader) {
val secondaryRecords = if (commandArgs.matchAllele) {
secondaryReader.query(record.getChr, record.getStart, record.getEnd).toList.
secondaryReader.query(record.getContig, record.getStart, record.getEnd).toList.
filter(x => record.getAlternateAlleles.exists(x.hasAlternateAllele))
} else {
secondaryReader.query(record.getChr, record.getStart, record.getEnd).toList
secondaryReader.query(record.getContig, record.getStart, record.getEnd).toList
}
val fieldMap = (for (
......
......@@ -87,7 +87,7 @@ object WipeReads extends ToolCommand {
def makeIntervalFromBed(inFile: File): Iterator[Interval] =
asScalaIteratorConverter(getFeatureReader(inFile.toPath.toString, new BEDCodec(), false).iterator)
.asScala
.map(x => new Interval(x.getChr, x.getStart, x.getEnd))
.map(x => new Interval(x.getContig, x.getStart, x.getEnd))
/**
* Parses a refFlat file to yield Interval objects
......@@ -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
}
}
......
......@@ -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)
}
......
......@@ -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
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment