Fixing 'revert' when not realigning
RevertSam was reverting the alignment information and that was screwing up the pipeline if you didn't want to run it with BWA. Fixed.
This commit is contained in:
parent
c1329c4dde
commit
d7367c152a
|
|
@ -149,7 +149,7 @@ class DataProcessingPipeline extends QScript {
|
||||||
var index = 1
|
var index = 1
|
||||||
for (bam <- bams) {
|
for (bam <- bams) {
|
||||||
// first revert the BAM file to the original qualities
|
// first revert the BAM file to the original qualities
|
||||||
val revertedBAM = revertBAM(bam)
|
val revertedBAM = revertBAM(bam, true)
|
||||||
val readSortedBam = swapExt(revertedBAM, ".bam", "." + index + ".sorted.bam" )
|
val readSortedBam = swapExt(revertedBAM, ".bam", "." + index + ".sorted.bam" )
|
||||||
val saiFile1 = swapExt(bam, ".bam", "." + index + ".1.sai")
|
val saiFile1 = swapExt(bam, ".bam", "." + index + ".1.sai")
|
||||||
val saiFile2 = swapExt(bam, ".bam", "." + index + ".2.sai")
|
val saiFile2 = swapExt(bam, ".bam", "." + index + ".2.sai")
|
||||||
|
|
@ -183,16 +183,16 @@ class DataProcessingPipeline extends QScript {
|
||||||
ConsensusDeterminationModel.USE_READS
|
ConsensusDeterminationModel.USE_READS
|
||||||
}
|
}
|
||||||
|
|
||||||
def revertBams(bams: List[File]): List[File] = {
|
def revertBams(bams: List[File], removeAlignmentInformation: Boolean): List[File] = {
|
||||||
var revertedBAMList: List[File] = List()
|
var revertedBAMList: List[File] = List()
|
||||||
for (bam <- bams)
|
for (bam <- bams)
|
||||||
revertedBAMList :+= revertBAM(bam)
|
revertedBAMList :+= revertBAM(bam, removeAlignmentInformation)
|
||||||
return revertedBAMList
|
return revertedBAMList
|
||||||
}
|
}
|
||||||
|
|
||||||
def revertBAM(bam: File): File = {
|
def revertBAM(bam: File, removeAlignmentInformation: Boolean): File = {
|
||||||
val revertedBAM = swapExt(bam, ".bam", ".reverted.bam")
|
val revertedBAM = swapExt(bam, ".bam", ".reverted.bam")
|
||||||
add(revert(bam, revertedBAM))
|
add(revert(bam, revertedBAM, removeAlignmentInformation))
|
||||||
return revertedBAM
|
return revertedBAM
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -212,7 +212,7 @@ class DataProcessingPipeline extends QScript {
|
||||||
val bams = QScriptUtils.createListFromFile(input)
|
val bams = QScriptUtils.createListFromFile(input)
|
||||||
nContigs = QScriptUtils.getNumberOfContigs(bams(0))
|
nContigs = QScriptUtils.getNumberOfContigs(bams(0))
|
||||||
|
|
||||||
val realignedBAMs = if (useBWApe || useBWAse) {performAlignment(bams)} else {revertBams(bams)}
|
val realignedBAMs = if (useBWApe || useBWAse) {performAlignment(bams)} else {revertBams(bams, false)}
|
||||||
|
|
||||||
// generate a BAM file per sample joining all per lane files if necessary
|
// generate a BAM file per sample joining all per lane files if necessary
|
||||||
val sampleBAMFiles: Map[String, List[File]] = createSampleFiles(bams, realignedBAMs)
|
val sampleBAMFiles: Map[String, List[File]] = createSampleFiles(bams, realignedBAMs)
|
||||||
|
|
@ -408,9 +408,10 @@ class DataProcessingPipeline extends QScript {
|
||||||
this.jobName = queueLogDir + outBam + ".rg"
|
this.jobName = queueLogDir + outBam + ".rg"
|
||||||
}
|
}
|
||||||
|
|
||||||
case class revert (inBam: File, outBam: File) extends RevertSam with ExternalCommonArgs {
|
case class revert (inBam: File, outBam: File, removeAlignmentInfo: Boolean) extends RevertSam with ExternalCommonArgs {
|
||||||
this.output = outBam
|
this.output = outBam
|
||||||
this.input :+= inBam
|
this.input :+= inBam
|
||||||
|
this.removeAlignmentInformation = removeAlignmentInfo;
|
||||||
this.analysisName = queueLogDir + outBam + "revert"
|
this.analysisName = queueLogDir + outBam + "revert"
|
||||||
this.jobName = queueLogDir + outBam + ".revert"
|
this.jobName = queueLogDir + outBam + ".revert"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue