Skip to content

Commit

Permalink
Merge pull request #18 from NBISweden/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
johnne committed Jun 13, 2020
2 parents 3cb0d43 + dcaef98 commit a22d0c9
Show file tree
Hide file tree
Showing 11 changed files with 302 additions and 247 deletions.
6 changes: 3 additions & 3 deletions .test/config/binning.yaml
Expand Up @@ -117,11 +117,11 @@ annotation:
# run tRNAscan-SE?
tRNAscan: False
# run infernal for rRNA identification?
infernal: True
infernal: False
# run eggnog-mapper to infer KEGG orthologs, pathways and modules?
eggnog: False
# run PFAM-scan to infer protein families from PFAM?
pfam: True
pfam: False
# run Resistance gene identifier?
rgi: False
# run taxonomic annotation of assembled contigs (using tango + sourmash)?
Expand Down Expand Up @@ -231,7 +231,7 @@ bowtie2:
# what type of read-based classification to do
classification:
# run kraken2 read classifier?
kraken: True
kraken: False
# run centrifuge to classify reads
centrifuge: False
# run metaphlan profiler?
Expand Down
2 changes: 1 addition & 1 deletion .test/config/kraken.yaml
Expand Up @@ -91,7 +91,7 @@ remove_duplicates: True

assembly:
# run Megahit assembler?
megahit: True
megahit: False
# Use Metaspades instead of Megahit for assembly?
metaspades: False

Expand Down
6 changes: 3 additions & 3 deletions .test/config/metabat.yaml
Expand Up @@ -117,11 +117,11 @@ annotation:
# run tRNAscan-SE?
tRNAscan: False
# run infernal for rRNA identification?
infernal: True
infernal: False
# run eggnog-mapper to infer KEGG orthologs, pathways and modules?
eggnog: False
# run PFAM-scan to infer protein families from PFAM?
pfam: True
pfam: False
# run Resistance gene identifier?
rgi: False
# run taxonomic annotation of assembled contigs (using tango + sourmash)?
Expand Down Expand Up @@ -208,7 +208,7 @@ bowtie2:
# what type of read-based classification to do
classification:
# run kraken2 read classifier?
kraken: True
kraken: False
# run centrifuge to classify reads
centrifuge: False
# run metaphlan profiler?
Expand Down
10 changes: 8 additions & 2 deletions config/config.yaml
Expand Up @@ -45,7 +45,7 @@ trimmomatic:
# ["TruSeq2-SE", "TruSeq3-SE"]
adapter: "TruSeq3-SE"
# parameters for trimming adapters on single-end samples
se_adapter_params: "2:30:15"
adapter_params: "2:30:15"
# parameters for trimming prior to adapter removal on single-end samples
pre_adapter_params: ""
# parameters for trimming after adapter removal on single-end samples
Expand All @@ -59,7 +59,7 @@ cutadapt:
# reverse adapter sequence to trim with cutadapt
rev_adapter_sequence: AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT
# maximum allowed error rate as value between 0 and 1 (no. of errors divided by length of matching region)
error_rate: 0.1 #Maximum allowed error rate as value between 0 and 1
error_rate: 0.1

# parameters for sortmerna
sortmerna:
Expand Down Expand Up @@ -220,6 +220,12 @@ fastani:
kmer_size: 16
# fragment length used to calculate ANI
frag_len: 3000
# minimum number of aligned fragments to consider a pair of genomes for clustering
minfrags: 100
# minimum estimated completeness for bins to include in clustering
min_completeness: 50
# maximum estimated contamination for bins to include in clustering
max_contamination: 10

# parameters for bowtie2
bowtie2:
Expand Down
2 changes: 1 addition & 1 deletion workflow/Snakefile
Expand Up @@ -31,7 +31,7 @@ def all_input(wildcards):
# get annotation input
wanted_input += annotation_input(config, assemblies)
# get binning input
wanted_input += binning_input(config, assemblies)
wanted_input += binning_input(config)

wanted_input += classify_input(config)

Expand Down
11 changes: 7 additions & 4 deletions workflow/rules/binning.smk
Expand Up @@ -30,7 +30,7 @@ localrules:

rule bin:
input:
binning_input(config, assemblies),
binning_input(config),
opj(config["paths"]["results"], "report", "binning", "bin_report.pdf")

