diff --git a/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQScript.scala b/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQScript.scala index c95299b0d4c47ef189a22fce2fcd1dfaff9183f8..56c4796002986026ca6bd6f84a43766085f297de 100644 --- a/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQScript.scala +++ b/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQScript.scala @@ -23,9 +23,7 @@ import nl.lumc.sasc.biopet.core.report.ReportBuilderExtension import nl.lumc.sasc.biopet.utils.Logging import org.broadinstitute.gatk.queue.{ QScript, QSettings } import org.broadinstitute.gatk.queue.function.QFunction -import org.broadinstitute.gatk.queue.function.scattergather.ScatterGatherableFunction import org.broadinstitute.gatk.queue.util.{ Logging => GatkLogging } -import org.broadinstitute.gatk.utils.commandline.Argument /** Base for biopet pipeline */ trait BiopetQScript extends Configurable with GatkLogging { qscript: QScript => diff --git a/public/biopet-tools-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/tools/BaseCounter.scala b/public/biopet-tools-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/tools/BaseCounter.scala index 03b229a9c24899c0f55bad0b72897ad5abd93c36..05a3025efb2372ec057a1d07456064b8c9aef6f7 100644 --- a/public/biopet-tools-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/tools/BaseCounter.scala +++ b/public/biopet-tools-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/tools/BaseCounter.scala @@ -15,14 +15,14 @@ */ package nl.lumc.sasc.biopet.extensions.tools -import java.io.{PrintWriter, File} +import java.io.{ PrintWriter, File } import nl.lumc.sasc.biopet.core.ToolCommandFunction import nl.lumc.sasc.biopet.utils.config.Configurable -import org.broadinstitute.gatk.utils.commandline.{Input, Output} +import org.broadinstitute.gatk.utils.commandline.{ Input, Output } /** - * + * */ class BaseCounter(val root: Configurable) extends ToolCommandFunction { def toolObject = nl.lumc.sasc.biopet.tools.BaseCounter 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 7cf07938a1b2882cf229249c961ddbbcb67c82c3..69f8b652c272dd386bbb5a7ca30d5bc98d1843af 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 @@ -1,17 +1,17 @@ package nl.lumc.sasc.biopet.tools -import java.io.{PrintWriter, File} +import java.io.{ PrintWriter, File } -import htsjdk.samtools.{SAMRecord, SamReaderFactory} +import htsjdk.samtools.{ SAMRecord, SamReaderFactory } import nl.lumc.sasc.biopet.utils.ToolCommand -import nl.lumc.sasc.biopet.utils.intervals.{BedRecordList, BedRecord} -import picard.annotation.{Gene, GeneAnnotationReader} +import nl.lumc.sasc.biopet.utils.intervals.{ BedRecordList, BedRecord } +import picard.annotation.{ Gene, GeneAnnotationReader } import scala.collection.JavaConversions._ /** - * Created by pjvanthof on 22/01/16. - */ + * Created by pjvanthof on 22/01/16. + */ object BaseCounter extends ToolCommand { case class Args(refFlat: File = null, @@ -20,13 +20,13 @@ object BaseCounter extends ToolCommand { prefix: String = "output") extends AbstractArgs class OptParser extends AbstractOptParser { - opt[File]('r', "refFlat") required() valueName "<file>" action { (x, c) => + opt[File]('r', "refFlat") required () valueName "<file>" action { (x, c) => c.copy(refFlat = x) } - opt[File]('o', "outputDir") required() valueName "<directory>" action { (x, c) => + opt[File]('o', "outputDir") required () valueName "<directory>" action { (x, c) => c.copy(outputDir = x) } - opt[File]('b', "bam") required() valueName "<file>" action { (x, c) => + opt[File]('b', "bam") required () valueName "<file>" action { (x, c) => c.copy(bamFile = x) } opt[String]('p', "prefix") valueName "<prefix>" action { (x, c) => @@ -38,7 +38,7 @@ object BaseCounter extends ToolCommand { val argsParser = new OptParser val cmdArgs: Args = argsParser.parse(args, Args()) match { case Some(x) => x - case _ => throw new IllegalArgumentException + case _ => throw new IllegalArgumentException } //Sets picard logging level @@ -63,11 +63,11 @@ object BaseCounter extends ToolCommand { } /** - * This function will write all counts that are concatenated on transcript level. Each line is 1 transcript. - * Exonic: then it's seen as an exon on 1 of the transcripts - * Intronic: then it's not seen as an exon on 1 of the transcripts - * Exonic + Intronic = Total - */ + * This function will write all counts that are concatenated on transcript level. Each line is 1 transcript. + * Exonic: then it's seen as an exon on 1 of the transcripts + * Intronic: then it's not seen as an exon on 1 of the transcripts + * Exonic + Intronic = Total + */ def writeTranscriptCounts(genes: List[GeneCount], outputDir: File, prefix: String): Unit = { val transcriptTotalWriter = new PrintWriter(new File(outputDir, s"$prefix.base.transcript.counts")) val transcriptTotalSenseWriter = new PrintWriter(new File(outputDir, s"$prefix.base.transcript.sense.counts")) @@ -141,11 +141,11 @@ object BaseCounter extends ToolCommand { } /** - * This function will write all counts that are concatenated on gene level. Each line is 1 gene. - * Exonic: then it's seen as an exon on 1 of the transcripts - * Intronic: then it's not seen as an exon on 1 of the transcripts - * Exonic + Intronic = Total - */ + * This function will write all counts that are concatenated on gene level. Each line is 1 gene. + * Exonic: then it's seen as an exon on 1 of the transcripts + * Intronic: then it's not seen as an exon on 1 of the transcripts + * Exonic + Intronic = Total + */ def writeGeneCounts(genes: List[GeneCount], outputDir: File, prefix: String): Unit = { val geneTotalWriter = new PrintWriter(new File(outputDir, s"$prefix.base.gene.counts")) val geneTotalSenseWriter = new PrintWriter(new File(outputDir, s"$prefix.base.gene.sense.counts")) @@ -181,9 +181,9 @@ object BaseCounter extends ToolCommand { } /** - * This function will print all counts that exist on exonic regions, - * each base withing the gene is only represented once but all regions are separated - */ + * This function will print all counts that exist on exonic regions, + * each base withing the gene is only represented once but all regions are separated + */ def writeMergeExonCount(genes: List[GeneCount], outputDir: File, prefix: String): Unit = { val exonWriter = new PrintWriter(new File(outputDir, s"$prefix.base.exon.merge.counts")) val exonSenseWriter = new PrintWriter(new File(outputDir, s"$prefix.base.exon.merge.sense.counts")) @@ -203,9 +203,9 @@ object BaseCounter extends ToolCommand { } /** - * This function will print all counts that does *not* exist on exonic regions, - * each base withing the gene is only represented once but all regions are separated - */ + * This function will print all counts that does *not* exist on exonic regions, + * each base withing the gene is only represented once but all regions are separated + */ def writeMergeIntronCount(genes: List[GeneCount], outputDir: File, prefix: String): Unit = { val intronWriter = new PrintWriter(new File(outputDir, s"$prefix.base.intron.merge.counts")) val intronSenseWriter = new PrintWriter(new File(outputDir, s"$prefix.base.intron.merge.sense.counts")) @@ -285,7 +285,7 @@ object BaseCounter extends ToolCommand { .map(e => BedRecord(gene.getContig, e.start - 1, e.end))) .combineOverlap def intronRegions = BedRecordList.fromList(BedRecord(gene.getContig, gene.getStart - 1, gene.getEnd) :: exonRegions.allRecords.toList) - .squishBed(false, false) + .squishBed(false, false) val exonCounts = exonRegions.allRecords.map(e => new RegionCount(e.start + 1, e.end)) val intronCounts = intronRegions.allRecords.map(e => new RegionCount(e.start + 1, e.end)) diff --git a/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/Gentrap.scala b/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/Gentrap.scala index cf42e8dfe9e51105f3c4950819b3528d2097a13b..8bf19381ed25f995fe73bc507f5029830a3b1cb0 100644 --- a/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/Gentrap.scala +++ b/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/Gentrap.scala @@ -16,10 +16,10 @@ package nl.lumc.sasc.biopet.pipelines.gentrap import nl.lumc.sasc.biopet.core._ -import nl.lumc.sasc.biopet.core.annotations.{RibosomalRefFlat, AnnotationRefFlat} +import nl.lumc.sasc.biopet.core.annotations.{ RibosomalRefFlat, AnnotationRefFlat } import nl.lumc.sasc.biopet.core.report.ReportBuilderExtension import nl.lumc.sasc.biopet.extensions.tools.WipeReads -import nl.lumc.sasc.biopet.pipelines.gentrap.Gentrap.{StrandProtocol, ExpMeasures} +import nl.lumc.sasc.biopet.pipelines.gentrap.Gentrap.{ StrandProtocol, ExpMeasures } import nl.lumc.sasc.biopet.pipelines.gentrap.measures._ import nl.lumc.sasc.biopet.pipelines.mapping.MultisampleMappingTrait import nl.lumc.sasc.biopet.pipelines.shiva.ShivaVariantcalling @@ -56,7 +56,7 @@ class Gentrap(val root: Configurable) extends QScript lazy val expMeasures = config("expression_measures", default = Nil).asStringList.map(value => ExpMeasures.values.find(x => Gentrap.camelize(x.toString) == value) match { case Some(v) => v - case _ => throw new IllegalArgumentException(s"'$value' is not a valid Expression measurement") + case _ => throw new IllegalArgumentException(s"'$value' is not a valid Expression measurement") } ).toSet @@ -65,7 +65,7 @@ class Gentrap(val root: Configurable) extends QScript val value: String = config("strand_protocol") StrandProtocol.values.find(x => Gentrap.camelize(x.toString) == value) match { case Some(v) => v - case other => + case other => Logging.addError(s"'$other' is no strand_protocol or strand_protocol is not given") StrandProtocol.NonSpecific } @@ -79,12 +79,12 @@ class Gentrap(val root: Configurable) extends QScript "htseqcount" -> Map("stranded" -> (strandProtocol match { case StrandProtocol.NonSpecific => "no" case StrandProtocol.Dutp => "reverse" - case otherwise => throw new IllegalStateException(otherwise.toString) + case otherwise => throw new IllegalStateException(otherwise.toString) })), "cufflinks" -> Map("library_type" -> (strandProtocol match { case StrandProtocol.NonSpecific => "fr-unstranded" case StrandProtocol.Dutp => "fr-firststrand" - case otherwise => throw new IllegalStateException(otherwise.toString) + case otherwise => throw new IllegalStateException(otherwise.toString) })), "merge_strategy" -> "preprocessmergesam", "gsnap" -> Map( @@ -99,7 +99,7 @@ class Gentrap(val root: Configurable) extends QScript "strand_specificity" -> (strandProtocol match { case StrandProtocol.NonSpecific => StrandSpecificity.NONE.toString case StrandProtocol.Dutp => StrandSpecificity.SECOND_READ_TRANSCRIPTION_STRAND.toString - case otherwise => throw new IllegalStateException(otherwise.toString) + case otherwise => throw new IllegalStateException(otherwise.toString) }) ) else Map()) ++ (if (ribosomalRefFlat != null) ribosomalRefFlat.map("ribosomal_intervals" -> _.getAbsolutePath).toList else Nil))