Skip to content

Commit

Permalink
Merge pull request #139 from /issues/138
Browse files Browse the repository at this point in the history
Issues/138
  • Loading branch information
borauyar authored Apr 3, 2024
2 parents bd38e02 + be44e32 commit 741557c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 18 deletions.
28 changes: 23 additions & 5 deletions etc/settings.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,16 @@ execution:
translate_sample_sheet_for_report:
threads: 1
memory: 500
trim_qc_reads:
trim_qc_reads_pe:
threads: 1
memory: 4000
trim_qc_reads_se:
threads: 1
memory: 4000
star_index:
threads: 2
memory: 32000
hisat2-build:
hisat2_index:
threads: 2
memory: 32000
salmon_index:
Expand All @@ -100,7 +103,7 @@ execution:
salmon_quant:
threads: 8
memory: 6000
counts_from_salmon:
counts_from_SALMON:
threads: 1
memory: 200
collate_read_counts:
Expand All @@ -112,7 +115,7 @@ execution:
star_map:
threads: 2
memory: 16000
hisat2:
hisat2_map:
threads: 2
memory: 8000
index_bam:
Expand All @@ -133,7 +136,22 @@ execution:
check_annotation_files:
threads: 1
memory: 16000
reports:
report1:
threads: 1
memory: 4000
deseq_collate_report1:
threads: 1
memory: 4000
report2:
threads: 1
memory: 4000
deseq_collate_report2:
threads: 1
memory: 4000
report3:
threads: 1
memory: 4000
deseq_collate_report3:
threads: 1
memory: 4000

Expand Down
26 changes: 13 additions & 13 deletions snakefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def tool(name):
MEGADEPTH_EXEC = tool('megadepth')

STAR_INDEX_THREADS = config['execution']['rules']['star_index']['threads']
HISAT2_BUILD_THREADS = config['execution']['rules']['hisat2-build']['threads']
HISAT2_THREADS = config['execution']['rules']['hisat2']['threads']
HISAT2_BUILD_THREADS = config['execution']['rules']['hisat2_index']['threads']
HISAT2_THREADS = config['execution']['rules']['hisat2_map']['threads']
STAR_MAP_THREADS = config['execution']['rules']['star_map']['threads']
SALMON_INDEX_THREADS = config['execution']['rules']['salmon_index']['threads']
SALMON_QUANT_THREADS = config['execution']['rules']['salmon_quant']['threads']
Expand Down Expand Up @@ -324,7 +324,7 @@ def trim_reads_input(args):
html=os.path.join(QC_DIR, "{sample}.pe.fastp.html"),
json=os.path.join(QC_DIR, "{sample}.pe.fastp.json") #notice that multiqc recognizes files ending with fast.json
resources:
mem_mb = config['execution']['rules']['trim_qc_reads']['memory']
mem_mb = config['execution']['rules']['trim_qc_reads_pe']['memory']
log: os.path.join(LOG_DIR, 'trim_reads.{sample}.log')
shell: "{FASTP_EXEC} --in1 {input[0]} --in2 {input[1]} --out1 {output.r1} --out2 {output.r2} -h {output.html} -j {output.json} >> {log} 2>&1"

Expand All @@ -336,7 +336,7 @@ def trim_reads_input(args):
html=os.path.join(QC_DIR, "{sample}.se.fastp.html"),
json=os.path.join(QC_DIR, "{sample}.se.fastp.json") #notice that multiqc recognizes files ending with fast.json
resources:
mem_mb = config['execution']['rules']['trim_qc_reads']['memory']
mem_mb = config['execution']['rules']['trim_qc_reads_se']['memory']
log: os.path.join(LOG_DIR, 'trim_reads.{sample}.log')
shell: "{FASTP_EXEC} --in1 {input[0]} --out1 {output.r} -h {output.html} -j {output.json} >> {log} 2>&1 "

Expand All @@ -360,7 +360,7 @@ def trim_reads_input(args):
output:
[os.path.join(OUTPUT_DIR, "hisat2_index", f"{GENOME_BUILD}_index.{n}.ht2l") for n in [1, 2, 3, 4, 5, 6, 7, 8]]
resources:
mem_mb = config['execution']['rules']['hisat2-build']['memory']
mem_mb = config['execution']['rules']['hisat2_index']['memory']
params:
index_directory = os.path.join(OUTPUT_DIR, "hisat2_index"),
log: os.path.join(LOG_DIR, 'hisat2_index.log')
Expand Down Expand Up @@ -406,7 +406,7 @@ def hisat2_file_arguments(args):
output:
os.path.join(MAPPED_READS_DIR, 'hisat2', '{sample}_Aligned.sortedByCoord.out.bam')
resources:
mem_mb = config['execution']['rules']['hisat2']['memory']
mem_mb = config['execution']['rules']['hisat2_map']['memory']
params:
samfile = lambda wildcards: os.path.join(MAPPED_READS_DIR, 'hisat2', "_".join([wildcards.sample, 'Aligned.out.sam'])),
index_dir = rules.hisat2_index.params.index_directory,
Expand Down Expand Up @@ -476,7 +476,7 @@ def hisat2_file_arguments(args):
os.path.join(COUNTS_DIR, "normalized", "salmon", "TPM_counts_from_SALMON.transcripts.tsv"),
os.path.join(COUNTS_DIR, "normalized", "salmon", "TPM_counts_from_SALMON.genes.tsv")
resources:
mem_mb = config['execution']['rules']['counts_from_salmon']['memory']
mem_mb = config['execution']['rules']['counts_from_SALMON']['memory']
log: os.path.join(LOG_DIR, "salmon", 'salmon_import_counts.log')
shell: "{RSCRIPT_EXEC} {SCRIPTS_DIR}/counts_matrix_from_SALMON.R {SALMON_DIR} {COUNTS_DIR} {input.colDataFile} >> {log} 2>&1"

