diff --git a/tools/metaphlan3/metaphlan/paired/Snakefile b/tools/metaphlan3/metaphlan/paired/Snakefile index 55175901ad8cbe8aeb75453808d1b82196aa7810..87f4be7df06dcb1039952d068ae2e1d81500f668 100644 --- a/tools/metaphlan3/metaphlan/paired/Snakefile +++ b/tools/metaphlan3/metaphlan/paired/Snakefile @@ -18,7 +18,7 @@ rule metaphlan3_paired: r1 = __metaphlan3_input_r1, r2 = __metaphlan3_input_r2 output: - profile = __metaphlan3_output, + profile = __metaphlan3_output_profile, bowtie2out = __metaphlan3_output_bowtie2out, sams = __metaphlan3_output_sams params: diff --git a/workflows/metaphlan3/README.md b/workflows/metaphlan3/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d1dc622811d5afaaa9d0b68b0fe592de77a0cfbb --- /dev/null +++ b/workflows/metaphlan3/README.md @@ -0,0 +1,8 @@ +# Simple metaphlan3 workflows + +Workflows using metaphlan3 and simple visualization of the results. + +All examples presented were made for our TARS cluster system. This means you will be likely to find some +absolute path into the `config.yaml` that you might not have access to. + +For every workflow, an example is provided and is based on the `config.yaml` file. Singularity images are necessary for these examples. diff --git a/workflows/metaphlan3/paired_metaphlan2/Snakefile b/workflows/metaphlan3/paired_metaphlan2/Snakefile new file mode 100644 index 0000000000000000000000000000000000000000..914d5c85460285996acbdae8baf53da266746cd5 --- /dev/null +++ b/workflows/metaphlan3/paired_metaphlan2/Snakefile @@ -0,0 +1,56 @@ +configfile: "config.yaml" + +# ==== Snakefile paths ==== +__metaphlan3_rules = config.get("snakefiles", {}).get("metaphlan3", "../../tools/metaphlan2/metaphlan2/Snakefile") +__metaphlan2_merge_rules = config.get("snakefiles", {}).get("metaphlan2_merge", "../../tools/metaphlan2/metaphlan2_merge/Snakefile") +__metaphlan2_heatmap_rules = config.get("snakefiles", {}).get("metaphlan2_heatmap", "../../tools/metaphlan2/metaphlan2_heatmap/Snakefile") +__graphlan_from_metaphlan2_rules = config.get("snakefiles", {}).get("graphlan_from_metaphlan2", "../subworkflows/graphlan_from_metaphlan2/Snakefile") + +__input_dir = config['input_dir'] +__main_output_dir = config.get('output_dir', 'output') + +# ---- Metaphlan3 +__metaphlan3_output_dir = __main_output_dir + "/metaphlan3" +__metaphlan3_input_type = config['metaphlan3'].get('input_type', 'fastq') +__metaphlan3_input_r1 = "{dir}/{sample}{ext}".format(dir=__input_dir, + sample="{sample}", + ext="_1.fq.gz") +__metaphlan3_input_r2 = "{dir}/{sample}{ext}".format(dir=__input_dir, + sample="{sample}", + ext="_2.fq.gz") +__metaphlan3_output_profile = "{dir}/{sample}.profile.tsv".format(dir=__metaphlan3_output_dir, + sample="{sample}") +__metaphlan3_output_bowtie2out = "{output_dir}/{sample}.bowtie2.bz2".format(output_dir=__metaphlan3_output_dir, sample="{sample}") +__metaphlan3_output_sams = "{output_dir}/{sample}.sam.bz2".format(output_dir=__metaphlan3_output_dir, sample="{sample}") + +include: __metaphlan3_rules + +# ---- Metaphlan2 merge +__metaphlan2_merge_output_dir = __main_output_dir + "/metaphlan_merge" +__metaphlan2_merge_output_file_name = config['metaphlan2_merge'].get('output_file_name',"merged_taxonomic_profiles.txt") +__metaphlan2_merge_input = __metaphlan3_output_profile +__metaphlan2_merge_output = "{dir}/{file_name}".format(dir=__metaphlan2_merge_output_dir, + file_name=__metaphlan2_merge_output_file_name) +include: __metaphlan2_merge_rules + +# ---- Metaphlan2 heatmap +__metaphlan2_heatmap_output_dir = __main_output_dir + "/metaphlan2_heatmap" +__metaphlan2_heatmap_output_file_name = config['metaphlan2_heatmap'].get('output_name',"heatmap.png") +__metaphlan2_heatmap_input = __metaphlan2_merge_output +__metaphlan2_heatmap_output = "{dir}/{file_name}".format(dir=__metaphlan2_heatmap_output_dir, + file_name=__metaphlan2_heatmap_output_file_name) +include: __metaphlan2_heatmap_rules + +# ---- Graphlan Dendogram +__graphlan_from_metaphlan2_output_dir = __main_output_dir + "/graphlan" +__graphlan_from_metaphlan2_output_file_name = config.get("graphlan_from_metaphlan2", {}).get('output_name',"dendrogram.png") +__graphlan_from_metaphlan2_input = __metaphlan2_merge_output +__graphlan_from_metaphlan2_output = "{dir}/{file_name}".format(dir=__graphlan_from_metaphlan2_output_dir, + file_name=__graphlan_from_metaphlan2_output_file_name) +include: __graphlan_from_metaphlan2_rules + +rule all: + input: + heatmap = __metaphlan2_heatmap_output, + dendogram = __graphlan_from_metaphlan2_output + diff --git a/workflows/metaphlan3/paired_metaphlan2/config.yaml b/workflows/metaphlan3/paired_metaphlan2/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3f6af03fe172edc2f49883dc7477e760b3a52646 --- /dev/null +++ b/workflows/metaphlan3/paired_metaphlan2/config.yaml @@ -0,0 +1,43 @@ +snakefiles: + metaphlan3: /pasteur/zeus/projets/p02/metasig/gitlab/snakemake/tools/metaphlan3/metaphlan/paired/Snakefile + metaphlan2_merge: /pasteur/zeus/projets/p02/metasig/gitlab/snakemake/tools/metaphlan2/metaphlan2_merge/Snakefile + metaphlan2_heatmap: /pasteur/zeus/projets/p02/metasig/gitlab/snakemake/tools/metaphlan2/metaphlan2_heatmap/Snakefile + graphlan_from_metaphlan2: /pasteur/zeus/projets/p02/metasig/gitlab/snakemake/subworkflows/graphlan_from_metaphlan2/Snakefile + +samples: + - sample_1 + - sample_2 + - sample_2 + +input_dir: /a/path/to/input/data +output_dir: metaphlan2_output + +metaphlan3: + modules: singularity + threads: 4 + input_type: fastq + options: --bowtie2db /pasteur/gaia/projets/p01/Atm/DBs/bowtie2/metaphlan2/ + exec_command: singularity exec --bind /pasteur/ /pasteur/gaia/projets/p01/Atm/singularity/tools/metaphlan2/from_docker/metaphlan2_2.7.7_s3.2.1.simg metaphlan2.py + +metaphlan2_merge: + modules: singularity + exec_command: singularity exec --bind /pasteur/ /pasteur/gaia/projets/p01/Atm/singularity/tools/metaphlan2/from_docker/metaphlan2_2.7.7_s3.2.1.simg merge_metaphlan_tables.py + +metaphlan2_heatmap: + modules: singularity + exec_command: singularity exec --bind /pasteur/ /pasteur/gaia/projets/p01/Atm/singularity/tools/metaphlan2/from_docker/metaphlan2_2.6.0_s3.2.1.simg metaphlan_hclust_heatmap.py + output_name: snakemake_heatmap.png + +export2graphlan: + modules: singularity + exec_command: singularity exec --bind /pasteur/ /pasteur/gaia/projets/p01/Atm/singularity/tools/graphlan/from_docker/graphlan_0.9.7_s3.2.1.simg export2graphlan.py + options: "--skip_rows 1,2 --most_abundant 100 --abundance_threshold 1 --least_biomarkers 10 --annotations 5,6 --external_annotations 7 --min_clade_size 1" + +graphlan_annotate: + modules: singularity + exec_command: singularity exec --bind /pasteur/ /pasteur/gaia/projets/p01/Atm/singularity/tools/graphlan/from_docker/graphlan_0.9.7_s3.2.1.simg graphlan_annotate.py + +graphlan: + modules: singularity + exec_command: singularity exec --bind /pasteur/ /pasteur/gaia/projets/p01/Atm/singularity/tools/graphlan/from_docker/graphlan_0.9.7_s3.2.1.simg graphlan.py + options: "--dpi 300 --external_legends"