Skip to content

Commit

Permalink
fix #676
Browse files Browse the repository at this point in the history
  • Loading branch information
SilasK committed Jun 23, 2024
1 parent 8971d81 commit 8b4d552
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 61 deletions.
24 changes: 12 additions & 12 deletions workflow/rules/assemble.smk
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if SKIP_QC & (len(MULTIFILE_FRACTIONS) < 3):
"%s/required_packages.yaml" % CONDAENV
threads: config.get("simplejob_threads", 1)
resources:
mem=config["simplejob_mem"],
mem_mb=config["simplejob_mem"]*1024,
java_mem=int(config["simplejob_mem"] * JAVA_MEM_FRACTION),
shell:
"""
Expand Down Expand Up @@ -128,7 +128,7 @@ rule normalize_reads:
"%s/required_packages.yaml" % CONDAENV
threads: config.get("threads", 1)
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
java_mem=int(config["mem"] * JAVA_MEM_FRACTION),
shell:
" bbnorm.sh {params.inputs} "
Expand Down Expand Up @@ -165,7 +165,7 @@ rule error_correction:
conda:
"%s/required_packages.yaml" % CONDAENV
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
java_mem=int(config["mem"] * JAVA_MEM_FRACTION),
params:
inputs=lambda wc, input: io_params_for_tadpole(input),
Expand Down Expand Up @@ -212,7 +212,7 @@ rule merge_pairs:
),
threads: config.get("threads", 1)
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
java_mem=int(config["mem"] * JAVA_MEM_FRACTION),
conda:
"%s/required_packages.yaml" % CONDAENV
Expand Down Expand Up @@ -312,7 +312,7 @@ if config.get("assembler", "megahit") == "megahit":
"../envs/megahit.yaml"
threads: config["assembly_threads"]
resources:
mem_mb=config["assembly_memory"]*1000,
mem_mb=config["assembly_memory"] * 1000,
time=config["runtime"]["assembly"],
shell:
"""
Expand Down Expand Up @@ -431,7 +431,7 @@ else:
"../envs/spades.yaml"
threads: config["assembly_threads"]
resources:
mem=config["assembly_memory"],
mem_mb=config["assembly_memory"]*1024,
time=config["runtime"]["assembly"],
shell:
# remove pipeline_state file to create all output files again
Expand Down Expand Up @@ -474,7 +474,7 @@ rule rename_contigs:
mapping_table="{sample}/assembly/old2new_contig_names.tsv",
threads: config.get("simplejob_threads", 1)
resources:
mem=config["simplejob_mem"],
mem_mb=config["simplejob_mem"]*1024,
time=config["runtime"]["default"],
log:
"{sample}/logs/assembly/post_process/rename_and_filter_size.log",
Expand Down Expand Up @@ -552,7 +552,7 @@ if config["filter_contigs"]:
"%s/required_packages.yaml" % CONDAENV
threads: 1
resources:
mem=config["simplejob_mem"],
mem_mb=config["simplejob_mem"]*1024,
java_mem=int(config["simplejob_mem"] * JAVA_MEM_FRACTION),
shell:
"""filterbycoverage.sh in={input.fasta} \
Expand Down Expand Up @@ -610,7 +610,7 @@ rule calculate_contigs_stats:
"{sample}/logs/assembly/post_process/contig_stats_final.log",
threads: 1
resources:
mem=1,
mem_mb=1024,
time=config["runtime"]["simplejob"],
shell:
"stats.sh in={input} format=3 out={output} &> {log}"
Expand Down Expand Up @@ -660,7 +660,7 @@ rule pileup_contigs_sample:
"%s/required_packages.yaml" % CONDAENV
threads: config.get("threads", 1)
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
java_mem=int(config["mem"] * JAVA_MEM_FRACTION),
shell:
"pileup.sh "
Expand All @@ -686,7 +686,7 @@ rule create_bam_index:
"../envs/required_packages.yaml"
threads: 1
resources:
mem=2 * config["simplejob_threads"],
mem_mb=2 * config["simplejob_threads"] *1024,
shell:
"samtools index {input}"

Expand All @@ -706,7 +706,7 @@ rule predict_genes:
"logs/benchmarks/prodigal/{sample}.txt"
threads: 1
resources:
mem=config["simplejob_mem"],
mem_mb=config["simplejob_mem"]*1024,
time=config["runtime"]["simplejob"],
shell:
"""
Expand Down
4 changes: 2 additions & 2 deletions workflow/rules/binning.smk
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ rule run_concoct:
"%s/concoct.yaml" % CONDAENV
threads: 10 # concoct uses 10 threads by default, wit for update: https://github.com/BinPro/CONCOCT/issues/177
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
shell:
"""
concoct -c {params.Nexpected_clusters} \
Expand Down Expand Up @@ -176,7 +176,7 @@ rule metabat:
"%s/metabat.yaml" % CONDAENV
threads: config["threads"]
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
shell:
"""
metabat2 -i {input.contigs} \
Expand Down
2 changes: 1 addition & 1 deletion workflow/rules/cdhit.smk
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ rule cluster_genes:
"logs/Genecatalog/cluster_genes.log",
threads: config.get("threads", 1)
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
params:
coverage=config["genecatalog"]["coverage"],
identity=config["genecatalog"]["minid"],
Expand Down
8 changes: 4 additions & 4 deletions workflow/rules/cobinning.smk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rule filter_contigs:
"../envs/required_packages.yaml"
threads: 1
resources:
mem=config["simplejob_mem"],
mem_mb=config["simplejob_mem"]*1024,
java_mem=int(config["simplejob_mem"] * JAVA_MEM_FRACTION),
shell:
" reformat.sh in={input} "
Expand Down Expand Up @@ -93,7 +93,7 @@ rule minimap_index:
params:
index_size="12G",
resources:
mem=config["mem"], # limited num of fatnodes (>200g)
mem_mb=config["mem"]*1024, # limited num of fatnodes (>200g)
threads: config["simplejob_threads"]
log:
"logs/cobinning/{bingroup}/minimap_index.log",
Expand All @@ -111,7 +111,7 @@ rule samtools_dict:
output:
dict="Intermediate/cobinning/{bingroup}/combined_contigs.dict",
resources:
mem=config["simplejob_mem"],
mem_mb=config["simplejob_mem"]*1024,
time=config["runtime"]["simplejob"],
threads: 1
log:
Expand All @@ -131,7 +131,7 @@ rule minimap:
bam=temp("Intermediate/cobinning/{bingroup}/bams/{sample}.unsorted.bam"),
threads: config["threads"]
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
log:
"logs/cobinning/{bingroup}/mapping/minimap/{sample}.log",
benchmark:
Expand Down
8 changes: 4 additions & 4 deletions workflow/rules/dram.smk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ rule dram_download:
config=f"{DBDIR}/DRAM/DRAM.config",
threads: config["threads"]
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
time=config["runtime"]["default"],
log:
"logs/dram/download_dram.log",
Expand Down Expand Up @@ -51,7 +51,7 @@ rule DRAM_annotate:
outdir=directory("genomes/annotations/dram/intermediate_files/{genome}"),
threads: config["simplejob_threads"]
resources:
mem=config["simplejob_mem"],
mem_mb=config["simplejob_mem"]*1024,
time=config["runtime"]["default"],
conda:
"../envs/dram.yaml"
Expand Down Expand Up @@ -112,7 +112,7 @@ rule DRAM_destill:
outdir=directory("genomes/annotations/dram/distil"),
threads: 1
resources:
mem=config["simplejob_mem"],
mem_mb=config["simplejob_mem"]*1024,
ttime=config["runtime"]["simplejob"],
conda:
"../envs/dram.yaml"
Expand All @@ -134,7 +134,7 @@ rule get_all_modules:
"genomes/annotations/dram/kegg_modules.tsv",
threads: 1
resources:
mem=config["simplejob_mem"],
mem_mb=config["simplejob_mem"]*1024,
time=config["runtime"]["default"],
conda:
"../envs/dram.yaml"
Expand Down
22 changes: 11 additions & 11 deletions workflow/rules/genecatalog.smk
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ if (config["genecatalog"]["clustermethod"] == "linclust") or (
"../envs/required_packages.yaml"
threads: 1
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
java_mem=int(config["mem"] * JAVA_MEM_FRACTION),
log:
"logs/Genecatalog/clustering/get_cds_of_proteins.log",
Expand Down Expand Up @@ -218,7 +218,7 @@ rule get_genecatalog_seq_info:
"../envs/required_packages.yaml"
threads: 1
resources:
mem=config["simplejob_mem"],
mem_mb=config["simplejob_mem"]*1024,
java_mem=int(config["simplejob_mem"] * JAVA_MEM_FRACTION),
shell:
"stats.sh gcformat=4 gc={output} in={input} &> {log}"
Expand Down Expand Up @@ -283,7 +283,7 @@ rule pileup_Genecatalog:
"../envs/required_packages.yaml"
threads: config["threads"]
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
java_mem=int(config["mem"] * JAVA_MEM_FRACTION),
shell:
" pileup.sh "
Expand All @@ -304,7 +304,7 @@ rule gene_pileup_as_parquet:
"Genecatalog/alignments/{sample}_coverage.parquet",
threads: 1
resources:
mem=config["simplejob_mem"],
mem_mb=config["simplejob_mem"]*1024,
time_min=config["runtime"]["simplejob"] * 60,
log:
"logs/Genecatalog/counts/parse_gene_coverages/{sample}.log",
Expand Down Expand Up @@ -368,7 +368,7 @@ rule combine_gene_coverages:
"../envs/hdf.yaml"
threads: 1
resources:
mem=config["simplejob_mem"],
mem_mb=config["simplejob_mem"]*1024,
time_min=get_combine_cov_time(),
script:
"../scripts/combine_gene_coverages.py"
Expand Down Expand Up @@ -441,7 +441,7 @@ rule eggNOG_homology_search:
data_dir=EGGNOG_DIR,
prefix=lambda wc, output: output[0].replace(".emapper.seed_orthologs", ""),
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
threads: config["threads"]
shadow:
"minimal"
Expand All @@ -458,8 +458,8 @@ rule eggNOG_homology_search:


def calculate_mem_eggnog():
return 2 * config["simplejob_mem"] + (
37 if config["eggNOG_use_virtual_disk"] else 0
return 1024 *(2 * config["simplejob_mem"] + (
37 if config["eggNOG_use_virtual_disk"] )else 0
)


Expand All @@ -477,7 +477,7 @@ rule eggNOG_annotation:
copyto_shm="t" if config["eggNOG_use_virtual_disk"] else "f",
threads: config.get("threads", 1)
resources:
mem=calculate_mem_eggnog(),
mem_mb=calculate_mem_eggnog(),
shadow:
"minimal"
conda:
Expand Down Expand Up @@ -597,7 +597,7 @@ rule DRAM_annotate_genecatalog:
genes=temp("Intermediate/genecatalog/annotation/dram/{subset}/genes.faa"),
threads: config["simplejob_threads"]
resources:
mem=config["simplejob_mem"],
mem_mb=config["simplejob_mem"]*1024,
time=config["runtime"]["long"],
conda:
"../envs/dram.yaml"
Expand Down Expand Up @@ -696,7 +696,7 @@ rule gene2genome:
# threads:
# 12
# resources:
# mem= 220
# mem_mb= 220*1024
# shell:
# """
# canopy -i {input} -o {output.cluster} -c {output.profile} -n {threads} --canopy_size_stats_file {log} {params.canopy_params} 2> {log}
Expand Down
14 changes: 7 additions & 7 deletions workflow/rules/genomes.smk
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ rule predict_genes_genomes:
"logs/genomes/prodigal/{genome}.txt",
threads: 1
resources:
mem=config["simplejob_mem"],
mem_mb=config["simplejob_mem"]*1024,
time=config["runtime"]["simplejob"],
shell:
"""
Expand Down Expand Up @@ -204,7 +204,7 @@ if config["genome_aligner"] == "minimap":
index_size="12G",
threads: 3
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
wrapper:
"v1.19.0/bio/minimap2/index"

Expand All @@ -221,7 +221,7 @@ if config["genome_aligner"] == "minimap":
sort="coordinate",
threads: config["threads"]
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
mem_mb=config["mem"] * 1000,
wrapper:
"v1.19.0/bio/minimap2/aligner"
Expand All @@ -238,7 +238,7 @@ elif config["genome_aligner"] == "bwa":
"logs/genomes/alignments/bwa_index.log",
threads: 4
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
wrapper:
"v1.19.0/bio/bwa-mem2/index"

Expand All @@ -256,7 +256,7 @@ elif config["genome_aligner"] == "bwa":
sort_order="coordinate",
threads: config["threads"]
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
mem_mb=config["mem"] * 1000,
wrapper:
"v1.19.0/bio/bwa-mem2/mem"
Expand Down Expand Up @@ -297,7 +297,7 @@ rule mapping_stats_genomes:
"logs/genomes/alignments/{sample}_stats.log",
threads: 1
resources:
mem=config["simplejob_mem"],
mem_mb=config["simplejob_mem"]*1024,
wrapper:
"v1.19.0/bio/samtools/stats"

Expand Down Expand Up @@ -329,7 +329,7 @@ rule pileup_MAGs:
"../envs/required_packages.yaml"
threads: config["threads"]
resources:
mem=config["mem"],
mem_mb=config["mem"]*1024,
java_mem=int(config["mem"] * JAVA_MEM_FRACTION),
shell:
"pileup.sh in={input.bam} "
Expand Down
4 changes: 2 additions & 2 deletions workflow/rules/gtdbtk.smk
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ rule classify:
directory(f"{gtdb_dir}/classify"),
threads: config["threads"] #pplacer needs much memory for not many threads
resources:
mem=config["large_mem"],
mem_mb=config["large_mem"]*1024,
time=config["runtime"]["long"],
conda:
"../envs/gtdbtk.yaml"
Expand Down Expand Up @@ -123,7 +123,7 @@ rule root_tree:
"../envs/tree.yaml"
threads: 1
resources:
mem=config["simplejob_mem"],
mem_mb=config["simplejob_mem"]*1024,
ttime=config["runtime"]["simplejob"],
log:
"logs/genomes/tree/root_tree_{msa}.log",
Expand Down
2 changes: 2 additions & 0 deletions workflow/rules/patch.smk
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ localrules:

# Rules that are usefull temporarily to update to new version of atlas


ruleorder: copy_assembly > finalize_contigs


rule copy_assembly:
input:
"{sample}/{sample}_contigs.fasta",
Expand Down
Loading

0 comments on commit 8b4d552

Please sign in to comment.