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

Style fixes

parent dd49ef79
No related branches found
No related tags found
No related merge requests found
...@@ -18,7 +18,7 @@ package nl.lumc.sasc.biopet.extensions.gatk ...@@ -18,7 +18,7 @@ package nl.lumc.sasc.biopet.extensions.gatk
import java.io.File import java.io.File
import nl.lumc.sasc.biopet.utils.config.Configurable import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{Input, Output} import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
/** /**
* Extension for CombineVariants from GATK * Extension for CombineVariants from GATK
......
...@@ -17,10 +17,10 @@ package nl.lumc.sasc.biopet.extensions.tools ...@@ -17,10 +17,10 @@ package nl.lumc.sasc.biopet.extensions.tools
import java.io.File import java.io.File
import nl.lumc.sasc.biopet.core.{Reference, ToolCommandFunction} import nl.lumc.sasc.biopet.core.{ Reference, ToolCommandFunction }
import nl.lumc.sasc.biopet.utils.Logging import nl.lumc.sasc.biopet.utils.Logging
import nl.lumc.sasc.biopet.utils.config.Configurable import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{Output, Input} import org.broadinstitute.gatk.utils.commandline.{ Output, Input }
/** /**
* *
......
...@@ -14,8 +14,8 @@ import scala.collection.JavaConversions._ ...@@ -14,8 +14,8 @@ import scala.collection.JavaConversions._
import scala.io.Source import scala.io.Source
/** /**
* Created by pjvanthof on 15/03/16. * Created by pjvanthof on 15/03/16.
*/ */
object GensToVcf extends ToolCommand { object GensToVcf extends ToolCommand {
case class Args(inputGenotypes: File = null, case class Args(inputGenotypes: File = null,
...@@ -79,23 +79,24 @@ object GensToVcf extends ToolCommand { ...@@ -79,23 +79,24 @@ object GensToVcf extends ToolCommand {
val alt = Allele.create(genotypeValues(4)) val alt = Allele.create(genotypeValues(4))
val start = genotypeValues(2).toInt val start = genotypeValues(2).toInt
val end = ref.length - 1 + start val end = ref.length - 1 + start
val genotypes = samples.toList.zipWithIndex.map { case (sampleName, index) => val genotypes = samples.toList.zipWithIndex.map {
val gps = Array( case (sampleName, index) =>
genotypeValues(5 + (index * 3)), val gps = Array(
genotypeValues(5 + (index * 3) + 1), genotypeValues(5 + (index * 3)),
genotypeValues(5 + (index * 3) + 2) genotypeValues(5 + (index * 3) + 1),
).map(_.toDouble) genotypeValues(5 + (index * 3) + 2)
val alleles = gps.indexOf(gps.max) match { ).map(_.toDouble)
case 0 => List(ref, ref) val alleles = gps.indexOf(gps.max) match {
case 1 => List(ref, alt) case 0 => List(ref, ref)
case 2 => List(alt, alt) case 1 => List(ref, alt)
} case 2 => List(alt, alt)
new GenotypeBuilder() }
.name(sampleName) new GenotypeBuilder()
.alleles(alleles) .name(sampleName)
.attribute("GP", gps) .alleles(alleles)
.PL(gps) .attribute("GP", gps)
.make() .PL(gps)
.make()
} }
val builder = (new VariantContextBuilder) val builder = (new VariantContextBuilder)
......
...@@ -2,16 +2,16 @@ package nl.lumc.sasc.biopet.pipelines.gwastest ...@@ -2,16 +2,16 @@ package nl.lumc.sasc.biopet.pipelines.gwastest
import java.io.File import java.io.File
import nl.lumc.sasc.biopet.core.{PipelineCommand, Reference, BiopetQScript} import nl.lumc.sasc.biopet.core.{ PipelineCommand, Reference, BiopetQScript }
import nl.lumc.sasc.biopet.extensions.gatk.{SelectVariants, CombineVariants} import nl.lumc.sasc.biopet.extensions.gatk.{ SelectVariants, CombineVariants }
import nl.lumc.sasc.biopet.extensions.tools.GensToVcf import nl.lumc.sasc.biopet.extensions.tools.GensToVcf
import nl.lumc.sasc.biopet.utils.config.Configurable import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.utils.intervals.BedRecordList import nl.lumc.sasc.biopet.utils.intervals.BedRecordList
import org.broadinstitute.gatk.queue.QScript import org.broadinstitute.gatk.queue.QScript
/** /**
* Created by pjvanthof on 16/03/16. * Created by pjvanthof on 16/03/16.
*/ */
class GwasTest(val root: Configurable) extends QScript with BiopetQScript with Reference { class GwasTest(val root: Configurable) extends QScript with BiopetQScript with Reference {
def this() = this(null) def this() = this(null)
...@@ -24,10 +24,11 @@ class GwasTest(val root: Configurable) extends QScript with BiopetQScript with R ...@@ -24,10 +24,11 @@ class GwasTest(val root: Configurable) extends QScript with BiopetQScript with R
else { else {
if (config.contains("input_gens")) { if (config.contains("input_gens")) {
val gens: List[Any] = configValue2list(config("input_gens")) val gens: List[Any] = configValue2list(config("input_gens"))
Some(gens.map{ case value: Map[String, Any] => Some(gens.map {
GensInput(new File(value("genotypes").toString), case value: Map[String, Any] =>
value.get("info").map(x => new File(x.toString)), GensInput(new File(value("genotypes").toString),
value("contig").toString) value.get("info").map(x => new File(x.toString)),
value("contig").toString)
}) })
} else None } else None
} }
...@@ -60,24 +61,24 @@ class GwasTest(val root: Configurable) extends QScript with BiopetQScript with R ...@@ -60,24 +61,24 @@ class GwasTest(val root: Configurable) extends QScript with BiopetQScript with R
} }
val snpTests = BedRecordList.fromReference(referenceFasta()) val snpTests = BedRecordList.fromReference(referenceFasta())
.scatter(config("bin_size", default = 10^6)) .scatter(config("bin_size", default = 10 ^ 6))
.allRecords.map { region => .allRecords.map { region =>
val regionDir = new File(outputDir, "snptest" + File.separator + region.chr) val regionDir = new File(outputDir, "snptest" + File.separator + region.chr)
regionDir.mkdirs() regionDir.mkdirs()
val bedFile = new File(regionDir, s"${region.chr}-${region.start + 1}-${region.end}.bed") val bedFile = new File(regionDir, s"${region.chr}-${region.start + 1}-${region.end}.bed")
BedRecordList.fromList(List(region)).writeToFile(bedFile) BedRecordList.fromList(List(region)).writeToFile(bedFile)
bedFile.deleteOnExit() bedFile.deleteOnExit()
val sv = new SelectVariants(this) val sv = new SelectVariants(this)
sv.inputFiles :+= vcfFile sv.inputFiles :+= vcfFile
sv.outputFile = new File(regionDir, s"${region.chr}-${region.start + 1}-${region.end}.vcf.gz") sv.outputFile = new File(regionDir, s"${region.chr}-${region.start + 1}-${region.end}.vcf.gz")
sv.intervals :+= bedFile sv.intervals :+= bedFile
sv.isIntermediate = true sv.isIntermediate = true
add(sv) add(sv)
//TODO: snptest //TODO: snptest
(region -> "") (region -> "")
} }
} }
} }
......
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