diff --git a/Snakefile b/Snakefile index d047ab959973b24d19f07e08c8e240c980ac16d8..c616a137b6ad51e3f0d6d53535a8781d659262cb 100644 --- a/Snakefile +++ b/Snakefile @@ -178,10 +178,14 @@ rule convert_strandphaser_input: "utils/helper.convert_strandphaser_input.R" -# Dummy rule - this will be replaced by strand-phaser +### Dummy rule - this will be replaced by strand-phaser rule run_strandphaser: + input: + "phased_haps.txt" output: "strand_states/" + config["sample"] + ".strandphaser_output.txt" + shell: + "cp {input} {output}" rule convert_strandphaser_output: input: diff --git a/utils/helper.convert_strandphaser_output.R b/utils/helper.convert_strandphaser_output.R index 3b3b22c72cc94d7d82826ec9b78b5da95388f116..4f81517fbd8fca13e4839c5559c079f23e2077c7 100755 --- a/utils/helper.convert_strandphaser_output.R +++ b/utils/helper.convert_strandphaser_output.R @@ -1,8 +1,8 @@ library(data.table); library(assertthat) -d = fread(snakemake@input[["phased_states"]]) -e = fread(snakemake@input[["info"]]) -g = fread(snakemake@intput[["initial_states"]]) +e = fread(snakemake@input[["phased_states"]]) +d = fread(snakemake@input[["info"]]) +g = fread(snakemake@input[["initial_states"]]) d$bam = basename(d$bam); @@ -14,10 +14,11 @@ f = merge(d, e, by = "bam")[, .(chrom,start,end,sample,cell,class)] # Note that there is still a bug in Venla's strand state detection. g = merge(g,f, by = c("chrom","start","end","sample","cell"), all.x = T) + # Overwrite with David's phased strand state if available! g = g[, class := ifelse(!is.na(class.y), class.y, class.x)][] g$class.x = NULL g$class.y = NULL g = g[, .(chrom, start, end, sample, cell, class)] -write.table(g, file=snakemake@output[[1]], quote=F, row.names=F, col.names=F, sep="\t") \ No newline at end of file +write.table(g, file=snakemake@output[[1]], quote=F, row.names=F, col.names=T, sep="\t") \ No newline at end of file