diff --git a/module/intersect-processes.nf b/module/intersect-processes.nf index 12e64fb5..105b6a09 100644 --- a/module/intersect-processes.nf +++ b/module/intersect-processes.nf @@ -12,14 +12,14 @@ process intersect_VCFs_BCFtools { publishDir path: "${params.workflow_output_dir}/output", mode: "copy", pattern: "*.vcf.gz*" - publishDir path: "${params.workflow_output_dir}/output", + publishDir path: "${params.workflow_output_dir}/output/isec-2-or-more", mode: "copy", pattern: "isec-2-or-more/*.txt", - saveAs: { "${params.output_filename}${file(it).getName()}" } - publishDir path: "${params.workflow_output_dir}/output", + saveAs: { "${params.output_filename}_${file(it).getName()}" } + publishDir path: "${params.workflow_output_dir}/output/isec-1-or-more", mode: "copy", pattern: "isec-1-or-more/*.txt", - saveAs: { "${params.output_filename}${file(it).getName()}" } + saveAs: { "${params.output_filename}_${file(it).getName()}" } publishDir path: "${params.workflow_log_output_dir}", mode: "copy", pattern: ".command.*", @@ -35,7 +35,7 @@ process intersect_VCFs_BCFtools { path "*.vcf.gz", emit: consensus_vcf path "*.vcf.gz.tbi", emit: consensus_idx path ".command.*" - path "isec-2-or-more" + path "isec-2-or-more/*.txt" path "isec-1-or-more/*.txt", emit: isec script: diff --git a/r-scripts/plot-venn.R b/r-scripts/plot-venn.R index 0cf6db69..8410907f 100644 --- a/r-scripts/plot-venn.R +++ b/r-scripts/plot-venn.R @@ -37,6 +37,7 @@ algorithms <- readLines(args$isec_readme); algorithms <- algorithms[grep('^isec-1-or-more', algorithms)]; algorithms <- gsub('isec-1-or-more.*\t', '', algorithms); algorithms <- gsub('-.*', '', algorithms); + sites <- read.table(args$isec_sites, header = FALSE, colClasses = 'character'); split.col <- strsplit(as.character(sites$V5), ''); sites$col1 <- sapply(split.col, '[', 1); @@ -44,9 +45,12 @@ sites$col2 <- sapply(split.col, '[', 2); sites$col3 <- sapply(split.col, '[', 3); sites$col4 <- sapply(split.col, '[', 4); sites$V5 <- NULL; + header <- c('chrom', 'pos', 'ref', 'alt', algorithms); colnames(sites) <- header + variants <- paste(sites$chrom, sites$pos, sep = '_'); tool.variants <- lapply(sites[, algorithms], function(x) variants[x == 1]); tool.variants.ordered <- tool.variants[order(lengths(tool.variants), decreasing = TRUE)]; + plot.venn(tool.variants.ordered, args$outfile);