##### target rule for running checkm analysis #####
Expand Down Expand Up @@ -746,7 +746,9 @@ rule generate_fastANI_lists:
temp(opj(config["paths"]["results"], "binning", "fastANI", "refList")),
temp(opj(config["paths"]["results"], "binning", "fastANI", "queryList"))
params:
outdir = lambda wildcards, output: os.path.abspath(os.path.dirname(output[0]))
outdir = lambda wildcards, output: os.path.abspath(os.path.dirname(output[0])),
completeness = config["fastani"]["min_completeness"],
contamination = config["fastani"]["max_contamination"]
message:
"Generating input lists for fastANI"
script:
Expand Down Expand Up @@ -788,15 +790,16 @@ rule cluster_genomes:
conda:
"../envs/fastani.yml"
params:
thresh = config["fastani"]["threshold"]
thresh = config["fastani"]["threshold"],
minfrags = config["fastani"]["minfrags"]
script:
"../scripts/binning_utils.py"

##### rule to generate summary plots

rule binning_report:
input:
binning_input(config, assemblies, report=True)
binning_input(config, report=True)
output:
report(opj(config["paths"]["results"], "report", "binning", "bin_report.pdf"),
category="Binning", caption="../report/binning.rst")
Expand Down
17 changes: 11 additions & 6 deletions workflow/rules/classification.smk
Expand Up @@ -338,7 +338,8 @@ rule metaphlan2krona:
files = get_all_files(samples, opj(config["paths"]["results"], "metaphlan"), ".krona"),
db = opj("resources", "krona", "taxonomy.tab")
output:
opj(config["paths"]["results"], "report", "metaphlan", "metaphlan.html")
opj(config["paths"]["results"], "report", "metaphlan",
"metaphlan.html")
log:
opj(config["paths"]["results"], "report", "metaphlan", "krona.log")
conda:
Expand All @@ -356,7 +357,8 @@ rule plot_metaphlan:
input:
opj(config["paths"]["results"], "report", "metaphlan", "metaphlan.tsv")
output:
opj(config["paths"]["results"], "report", "metaphlan", "metaphlan.pdf")
opj(config["paths"]["results"], "report", "metaphlan",
"metaphlan.pdf")
params:
rank=config["metaphlan"]["plot_rank"]
conda:
Expand Down Expand Up @@ -390,6 +392,9 @@ rule classifier2krona:
output:
opj(config["paths"]["results"], "{classifier}",
"{sample}_{unit}_{seq_type}.html")
log:
opj(config["paths"]["results"], "{classifier}",
"{sample}_{unit}_{seq_type}.krona.log")
params:
tax="resources/krona"
conda:
Expand All @@ -398,9 +403,8 @@ rule classifier2krona:
"docker://continuumio/miniconda3:4.8.2"
shell:
"""
ktImportTaxonomy -t 5 -m 3 \
-tax {params.tax} -o {output[0]} \
{input[0]},{wildcards.sample}_{wildcards.unit}
ktImportTaxonomy -t 5 -m 3 -tax {params.tax} -o {output[0]} \
{input[0]},{wildcards.sample}_{wildcards.unit} > {log} 2>&1
"""

rule all2krona:
Expand All @@ -411,7 +415,8 @@ rule all2krona:
"{classifier}"), ".html"),
t=opj("resources", "krona", "taxonomy.tab")
output:
opj(config["paths"]["results"], "report", "{classifier}", "{classifier}.krona.html")
opj(config["paths"]["results"], "report", "{classifier}",
"{classifier}.krona.html")
log:
opj(config["paths"]["results"], "report", "{classifier}", "{classifier}.krona.log")
params:
Expand Down
2 changes: 1 addition & 1 deletion workflow/rules/common.smk
Expand Up @@ -13,7 +13,7 @@ singularity: "docker://continuumio/miniconda3:4.8.2"

if os.path.exists("config/config.yaml"):
configfile: "config/config.yaml"
validate(config, schema="../schemas/config.schema.yaml")
validate(config, schema="../schemas/config.schema.yaml", set_default=True)

##### generate preprocess/postprocess strings #####
from scripts.common import prepost_string
Expand Down

0 comments on commit a22d0c9

Please sign in to comment.