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