Commit 4024e04f authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Optimize imports

parent 43955a2f
......@@ -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 =>
......
......@@ -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
......
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))
......
......@@ -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))
......
Markdown is supported
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