Skip to content
Snippets Groups Projects
Commit a43106b2 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Fixed config conversions

parent 413bbf93
No related branches found
No related tags found
No related merge requests found
...@@ -54,16 +54,16 @@ class Gentrap(val root: Configurable) extends QScript ...@@ -54,16 +54,16 @@ class Gentrap(val root: Configurable) extends QScript
/** Expression measurement modes */ /** Expression measurement modes */
// see the enumeration below for valid modes // see the enumeration below for valid modes
lazy val expMeasures = config("expression_measures", default = Nil).asStringList.map(value => lazy val expMeasures = config("expression_measures", default = Nil).asStringList.map(value =>
ExpMeasures.values.find(x => Gentrap.camelize(x.toString) == value) match { ExpMeasures.values.find(_.toString == Gentrap.camelize(value)) match {
case Some(v) => v 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 ).toSet
/** Strandedness modes */ /** Strandedness modes */
lazy val strandProtocol: StrandProtocol.Value = { val strandProtocol: StrandProtocol.Value = {
val value: String = config("strand_protocol") val value: String = config("strand_protocol")
StrandProtocol.values.find(x => Gentrap.camelize(x.toString) == value) match { StrandProtocol.values.find(_.toString == Gentrap.camelize(value)) match {
case Some(v) => v case Some(v) => v
case other => case other =>
Logging.addError(s"'$other' is no strand_protocol or strand_protocol is not given") Logging.addError(s"'$other' is no strand_protocol or strand_protocol is not given")
...@@ -122,7 +122,7 @@ class Gentrap(val root: Configurable) extends QScript ...@@ -122,7 +122,7 @@ class Gentrap(val root: Configurable) extends QScript
Some(new FragmentsPerExon(this)) else None Some(new FragmentsPerExon(this)) else None
lazy val baseCounts = if (expMeasures.contains(ExpMeasures.BaseCounts)) lazy val baseCounts = if (expMeasures.contains(ExpMeasures.BaseCounts))
Some(new FragmentsPerExon(this)) else None Some(new BaseCounts(this)) else None
lazy val cufflinksBlind = if (expMeasures.contains(ExpMeasures.CufflinksBlind)) lazy val cufflinksBlind = if (expMeasures.contains(ExpMeasures.CufflinksBlind))
Some(new CufflinksBlind(this)) else None Some(new CufflinksBlind(this)) else None
......
...@@ -15,14 +15,15 @@ class BaseCounts(val root: Configurable) extends QScript with Measurement with A ...@@ -15,14 +15,15 @@ class BaseCounts(val root: Configurable) extends QScript with Measurement with A
/** Pipeline itself */ /** Pipeline itself */
def biopetScript(): Unit = { def biopetScript(): Unit = {
val jobs = bamFiles.map { case (id, file) => val jobs = bamFiles.map {
val baseCounter = new BaseCounter(this) case (id, file) =>
baseCounter.bamFile = file val baseCounter = new BaseCounter(this)
baseCounter.outputDir = new File(outputDir, id) baseCounter.bamFile = file
baseCounter.prefix = id baseCounter.outputDir = new File(outputDir, id)
baseCounter.refFlat = annotationRefFlat baseCounter.prefix = id
add(baseCounter) baseCounter.refFlat = annotationRefFlat
id -> baseCounter add(baseCounter)
id -> baseCounter
} }
def addTableAndHeatmap(countFiles: List[File], outputName: String): Unit = { def addTableAndHeatmap(countFiles: List[File], outputName: String): Unit = {
......
...@@ -16,10 +16,11 @@ trait CufflinksMeasurement extends QScript with Measurement { ...@@ -16,10 +16,11 @@ trait CufflinksMeasurement extends QScript with Measurement {
} }
def biopetScript(): Unit = { def biopetScript(): Unit = {
val jobs = bamFiles.map { case (id, file) => val jobs = bamFiles.map {
val cufflinks = makeCufflinksJob(id, file) case (id, file) =>
add(cufflinks) val cufflinks = makeCufflinksJob(id, file)
id -> cufflinks add(cufflinks)
id -> cufflinks
} }
addMergeTableJob(jobs.values.map(_.outputGenesFpkm).toList, mergeGenesFpkmTable, "genes_fpkm") addMergeTableJob(jobs.values.map(_.outputGenesFpkm).toList, mergeGenesFpkmTable, "genes_fpkm")
......
...@@ -13,19 +13,20 @@ class FragmentsPerGene(val root: Configurable) extends QScript with Measurement ...@@ -13,19 +13,20 @@ class FragmentsPerGene(val root: Configurable) extends QScript with Measurement
/** Pipeline itself */ /** Pipeline itself */
def biopetScript(): Unit = { def biopetScript(): Unit = {
val jobs = bamFiles.map { case (id, file) => val jobs = bamFiles.map {
//TODO: ID sorting job case (id, file) =>
//TODO: ID sorting job
val job = new HtseqCount(this) val job = new HtseqCount(this)
job.inputAnnotation = annotationGtf job.inputAnnotation = annotationGtf
job.inputAlignment = file job.inputAlignment = file
job.output = new File(outputDir, s"$name.$id.counts") job.output = new File(outputDir, s"$name.$id.counts")
job.format = Option("bam") job.format = Option("bam")
// We are forcing the sort order to be ID-sorted, since HTSeq-count often chokes when using position-sorting due // We are forcing the sort order to be ID-sorted, since HTSeq-count often chokes when using position-sorting due
// to its buffer not being large enough. // to its buffer not being large enough.
//TODO: ID sorting job //TODO: ID sorting job
//job.order = Option("name") //job.order = Option("name")
id -> job id -> job
} }
addMergeTableJob(jobs.values.map(_.output).toList, mergedTable, "fragments_per_gene") addMergeTableJob(jobs.values.map(_.output).toList, mergedTable, "fragments_per_gene")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment