Skip to content

Commit

Permalink
fix standardized isec output and spacing in rscript
Browse files Browse the repository at this point in the history
  • Loading branch information
sorelfitzgibbon committed Aug 8, 2023
1 parent db0133c commit 027f02c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 5 additions & 5 deletions module/intersect-processes.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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.*",
Expand All @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions r-scripts/plot-venn.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,20 @@ 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);
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);

0 comments on commit 027f02c

Please sign in to comment.