Commit 684a0963 authored by Peter van 't Hof's avatar Peter van 't Hof Committed by GitHub

Merge pull request #89 from biopet/fix-BIOPET-662

fixes for sv calling
parents b79725a1 850675bc
......@@ -36,7 +36,8 @@ class VcfStatsForSv(val parent: Configurable) extends ToolCommandFunction with S
@Output(required = true)
var outputFile: File = _
override def defaultCoreMemory = 1.0
override def defaultResidentFactor = 2.0
override def defaultVmemFactor = 3.0
override def cmdLine = super.cmdLine +
required("-i", inputFile) +
......
......@@ -38,8 +38,7 @@ object VcfStatsForSv extends ToolCommand {
val stats: Map[String, Any] = getVariantCounts(cmdArgs.inputFile, cmdArgs.histBinBoundaries)
ConfigUtils.mapToYamlFile(stats, cmdArgs.outputFile)
ConfigUtils.mapToJsonFile(stats, cmdArgs.outputFile)
}
/** Parses a vcf-file and counts sv-s by type and size. Sv-s are divided to different size classes, the parameter histogramBinBoundaries gives the boundaries between these classes. */
......
......@@ -168,6 +168,12 @@ object ConfigUtils extends Logging {
writer.close()
}
def mapToJsonFile(map: Map[String, Any], outputFile: File) = {
val writer = new PrintWriter(outputFile)
writer.println(anyToJson(map).toString())
writer.close()
}
/** Convert json to native scala map/values */
def jsonToMap(json: Json): Map[String, Any] = {
var output: Map[String, Any] = Map()
......
......@@ -20,9 +20,14 @@ import nl.lumc.sasc.biopet.extensions.Pysvtools
import nl.lumc.sasc.biopet.extensions.tools.VcfStatsForSv
import nl.lumc.sasc.biopet.pipelines.shiva.svcallers._
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb
import nl.lumc.sasc.biopet.utils.{ BamUtils, Logging }
import org.broadinstitute.gatk.queue.QScript
import scala.concurrent.Await
import scala.concurrent.duration.Duration
import scala.concurrent.ExecutionContext.Implicits.global
/**
* Common trait for ShivaVariantcalling
*
......@@ -43,7 +48,16 @@ class ShivaSvCalling(val parent: Configurable) extends QScript with SummaryQScri
/** Executed before script */
def init(): Unit = {
if (inputBamsArg.nonEmpty) inputBams = BamUtils.sampleBamMap(inputBamsArg)
if (inputBamsArg.nonEmpty) {
inputBams = BamUtils.sampleBamMap(inputBamsArg)
val db = SummaryDb.openSqliteSummary(summaryDbFile)
for (sampleName <- inputBams.keys) {
if (Await.result(db.getSampleId(summaryRunId, sampleName), Duration.Inf).isEmpty) {
db.createSample(sampleName, summaryRunId)
}
}
}
outputMergedVCF = new File(outputDir, "allsamples.merged.vcf")
}
......
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