Skip to content

Commit

Permalink
refactor: switch modules to containers
Browse files Browse the repository at this point in the history
  • Loading branch information
kelly-sovacool committed Mar 29, 2024
1 parent bd349c4 commit 80ea1a3
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 88 deletions.
22 changes: 6 additions & 16 deletions workflow/rules/align.smk
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ rule star1p:
starindexdir=STAR_INDEX_DIR,
alignTranscriptsPerReadNmax=TOOLS["star"]["alignTranscriptsPerReadNmax"],
randomstr=str(uuid.uuid4()),
envmodules:
TOOLS["star"]["version"],
container: config['containers']["star"]
threads: getthreads("star1p")
shell:
"""
Expand Down Expand Up @@ -247,6 +246,7 @@ rule merge_SJ_tabs:
filter2_noncanonical=config["star_1pass_filter_viruses_noncanonical"],
filter2_unannotated=config["star_1pass_filter_viruses_unannotated"],
threads: getthreads("merge_SJ_tabs")
container: config['containers']['base']
shell:
"""
set -exo pipefail
Expand Down Expand Up @@ -305,10 +305,7 @@ rule star2p:
starindexdir=STAR_INDEX_DIR,
alignTranscriptsPerReadNmax=TOOLS["star"]["alignTranscriptsPerReadNmax"],
randomstr=str(uuid.uuid4()),
envmodules:
TOOLS["star"]["version"],
TOOLS["sambamba"]["version"],
TOOLS["samtools"]["version"],
container: config['containers']['star_ucsc_cufflinks']
threads: getthreads("star2p")
shell:
"""
Expand Down Expand Up @@ -480,10 +477,7 @@ rule star_circrnafinder:
starindexdir=STAR_INDEX_DIR,
alignTranscriptsPerReadNmax=TOOLS["star"]["alignTranscriptsPerReadNmax"],
randomstr=str(uuid.uuid4()),
envmodules:
TOOLS["star"]["version"],
TOOLS["sambamba"]["version"],
TOOLS["samtools"]["version"],
container: config['containers']['star_ucsc_cufflinks']
threads: getthreads("star_circrnafinder")
shell:
"""
Expand Down Expand Up @@ -576,9 +570,7 @@ rule find_circ_align:
peorse=get_peorse,
find_circ_dir=FIND_CIRC_DIR,
randomstr=str(uuid.uuid4()),
envmodules:
TOOLS["python27"]["version"],
TOOLS["samtools"]["version"], TOOLS['bowtie2']['version']
container: config['containers']["nclscan_py27"]
threads: getthreads("find_circ_align")
shell:
"""
Expand Down Expand Up @@ -659,9 +651,7 @@ rule estimate_duplication:
params:
sample="{sample}",
memG=getmemG("estimate_duplication"),
envmodules:
TOOLS["picard"]["version"],
TOOLS["java"]["version"],
container: config['containers']["picard"]
shell:
"""
set -exo pipefail
Expand Down
18 changes: 4 additions & 14 deletions workflow/rules/create_index.smk
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@ rule create_index:
randomstr=str(uuid.uuid4()),
nclscan_dir=config["nclscan_dir"],
nclscan_config=config["nclscan_config"],
envmodules:
TOOLS["star"]["version"],
TOOLS["bwa"]["version"],
TOOLS["samtools"]["version"],
TOOLS["ucsc"]["version"],
TOOLS["cufflinks"]["version"],
TOOLS["python37"]["version"],
container: config['containers']['star_ucsc_cufflinks']
threads: getthreads("create_index")
shell:
"""
Expand Down Expand Up @@ -61,9 +55,6 @@ STAR \\
bash {params.script2} {params.reffa} {params.refdir}/separate_fastas
ls {params.refdir}/separate_fastas/*.fa | awk {AWK1} > {output.fastalst}
# may have to create bowtie1 index here.. has to be a separate rule ... see below
"""


