diff --git a/public/biopet-tools-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/tools/MergeTables.scala b/public/biopet-tools-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/tools/MergeTables.scala index e1b94b874d69fc19c684b0f7792364874e6d3f33..96abaf1edb0725c21f8e1d41a698438b13f74d4f 100644 --- a/public/biopet-tools-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/tools/MergeTables.scala +++ b/public/biopet-tools-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/tools/MergeTables.scala @@ -85,7 +85,8 @@ object MergeTables { idCols: List[Int], valCol: Int, numHeaderLines: Int = 0, - fallback: String = "-"): MergeTables = { + fallback: String = "-", + fileExtension: Option[String] = None): MergeTables = { val job = new MergeTables(root) job.inputTables = tables job.output = outputFile @@ -93,6 +94,7 @@ object MergeTables { job.valueColumnIndex = valCol job.fallbackString = Option(fallback) job.numHeaderLines = Option(numHeaderLines) + job.fileExtension = fileExtension job } } \ No newline at end of file diff --git a/public/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/BaseCounter.scala b/public/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/BaseCounter.scala index 8bfc3158e672f5b4b25a39514367e3c53385040f..a88563eb817a2e9d058d5ba4255e6cc86e2bdf42 100644 --- a/public/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/BaseCounter.scala +++ b/public/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/BaseCounter.scala @@ -307,7 +307,7 @@ object BaseCounter extends ToolCommand { val exonCounts = transcript.exons.map(new RegionCount(_)) val intronCounts = if (transcript.exons.size > 1) intronRegions.allRecords.map(e => new RegionCount(e.start + 1, e.end)).toList - else Nil + else Nil def addRecord(samRecord: SAMRecord, sense: Boolean): Unit = { bamRecordBasesOverlap(samRecord, transcript.start, transcript.end, counts, sense) exonCounts.foreach(_.addRecord(samRecord, sense)) diff --git a/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/measures/BaseCounts.scala b/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/measures/BaseCounts.scala index 3ad9146b62648aa438f407f4c6e47b0bcaf00f73..98d1aeed37b4585f0991674b8d6c28755933ba5b 100644 --- a/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/measures/BaseCounts.scala +++ b/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/measures/BaseCounts.scala @@ -29,7 +29,7 @@ class BaseCounts(val root: Configurable) extends QScript with Measurement with A def addTableAndHeatmap(countFiles: List[File], outputName: String): Unit = { val mergedTable = new File(outputDir, s"$name.$outputName.tsv") val heatmapFile = new File(outputDir, s"$name.$outputName.png") - addMergeTableJob(countFiles, mergedTable, outputName) + addMergeTableJob(countFiles, mergedTable, outputName, countFiles.head.getName.stripPrefix(jobs.head._1)) addHeatmapJob(mergedTable, heatmapFile, outputName) } diff --git a/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/measures/CufflinksMeasurement.scala b/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/measures/CufflinksMeasurement.scala index d1cf59fdd666e854fdd7212401145fb444295b2f..2d4f40973c0e1b319de354e23f16de0dc594826b 100644 --- a/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/measures/CufflinksMeasurement.scala +++ b/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/measures/CufflinksMeasurement.scala @@ -1,6 +1,6 @@ package nl.lumc.sasc.biopet.pipelines.gentrap.measures -import nl.lumc.sasc.biopet.extensions.Cufflinks +import nl.lumc.sasc.biopet.extensions.{ Ln, Cufflinks } import nl.lumc.sasc.biopet.extensions.tools.MergeTables import org.broadinstitute.gatk.queue.QScript @@ -23,8 +23,22 @@ trait CufflinksMeasurement extends QScript with Measurement { id -> cufflinks } - addMergeTableJob(jobs.values.map(_.outputGenesFpkm).toList, mergeGenesFpkmTable, "genes_fpkm") - addMergeTableJob(jobs.values.map(_.outputIsoformsFpkm).toList, mergeIsoFormFpkmTable, "iso_form") + val genesFpkmFiles = jobs.toList.map { + case (id, job) => + val file = new File(job.output_dir, s"$id.genes_fpkm.counts") + add(Ln(this, job.outputGenesFpkm, file)) + file + } + + val isoFormFpkmFiles = jobs.toList.map { + case (id, job) => + val file = new File(job.output_dir, s"$id.iso_form_fpkn.counts") + add(Ln(this, job.outputIsoformsFpkm, file)) + file + } + + addMergeTableJob(genesFpkmFiles, mergeGenesFpkmTable, "genes_fpkm", ".genes_fpkm.counts") + addMergeTableJob(isoFormFpkmFiles, mergeIsoFormFpkmTable, "iso_form_fpkn", ".iso_form_fpkn.counts") addHeatmapJob(mergeGenesFpkmTable, genesFpkmHeatmap, "genes_fpkm") addHeatmapJob(mergeIsoFormFpkmTable, isoFormFpkmHeatmap, "iso_form_fpkm") diff --git a/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/measures/FragmentsPerGene.scala b/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/measures/FragmentsPerGene.scala index a383874f16a2699922dd9fccb48b7a4ac274b331..9ed01b496e537a779b4cd494e6424818ce063f7a 100644 --- a/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/measures/FragmentsPerGene.scala +++ b/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/measures/FragmentsPerGene.scala @@ -20,7 +20,7 @@ class FragmentsPerGene(val root: Configurable) extends QScript with Measurement val job = new HtseqCount(this) job.inputAnnotation = annotationGtf job.inputAlignment = file - job.output = new File(outputDir, s"$name.$id.counts") + job.output = new File(outputDir, s"$id.$name.counts") job.format = Option("bam") add(job) // We are forcing the sort order to be ID-sorted, since HTSeq-count often chokes when using position-sorting due @@ -30,7 +30,7 @@ class FragmentsPerGene(val root: Configurable) extends QScript with Measurement id -> job } - addMergeTableJob(jobs.values.map(_.output).toList, mergedTable, "fragments_per_gene") + addMergeTableJob(jobs.values.map(_.output).toList, mergedTable, "fragments_per_gene", s".$name.counts") addHeatmapJob(mergedTable, heatmap, "fragments_per_gene") } diff --git a/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/measures/Measurement.scala b/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/measures/Measurement.scala index 095a01fdbb5ddf2024198dc01f11bd79b89c53de..768fa98b1715828944156102ae5e3fcd72180058 100644 --- a/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/measures/Measurement.scala +++ b/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/measures/Measurement.scala @@ -41,6 +41,7 @@ trait Measurement extends SummaryQScript with Reference { qscript: QScript => def addMergeTableJob(countFiles: List[File], outputFile: File, name: String, + fileExtension: String, args: MergeArgs = mergeArgs): Unit = { add(MergeTables(this, countFiles, outputFile, args.idCols, args.valCol, args.numHeaderLines, args.fallback))