Skip to content

Commit

Permalink
rm BL-utils and move script_dir_ch definition
Browse files Browse the repository at this point in the history
  • Loading branch information
sorelfitzgibbon committed Aug 2, 2023
1 parent d003dd7 commit 33a5915
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion config/F2.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Other processes after create_IndelCandidate_SAMtools will only run one at a time, so
// Other processes will only run one at a time, so
// we don't need to control their resources.
// The configuration below forces processes to run one at a time by needing
// the total memory available on a lowmem node.
Expand Down
18 changes: 9 additions & 9 deletions docker/plot-venn/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
ARG MINIFORGE_VERSION=22.9.0-2
ARG UBUNTU_VERSION=20.04
FROM ubuntu:${UBUNTU_VERSION}

ARG DEBIAN_FRONTEND=noninteractive
FROM condaforge/mambaforge:${MINIFORGE_VERSION} AS builder

RUN apt-get update && \
apt-get install -y --no-install-recommends libxml2 libxml2-dev libcurl4-gnutls-dev build-essential r-base r-base-dev \
libfontconfig1-dev libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev r-cran-rgl \
git libssl-dev r-cran-curl && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN mamba create -qy -p /usr/local \
'r-base>=4.2.1' \
r-argparse \
r-VennDiagram

RUN R -q -e 'install.packages(c("devtools", "argparse", "VennDiagram"))'
RUN R -q -e 'devtools::install_github("uclahs-cds/public-R-BoutrosLab-utilities")'
# Copy from builder into final image
FROM ubuntu:${UBUNTU_VERSION} AS final
COPY --from=builder /usr/local /usr/local

# Add a new user/group called bldocker
RUN groupadd -g 500001 bldocker \
Expand Down
16 changes: 13 additions & 3 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ include { muse } from './module/muse' addParams(

include { intersect } from './module/intersect' addParams(
workflow_output_dir: "${params.output_dir_base}/intersect-BCFtools-${params.BCFtools_version}",
workflow_log_output_dir: "${params.log_output_dir}/process-log/intersect-BCFtools-${params.BCFtools_version}"
)
workflow_log_output_dir: "${params.log_output_dir}/process-log/intersect-BCFtools-${params.BCFtools_version}",
output_filename: generate_standard_filename("Consensus",
params.dataset_id,
params.sample_id,
[:]))

// Returns the index file for the given bam or vcf
def indexFile(bam_or_vcf) {
Expand Down Expand Up @@ -117,12 +120,18 @@ Channel
}
.set { normal_input }

script_dir_ch = Channel.fromPath(
"$projectDir/r-scripts",
checkIfExists: true
)

workflow {
reference_ch = Channel.from(
params.reference,
params.reference_index,
params.reference_dict
)

// Input file validation
if (params.tumor_only_mode) {
file_to_validate = reference_ch
Expand Down Expand Up @@ -227,7 +236,8 @@ workflow {

intersect(
tool_vcfs,
tool_indices
tool_indices,
script_dir_ch
)
}
}
4 changes: 2 additions & 2 deletions module/intersect-processes.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ log.info """\
====================================
Docker Images:
- docker_image_BCFtools: ${params.docker_image_BCFtools}
- docker_image_r_scripts: ${params.docker_image_r_VennDiagram}
- docker_image_r_VennDiagram: ${params.docker_image_r_VennDiagram}
====================================
"""
process intersect_VCFs_BCFtools {
Expand Down Expand Up @@ -71,6 +71,6 @@ process intersect_VCFs_BCFtools {
script:
"""
set -euo pipefail
Rscript ${script_dir}/plot-venn.R --isec_dir ${isec_dir} --dataset ${params.dataset_id}
Rscript ${script_dir}/plot-venn.R --isec_dir ${isec_dir} --outfile ${params.output_filename}_Venn-diagram.tiff
"""
}
4 changes: 1 addition & 3 deletions module/intersect.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ include { generate_sha512sum } from './common'
include { intersect_VCFs_BCFtools; plot_VennDiagram_R } from './intersect-processes.nf'

workflow intersect {
// pass bin directory in project folder as channel into docker
script_dir_ch = Channel.fromPath("$projectDir/r-scripts", checkIfExists: true)

take:
tool_vcfs
tool_indices
script_dir_ch

main:
intersect_VCFs_BCFtools(
Expand Down
5 changes: 2 additions & 3 deletions r-scripts/plot-venn.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@

## Setup the environment ###########################################################################
library('argparse');
library('BoutrosLab.utilities');
library('VennDiagram');

## Parse the arguments #############################################################################
parser <- ArgumentParser();
parser$add_argument('-i', '--isec_dir', help = 'The directory containing the output from BCFtools intersect', type = 'character');
parser$add_argument('-d', '--dataset', help = 'The dataset ID passed from nextflow', type = 'character');
parser$add_argument('-o', '--outfile', help = 'Output filename', type = 'character');
args <- parser$parse_args();

## Function: plot venn diagram #####################################################################
Expand Down Expand Up @@ -48,4 +47,4 @@ 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, generate.filename(args$dataset, 'Venn-diagram', 'tiff'));
plot.venn(tool.variants.ordered, args$outfile);

0 comments on commit 33a5915

Please sign in to comment.