-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from pdimens/metassembly
Add Metassembly
- Loading branch information
Showing
53 changed files
with
1,205 additions
and
592 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import os | ||
import logging | ||
|
||
onstart: | ||
logger.logger.addHandler(logging.FileHandler(config["snakemake_log"])) | ||
onsuccess: | ||
os.remove(logger.logfile) | ||
onerror: | ||
os.remove(logger.logfile) | ||
|
||
FQ1 = config["inputs"]["fastq_r1"] | ||
FQ2 = config["inputs"]["fastq_r2"] | ||
outdir = config["output_directory"] | ||
envdir = os.getcwd() + "/.harpy_envs" | ||
max_mem = config["spades"]["max_memory"] | ||
k_param = config["spades"]["k"] | ||
extra = config["spades"].get("extra", "") | ||
|
||
rule cloudspades: | ||
input: | ||
FQ_R1 = FQ1, | ||
FQ_R2 = FQ2 | ||
output: | ||
f"{outdir}/contigs.fasta", | ||
f"{outdir}/scaffolds.fasta" | ||
params: | ||
outdir = outdir, | ||
k = k_param, | ||
mem = max_mem // 1000, | ||
extra = extra | ||
log: | ||
outdir + "/logs/assembly.log" | ||
conda: | ||
f"{envdir}/assembly.yaml" | ||
threads: | ||
workflow.cores | ||
resources: | ||
mem_mb=max_mem | ||
shell: | ||
"spades.py -t {threads} -m {params.mem} -k {params.k} {params.extra} --gemcode1-1 {input.FQ_R1} --gemcode1-2 {input.FQ_R2} -o {params.outdir} --isolate > {log}" | ||
|
||
rule workflow_summary: | ||
default_target: True | ||
input: | ||
f"{outdir}/athena/athena.asm.fa" | ||
params: | ||
k_param = k_param, | ||
max_mem = max_mem // 1000, | ||
extra = extra | ||
run: | ||
summary_template = f""" | ||
The harpy assemble workflow ran using these parameters: | ||
Reads were assembled using cloudspades: | ||
spades.py -t THREADS -m {params.max_mem} --gemcode1-1 FQ1 --gemcode1-2 FQ2 --isolate -k {params.k_param} {params.extra} | ||
The Snakemake workflow was called via command line: | ||
{config["workflow_call"]} | ||
""" | ||
with open(outdir + "/workflow/metassembly.summary", "w") as f: | ||
f.write(summary_template) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
workflow: assembly | ||
snakemake_log: Assembly/logs/snakemake/assembly.1.15_10_2024.log | ||
output_directory: Assembly | ||
barcode_tag: BX | ||
spades: | ||
assembler: None | ||
max_memory: 250000 | ||
k: auto | ||
skip_reports: False | ||
workflow_call: snakemake --rerun-incomplete --show-failed-logs --rerun-triggers input mtime params --nolock --software-deployment-method conda --conda-prefix .snakemake/conda --cores 4 --directory . --snakefile Assembly/workflow/assembly.smk --configfile Assembly/workflow/config.yaml | ||
inputs: | ||
fastq_r1: test/fastq/sample1.F.fq.gz | ||
fastq_r2: test/fastq/sample1.R.fq.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.