Expand Down Expand Up @@ -607,7 +607,7 @@ def hisat2_file_arguments(args):
os.path.join(OUTPUT_DIR, "report", MAPPER, '{analysis}.deseq.report.html'),
os.path.join(OUTPUT_DIR, "report", MAPPER, '{analysis}.deseq_results.tsv')
resources:
mem_mb = config['execution']['rules']['reports']['memory']
mem_mb = config['execution']['rules']['report1']['memory']
shell:
"{RSCRIPT_EXEC} {params.reportR} --logo={params.logo} --prefix='{wildcards.analysis}' --reportFile={params.reportRmd} --countDataFile={input.counts} --colDataFile={input.coldata} --gtfFile={GTF_FILE} --caseSampleGroups='{params.case}' --controlSampleGroups='{params.control}' --covariates='{params.covariates}' --workdir={params.outdir} --organism='{ORGANISM}' --description='{params.description}' --selfContained='{params.selfContained}' >> {log} 2>&1"

Expand All @@ -624,7 +624,7 @@ def hisat2_file_arguments(args):
output:
os.path.join(OUTPUT_DIR, "report", MAPPER, 'collated.deseq_results.tsv')
resources:
mem_mb = config['execution']['rules']['reports']['memory']
mem_mb = config['execution']['rules']['deseq_collate_report1']['memory']
shell:
"{RSCRIPT_EXEC} {params.script} {params.mapper} {params.inpdir} {params.outdir} >> {log} 2>&1"

Expand All @@ -647,7 +647,7 @@ def hisat2_file_arguments(args):
os.path.join(OUTPUT_DIR, "report", 'salmon', '{analysis}.salmon.transcripts.deseq.report.html'),
os.path.join(OUTPUT_DIR, "report", "salmon", '{analysis}.salmon.transcripts.deseq_results.tsv')
resources:
mem_mb = config['execution']['rules']['reports']['memory']
mem_mb = config['execution']['rules']['report2']['memory']
shell: "{RSCRIPT_EXEC} {params.reportR} --logo={params.logo} --prefix='{wildcards.analysis}.salmon.transcripts' --reportFile={params.reportRmd} --countDataFile={input.counts} --colDataFile={input.coldata} --gtfFile={GTF_FILE} --caseSampleGroups='{params.case}' --controlSampleGroups='{params.control}' --covariates='{params.covariates}' --workdir={params.outdir} --organism='{ORGANISM}' --description='{params.description}' --selfContained='{params.selfContained}' >> {log} 2>&1"

rule deseq_collate_report2:
Expand All @@ -663,7 +663,7 @@ def hisat2_file_arguments(args):
output:
os.path.join(OUTPUT_DIR, "report", 'salmon', 'collated.transcripts.deseq_results.tsv')
resources:
mem_mb = config['execution']['rules']['reports']['memory']
mem_mb = config['execution']['rules']['deseq_collate_report2']['memory']
shell:
"{RSCRIPT_EXEC} {params.script} {params.mapper} {params.inpdir} {params.outdir} >> {log} 2>&1"

Expand All @@ -686,7 +686,7 @@ def hisat2_file_arguments(args):
os.path.join(OUTPUT_DIR, "report", "salmon", '{analysis}.salmon.genes.deseq.report.html'),
os.path.join(OUTPUT_DIR, "report", "salmon", '{analysis}.salmon.genes.deseq_results.tsv')
resources:
mem_mb = config['execution']['rules']['reports']['memory']
mem_mb = config['execution']['rules']['report3']['memory']
shell: "{RSCRIPT_EXEC} {params.reportR} --logo={params.logo} --prefix='{wildcards.analysis}.salmon.genes' --reportFile={params.reportRmd} --countDataFile={input.counts} --colDataFile={input.coldata} --gtfFile={GTF_FILE} --caseSampleGroups='{params.case}' --controlSampleGroups='{params.control}' --covariates='{params.covariates}' --workdir={params.outdir} --organism='{ORGANISM}' --description='{params.description}' --selfContained='{params.selfContained}' >> {log} 2>&1"

rule deseq_collate_report3:
Expand All @@ -702,6 +702,6 @@ def hisat2_file_arguments(args):
output:
os.path.join(OUTPUT_DIR, "report", 'salmon', 'collated.genes.deseq_results.tsv')
resources:
mem_mb = config['execution']['rules']['reports']['memory']
mem_mb = config['execution']['rules']['deseq_collate_report3']['memory']
shell:
"{RSCRIPT_EXEC} {params.script} {params.mapper} {params.inpdir} {params.outdir} >> {log} 2>&1"

0 comments on commit 741557c

Please sign in to comment.