now processes either a single bam file or a list of bam files in parallel.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5256 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
52eedaf22d
commit
b4da843c49
|
|
@ -2,6 +2,7 @@ import org.broadinstitute.sting.queue.extensions.gatk._
|
|||
import org.broadinstitute.sting.queue.extensions.picard.PicardBamJarFunction
|
||||
import org.broadinstitute.sting.queue.QScript
|
||||
import org.broadinstitute.sting.queue.extensions.samtools.SamtoolsIndexFunction
|
||||
import scala.io.Source
|
||||
|
||||
|
||||
class dataProcessing extends QScript {
|
||||
|
|
@ -14,7 +15,7 @@ class dataProcessing extends QScript {
|
|||
var dedupJar: File = _
|
||||
|
||||
@Input(doc="input BAM file", shortName="input", required=true)
|
||||
var inputBam: File = _
|
||||
var inputBam: String = _
|
||||
|
||||
@Input(doc="output path", shortName="outputDir", required=false)
|
||||
var outputDir: String = ""
|
||||
|
|
@ -31,11 +32,25 @@ class dataProcessing extends QScript {
|
|||
|
||||
def script = {
|
||||
|
||||
// Populates the list of files to process either from a single bam or from a list of bams.
|
||||
var bamList: List[String] = Nil
|
||||
if (inputBam.endsWith("bam")) {
|
||||
bamList :+= inputBam
|
||||
}
|
||||
else { // todo: maybe check if the filename ends with .list?
|
||||
for (bam <- Source.fromFile(inputBam).getLines())
|
||||
bamList :+= bam
|
||||
}
|
||||
|
||||
bamList.foreach { bam =>
|
||||
|
||||
println("DEBUG: bam = " + new File(bam))
|
||||
|
||||
// Files generated by the pipeline
|
||||
val baseName: String = swapExt(qscript.inputBam, ".bam", "").toString()
|
||||
val baseName: String = swapExt(new File(bam.substring(bam.lastIndexOf("/")+1)), ".bam", "").toString()
|
||||
val cleanedBam: String = baseName + ".cleaned.bam"
|
||||
val dedupedBam: String = baseName + ".cleaned.dedup.bam"
|
||||
val metricsFile: String = swapExt(qscript.inputBam, "bam", "metrics").toString()
|
||||
val metricsFile: String = baseName + ".metrics"
|
||||
val targetIntervals: String = baseName + ".indel.intervals"
|
||||
val recalFile: String = baseName + ".recal.csv"
|
||||
val recalBam: String = baseName + ".cleaned.dedup.recal.bam"
|
||||
|
|
@ -58,7 +73,7 @@ class dataProcessing extends QScript {
|
|||
|
||||
|
||||
val target = new RealignerTargetCreator with CommandLineGATKArgs
|
||||
target.input_file :+= qscript.inputBam
|
||||
target.input_file :+= new File(bam)
|
||||
target.out = new File(targetIntervals)
|
||||
target.mismatchFraction = Some(0.0)
|
||||
target.rodBind :+= RodBind("dbsnp", "VCF", dbSNP)
|
||||
|
|
@ -73,7 +88,7 @@ class dataProcessing extends QScript {
|
|||
// 2.) Clean without SW
|
||||
|
||||
val clean = new IndelRealigner with CommandLineGATKArgs
|
||||
clean.input_file :+= qscript.inputBam
|
||||
clean.input_file :+= new File(bam)
|
||||
clean.targetIntervals = new File(targetIntervals)
|
||||
clean.out = new File(cleanedBam)
|
||||
clean.doNotUseSW = true
|
||||
|
|
@ -118,4 +133,5 @@ class dataProcessing extends QScript {
|
|||
|
||||
add(target, clean, dedup, index, cov, recal)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue