Commit 55ca079a authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added allele overlap heatmap

parent ca4fb8bd
......@@ -15,11 +15,11 @@ heat<- heat[,-1]
heat<- as.matrix(heat)
png(file = outputArg, width = 1500, height = 1500)
heatmap.2(heat, trace = 'none', col = col, Colv=NA, Rowv=NA, dendrogram="none", margins = c(10, 10), na.color="#00FF00")
png(file = outputArg, width = 1200, height = 1200)
heatmap.2(heat, trace = 'none', col = col, Colv=NA, Rowv=NA, dendrogram="none", margins = c(12, 12), na.color="#00FF00")
dev.off()
png(file = outputArgClustering, width = 1500, height = 1500)
heatmap.2(heat, trace = 'none', col = col, Colv="Rowv", dendrogram="row",margins = c(10, 10), na.color="#00FF00")
png(file = outputArgClustering, width = 1200, height = 1200)
heatmap.2(heat, trace = 'none', col = col, Colv="Rowv", dendrogram="row",margins = c(12, 12), na.color="#00FF00")
dev.off()
......@@ -129,8 +129,7 @@ trait MultiSampleQScript extends BiopetQScript {
ConfigUtils.any2map(Config.global.map("samples")).keySet
}
/**
* Runs addAndTrackJobs method for each sample */
/** Runs addAndTrackJobs method for each sample */
final def addSamplesJobs() {
for ((sampleId, sample) <- samples) {
sample.addAndTrackJobs()
......
......@@ -32,7 +32,7 @@ object VcfStats extends ToolCommand {
}
val genotypeOverlap: mutable.Map[String, mutable.Map[String, Int]] = mutable.Map()
val variantOverlap: mutable.Map[String, mutable.Map[String, Int]] = mutable.Map()
val allelesOverlap: mutable.Map[String, mutable.Map[String, Int]] = mutable.Map()
val qualStats: mutable.Map[Any, Int] = mutable.Map()
val genotypeStats: mutable.Map[String, mutable.Map[String, mutable.Map[Any, Int]]] = mutable.Map()
......@@ -53,11 +53,11 @@ object VcfStats extends ToolCommand {
// Init
for (sample1 <- samples) {
genotypeOverlap(sample1) = mutable.Map()
variantOverlap(sample1) = mutable.Map()
allelesOverlap(sample1) = mutable.Map()
genotypeStats(sample1) = mutable.Map()
for (sample2 <- samples) {
genotypeOverlap(sample1)(sample2) = 0
variantOverlap(sample1)(sample2) = 0
allelesOverlap(sample1)(sample2) = 0
}
}
......@@ -69,11 +69,12 @@ object VcfStats extends ToolCommand {
val genotype = record.getGenotype(sample1)
checkGenotype(genotype)
for (sample2 <- samples) {
if (genotype.getAlleles == record.getGenotype(sample2).getAlleles) {
val genotype2 = record.getGenotype(sample2)
if (genotype.getAlleles == genotype2.getAlleles)
genotypeOverlap(sample1)(sample2) = genotypeOverlap(sample1)(sample2) + 1
if (!(genotype.isHomRef || genotype.isNoCall || genotype.isNonInformative))
variantOverlap(sample1)(sample2) = variantOverlap(sample1)(sample2) + 1
}
for (allele <- genotype.getAlleles)
if (genotype2.getAlleles.exists(_.basesMatch(allele)))
allelesOverlap(sample1)(sample2) = allelesOverlap(sample1)(sample2) + 1
}
}
}
......@@ -82,7 +83,7 @@ object VcfStats extends ToolCommand {
plotXy(writeField("QUAL", qualStats.toMap))
writeGenotypeFields(commandArgs.outputDir + "/genotype_", samples)
writeOverlap(genotypeOverlap, commandArgs.outputDir + "/sample_compare/genotype_overlap", samples)
writeOverlap(variantOverlap, commandArgs.outputDir + "/sample_compare/variant_overlap", samples)
writeOverlap(allelesOverlap, commandArgs.outputDir + "/sample_compare/allele_overlap", samples)
logger.info("Done")
}
......
Supports Markdown
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