Skip to content
Snippets Groups Projects
Snakefile 3.1 KiB
Newer Older
# File for running ONT analyses

##############################
# MODULES
import os
from tempfile import TemporaryDirectory

##############################
# CONFIG
# configfile:"config/CONFIG.yaml"
# Paths
Valentina Galata's avatar
Valentina Galata committed
SRC_DIR = srcdir("workflow/scripts")
ENV_DIR = srcdir("workflow/envs")
DATA_DIR = config["data_dir"]
RESULTS_DIR = config["results_dir"]
DB_DIR = config["db_dir"]

# Steps
STEPS = config['steps']
ANALYSIS_STEPS = config["analysis_steps"]

# Input
BARCODES = config["barcodes"]
RUNS = [
    config["runs"]["first"],
    config["runs"]["second"],
#    config["runs"]["third"]
]
SAMPLES = config["samples"]
BINNING_SAMPLES = config["binning_samples"]

# References
IGC_URI = config["igc"]["uri"]
HG38_URI = config["hg38"]["uri"]
REFERENCES = ["igc", "hg38"]

# Tools
ASSEMBLERS = config["assemblers"]
HYBRID_ASSEMBLER = config["hybrid_assembler"]
MAPPERS = ["bwa", "mmi"]
# default executable for snakmake
shell.executable("bash")


# include rules for the workflows based on "steps" in the CONFIG.yaml file
# ONT analyses workflow
TARGETS = []

if 'assembly_annotation' in STEPS:
    include:
        "workflow/steps/assembly_annotation.smk"
    TARGETS += [
        "assemble_and_coverage.done",
        "annotate.done",
        "basecall_merge_qc.done",
        "coverage_of_references.done",
        "prodigal_gene_call.done",
        "diamond_proteins.done"
    ]

if 'checkpoint_assembly_annotation' in STEPS:
    include:
        "workflow/steps/checkpoint_assembly_annotation.smk"
    TARGETS += [
        "assemble_and_coverage.done",
        "annotate.done",
        "basecall_merge_qc.done",
        "basecall_merge_qc_NO_MOD.done",
        "coverage_of_references.done",
        "prodigal_gene_call.done",
        "diamond_proteins.done",
        "dummy_folders_created.done"
    ]
if 'mmseq' in STEPS:
    include:
        "workflow/steps/mmseq.smk"
    TARGETS += [
        "mmseq_comparison_for_ont.done"
    ]
Valentina Galata's avatar
Valentina Galata committed
if 'metaT' in STEPS:
    include:
        "workflow/steps/metat.smk"
    TARGETS += ["metaT_mapping_for_ONT.done"]
Valentina Galata's avatar
Valentina Galata committed
if 'mapping' in STEPS:
    include:
        "workflow/steps/mapping.smk"
    TARGETS += ["mapping_for_binning.done"]
Valentina Galata's avatar
Valentina Galata committed
if 'binning' in STEPS:
    include:
        "workflow/steps/binning.smk"
    TARGETS += ["binning_for_ont.done"]
Valentina Galata's avatar
Valentina Galata committed
if 'taxonomy' in STEPS:
    include:
        "workflow/steps/taxonomy.smk"
    TARGETS += ["taxonomy_for_ont.done"]
Valentina Galata's avatar
Valentina Galata committed
if 'analysis' in STEPS:
    include:
        "workflow/steps/analysis.smk"
    # CD-HIT
    if "cdhit" in ANALYSIS_STEPS:
        TARGETS.append("cdhit_analysis.done")
    # Mappability
    if "mappability" in ANALYSIS_STEPS:
        TARGETS.append("mappability_index.done")
    # CRISPR
    if "crispr" in ANALYSIS_STEPS:
        TARGETS.append("crispr_analysis.done")
    # Plasmid prediction
    if "plasmids" in ANALYSIS_STEPS:
        TARGETS.append("plasmids_analysis.done")
    # AMR prediction
    if "amr" in ANALYSIS_STEPS:
        TARGETS.append("amr_analysis.done")

#else:
#    raise Exception('You are not serious. No input data')
#        print("No input data provided")