Expand All @@ -79,8 +70,7 @@ rule create_mapsplice_index:
separate_fastas=join(REF_DIR, "separate_fastas"),
ebwt=join(REF_DIR, "separate_fastas_index"),
threads: getthreads("create_mapsplice_index")
container:
"docker://cgrlab/mapsplice2:latest"
container: "docker://cgrlab/mapsplice2:latest"
shell:
"""
set -exo pipefail
Expand All @@ -99,7 +89,7 @@ rule create_bwa_index:
log=join(REF_DIR,"bwa_index.log")
params:
reffa=REF_FA
envmodules: TOOLS["bwa"]["version"]
container: config['containers']["base"]
shell:"""
set -exo pipefail
refdir=$(dirname {params.reffa})
Expand All @@ -115,7 +105,7 @@ rule create_bowtie2_index:
bt2=join(REF_DIR,"ref.1.bt2")
params:
reffa=REF_FA
envmodules: TOOLS["bowtie2"]["version"]
container: config['containers']["base"]
shell:"""
set -exo pipefail
refdir=$(dirname {params.reffa})
Expand Down
45 changes: 13 additions & 32 deletions workflow/rules/findcircrna.smk
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ rule circExplorer:
randomstr=str(uuid.uuid4()),
# script=join(SCRIPTS_DIR, "circExplorer_get_annotated_counts_per_sample.py"), # this produces an annotated counts table to which counts found in BAMs need to be appended
threads: getthreads("circExplorer")
envmodules:
TOOLS["circexplorer"]["version"],
container: config['containers']["circexplorer"]
shell:
"""
set -exo pipefail
Expand Down Expand Up @@ -285,9 +284,7 @@ rule ciri:
script=join(SCRIPTS_DIR, "filter_ciriout.py"),
randomstr=str(uuid.uuid4()),
threads: getthreads("ciri")
envmodules:
TOOLS["bwa"]["version"],
TOOLS["samtools"]["version"],
container: config['containers']['base']
shell:
"""
set -exo pipefail
Expand Down Expand Up @@ -377,8 +374,7 @@ rule circExplorer_bwa:
randomstr=str(uuid.uuid4()),
# script=join(SCRIPTS_DIR, "circExplorer_get_annotated_counts_per_sample.py"), # this produces an annotated counts table to which counts found in BAMs need to be appended
threads: getthreads("circExplorer")
envmodules:
TOOLS["circexplorer"]["version"],
container: config['containers']["circexplorer"]
shell:
"""
set -exo pipefail
Expand Down Expand Up @@ -427,8 +423,7 @@ rule create_ciri_count_matrix:
lookup=ANNOTATION_LOOKUP,
outdir=join(WORKDIR, "results"),
hostID=HOST + "ID",
envmodules:
TOOLS["python37"]["version"],
container: config['containers']['base']
shell:
"""
set -exo pipefail
Expand Down Expand Up @@ -459,8 +454,7 @@ rule create_circexplorer_count_matrix:
lookup=ANNOTATION_LOOKUP,
outdir=join(WORKDIR, "results"),
hostID=HOST + "ID",
envmodules:
TOOLS["python37"]["version"],
container: config['containers']['base']
shell:
"""
cd {params.outdir}
Expand Down Expand Up @@ -510,8 +504,7 @@ rule clear:
quantfile=join(WORKDIR, "results", "{sample}", "CLEAR", "quant.txt"),
params:
genepred=rules.create_index.output.genepred_w_geneid,
container:
"docker://nciccbr/ccbr_clear:latest"
container: config['containers']['clear']
threads: getthreads("clear")
shell:
"""
Expand Down Expand Up @@ -690,8 +683,7 @@ rule dcc:
"{sample}.dcc.counts_table.tsv.filtered",
),
threads: getthreads("dcc")
envmodules:
TOOLS["python27"]["version"],
container: config['containers']['dcc']
params:
peorse=get_peorse,
dcc_strandedness=config["dcc_strandedness"],
Expand Down Expand Up @@ -857,8 +849,7 @@ rule mapsplice:
outdir=join(WORKDIR, "results", "{sample}", "MapSplice"),
randomstr=str(uuid.uuid4()),
threads: getthreads("mapsplice")
container:
"docker://cgrlab/mapsplice2:latest"
container: config['containers']['mapsplice']
shell:
"""
set -exo pipefail
Expand Down Expand Up @@ -951,9 +942,7 @@ rule mapsplice_postprocess:
bai=join(
WORKDIR, "results", "{sample}", "MapSplice", "{sample}.mapsplice.cram.crai"
),
envmodules:
TOOLS["samtools"]["version"],
TOOLS["python27"]["version"],
container: config['containers']["nclscan_py27"]
params:
script=join(SCRIPTS_DIR, "create_mapsplice_per_sample_counts_table.py"),
memG=getmemG("mapsplice_postprocess"),
Expand Down Expand Up @@ -1043,8 +1032,7 @@ rule nclscan:
"NCLscan",
"{sample}.nclscan.counts_table.tsv.filtered",
),
envmodules:
TOOLS["ncl_required_modules"],
container: config['containers']["nclscan_py27"]
threads: getthreads("nclscan")
params:
workdir=WORKDIR,
Expand Down Expand Up @@ -1150,9 +1138,7 @@ rule circrnafinder:
),
bsj_min_nreads=config["minreadcount"],
randomstr=str(uuid.uuid4()),
envmodules:
TOOLS["perl"]["version"],
TOOLS["samtools"]["version"],
container: config['containers']['base']
shell:
"""
set -exo pipefail
Expand Down Expand Up @@ -1228,11 +1214,7 @@ rule find_circ:
min_reads=config['circexplorer_bsj_circRNA_min_reads'],
collapse_script=join(SCRIPTS_DIR,"_collapse_find_circ.py"),
randomstr=str(uuid.uuid4()),
envmodules:
TOOLS["python27"]["version"],
TOOLS["bowtie2"]["version"],
TOOLS["samtools"]["version"],
TOOLS["parallel"]["version"],
container: config['containers']["nclscan_py27"]
threads: getthreads("find_circ")
shell:
"""
Expand Down Expand Up @@ -1576,8 +1558,7 @@ rule create_master_counts_file:
resultsdir=join(WORKDIR, "results"),
lookup_table=ANNOTATION_LOOKUP,
bsj_min_nreads=config["circexplorer_bsj_circRNA_min_reads"],
envmodules:
TOOLS["python37"]["version"],
container: config['containers']['base']
shell:
"""
set -exo pipefail
Expand Down
4 changes: 0 additions & 4 deletions workflow/rules/init.smk
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,6 @@ for sample in SAMPLES:
# print(SAMPLESDF)
# sys.exit()

## Load tools from YAML file
with open(config["tools"]) as f:
TOOLS = yaml.safe_load(f)

## Load cluster.json
with open(config["cluster"]) as json_file:
CLUSTER = yaml.safe_load(json_file)
Expand Down
3 changes: 1 addition & 2 deletions workflow/rules/post_align_processing.smk
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ rule merge_genecounts:
params:
outdir=join(WORKDIR, "results"),
rscript=join(SCRIPTS_DIR, "merge_ReadsPerGene_counts.R"),
envmodules:
TOOLS["R"]["version"],
container: config['containers']["R"]
shell:
"""
set -exo pipefail
Expand Down
25 changes: 5 additions & 20 deletions workflow/rules/post_findcircrna_processing.smk
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ rule create_circExplorer_BSJ_bam:
flankscript=join(SCRIPTS_DIR, "_append_splice_site_flanks_to_BSJs.py"),
bam2bwscript=join(SCRIPTS_DIR, "bam_to_bigwig.sh"),
randomstr=str(uuid.uuid4()),
envmodules:
TOOLS["python37"]["version"],
TOOLS["samtools"]["version"],
TOOLS["bedtools"]["version"],
TOOLS["ucsc"]["version"],
container: config['containers']["ucsc"]
threads: getthreads("create_circExplorer_BSJ_bam")
shell:
"""
Expand Down Expand Up @@ -218,12 +214,7 @@ rule create_circExplorer_linear_spliced_bams:
# bam2bwscript=join(SCRIPTS_DIR,"bam_to_bigwig.sh"),
outdir=join(WORKDIR, "results", "{sample}", "circExplorer"),
randomstr=str(uuid.uuid4()),
envmodules:
TOOLS["python37"]["version"],
TOOLS["samtools"]["version"],
TOOLS["bedtools"]["version"],
TOOLS["ucsc"]["version"],
TOOLS["parallel"]["version"],
container: config['containers']["base"]
threads: getthreads("create_circExplorer_linear_spliced_bams")
shell:
"""
Expand Down Expand Up @@ -371,9 +362,7 @@ if RUN_MAPSPLICE:
bash2nreads_pyscript=join(SCRIPTS_DIR, "_bam_get_alignment_stats.py"),
randomstr=str(uuid.uuid4()),
threads: getthreads("alignment_stats")
envmodules:
TOOLS["python37"]["version"],
TOOLS["parallel"]["version"],
container: config['containers']["base"]
shell:
"""
set -exo pipefail
Expand Down Expand Up @@ -428,9 +417,7 @@ else:
bash2nreads_pyscript=join(SCRIPTS_DIR, "_bam_get_alignment_stats.py"),
randomstr=str(uuid.uuid4()),
threads: getthreads("alignment_stats")
envmodules:
TOOLS["python37"]["version"],
TOOLS["parallel"]["version"],
container: config['containers']["base"]
shell:
"""
set -exo pipefail
Expand Down Expand Up @@ -520,9 +507,7 @@ rule create_hq_bams:
host=HOST,
additives=ADDITIVES,
viruses=VIRUSES,
envmodules:
TOOLS["python37"]["version"],
TOOLS["samtools"]["version"],
container: config['containers']["base"]
shell:"""
set -exo pipefail
outdir=$(dirname {output.outbam})
Expand Down

0 comments on commit 80ea1a3

Please sign in to comment.