Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
analysis.smk 2.81 KiB
# For running the ANALYSIS "workflow"

import os
from tempfile import TemporaryDirectory

# configfile: "config/CONFIG.yaml"
# DATA_DIR = config["data_dir"]
# RESULTS_DIR = config["results_dir"]
# DB_DIR=config["db_dir"]
# BARCODES=config["barcodes"]
# #ASSEMBLERS=config["assemblers"]
# MAPPERS=["bwa", "mmi"]
# # SAMPLES=config["samples"]
# #SAMPLES=["flye", "megahit", "metaspades_hybrid"]
# BINNING_SAMPLES=config["binning_samples"]
# HYBRID_ASSEMBLER=config["hybrid_assembler"]


# specify which rules to run
include:
    '../rules/ANALYSIS_RULES'

# Rule all for running the analysing partial gene counts in prodigal and unique gene counts with cd-hit on the proteins
rule CDHIT:    
    input:
        expand(os.path.join(RESULTS_DIR, "analysis/cdhit/cdhit_compare.done")), 
        expand(os.path.join(RESULTS_DIR, "analysis/quast/report.txt"))
    output:
        touch('cdhit_analysis.done')

rule MAPPABILITY:
    input:
        expand(os.path.join(RESULTS_DIR, "analysis/mappability_index/mi_{mapping_sample}.txt"), mapping_sample=["flye", "megahit", "bwa_merged_metaspades_hybrid"]),
        expand(os.path.join(RESULTS_DIR, "analysis/mappability_index/mi_{metaT_sample}_reads-x-{metaT_mapping_sample}.txt"), metaT_sample="FastSelectHalf1_MT_Rashi_S12", sr_sample="ONT3_MG_xx_Rashi_S11", metaT_mapping_sample=["lr_no_barcode_sr_ONT3_MG_xx_Rashi_S11-metaspades_hybrid", "ONT3_MG_xx_Rashi_S11-megahit"]),
        expand(os.path.join(RESULTS_DIR, "analysis/mappability_index/{mapping_sample}_counts.txt"), mapping_sample=["flye", "megahit", "bwa_merged_metaspades_hybrid"]),
        expand(os.path.join(RESULTS_DIR, "analysis/mappability_index/{metaT_sample}_reads-x-{metaT_mapping_sample}_counts.txt"), metaT_sample="FastSelectHalf1_MT_Rashi_S12", sr_sample="ONT3_MG_xx_Rashi_S11", metaT_mapping_sample=["lr_no_barcode_sr_ONT3_MG_xx_Rashi_S11-metaspades_hybrid", "ONT3_MG_xx_Rashi_S11-megahit"]),
        expand(os.path.join(RESULTS_DIR, "analysis/mappability_index/{mapping_sample}_unique_read_count.txt"), mapping_sample=["flye", "megahit", "bwa_merged_metaspades_hybrid"])
    output:
        touch('mappability_index.done')

rule CRISPR:
    input:
        expand(os.path.join(RESULTS_DIR, "analysis/crispr/casc/{assembly}_casc_output/{assembly}.results.txt"), assembly=["flye", "megahit", "metaspades", "metaspades_hybrid"]),
        expand(os.path.join(RESULTS_DIR, "analysis/crispr/minced/{assembly}.txt"), assembly=["flye", "megahit", "metaspades", "metaspades_hybrid"])
    output:
        touch('crispr_analysis.done')

rule PLASMIDS:
    input:
        expand(os.path.join(RESULTS_DIR, "analysis/plasflow/{assembly}.tsv"), assembly=ASSEMBLERS)
    output:
        touch('plasmids_analysis.done')

rule AMR:
    input:
        expand(os.path.join(RESULTS_DIR, "analysis/rgi/{assembly}.txt"), assembly=ASSEMBLERS)
    output:
        touch('amr_analysis.done')