Commit 67e03c46 authored by Sander van der Zeeuw's avatar Sander van der Zeeuw
Browse files

Merge branch 'fix-gearsreflective' into 'develop'

NO more reflective issues, simplify some refs.

Remove reflective calls within GearsTrait.

See merge request !170
parents 24837f5b b14d290d
...@@ -236,39 +236,42 @@ trait GearsTrait extends MultiSampleQScript with SummaryQScript { qscript => ...@@ -236,39 +236,42 @@ trait GearsTrait extends MultiSampleQScript with SummaryQScript { qscript =>
case _ => None case _ => None
} }
}).flatten.toList) }).flatten.toList)
lazy val alnFileDirty: File = sampleAlnJob.output def alnFile: File = sampleBamLinkJob.output
lazy val alnFile: File = sampleAlnJob.output
/** Job for combining all library BAMs */ /** Job for combining all library BAMs */
private def sampleAlnJob: CombineFileFunction = private def sampleBamLinkJob: Ln =
makeCombineJob(libraries.values.map(_.alnFile).toList, createFile(".bam")) makeCombineJob(libraries.values.map(_.alnFile).toList, createFile(".bam"))
/** Super type of Ln and MergeSamFiles */
private type CombineFileFunction = QFunction { def output: File }
/** Ln or MergeSamFile job, depending on how many inputs are supplied */ /** Ln or MergeSamFile job, depending on how many inputs are supplied */
private def makeCombineJob(inFiles: List[File], outFile: File, private def makeCombineJob(inFiles: List[File], outFile: File,
mergeSortOrder: String = "coordinate"): CombineFileFunction = { mergeSortOrder: String = "coordinate"): Ln = {
require(inFiles.nonEmpty, "At least one input files for combine job") require(inFiles.nonEmpty, "At least one input files for combine job")
if (inFiles.size == 1) { val input: File = {
val job = new Ln(qscript)
job.input = inFiles.head if (inFiles.size == 1) inFiles.head
job.output = outFile else {
job val mergedBam = createFile(".merged.bam")
} else { val mergejob = new MergeSamFiles(qscript)
val job = new MergeSamFiles(qscript) mergejob.input = inFiles
job.input = inFiles mergejob.output = mergedBam
job.output = outFile mergejob.sortOrder = mergeSortOrder
job.sortOrder = mergeSortOrder add(mergejob)
job mergejob.output
}
} }
val linkJob = new Ln(qscript)
linkJob.input = input
linkJob.output = outFile
linkJob
} }
/** This will add sample jobs */ /** This will add sample jobs */
def addJobs(): Unit = { def addJobs(): Unit = {
addPerLibJobs() addPerLibJobs()
// merge or symlink per-library alignments // merge or symlink per-library alignments
add(sampleAlnJob) add(sampleBamLinkJob)
if (preProcessBam.isDefined) { if (preProcessBam.isDefined) {
val bamMetrics = new BamMetrics(qscript) val bamMetrics = new BamMetrics(qscript)
......
Supports Markdown
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