Combine_MGE_AMR.smk 2.13 KB
Newer Older
Laura Denies's avatar
Laura Denies committed
1
2
3
4
5
6
7
8
9
10
#AMR

import glob
import os

##########################
#     AMR Prediction     #
##########################

rule combine_AMR_plasmid:
11
    input:
12
13
        AMR="{datadir}/{project}/AMR/deepARG_results/{sample}.out.mapping.ARG",
        AMR_translation="{datadir}/{project}/renamed/{sample}_translation.tsv",
Laura Denies's avatar
Laura Denies committed
14
        Plasmid="{datadir}/{project}/MGE/plasmid/PlasFlow/{sample}_plasflow_prediction_final.tsv",
15
        Contig_translation="{datadir}/{project}/renamed/{sample}_Contig_translation.tsv",
16
        Contig_gene_list="{datadir}/{project}/Prodigal/{sample}.contig",
17
18
        VirFinder="{datadir}/{project}/MGE/phage/{sample}_VirFinder_aggregated.csv",
        VirSorter="{datadir}/{project}/MGE/phage/{sample}_VIRSorter_aggregated.csv"
19
    output:    
20
21
        Report_1=temp("{datadir}/{project}/AMR/{sample}_MGE_AMR_prediction_detail_temp.csv"),
        Report_2=temp("{datadir}/{project}/AMR/{sample}_MGE_AMR_prediction_report_temp.csv")
22
    log:
23
        "{datadir}/{project}/AMR/{sample}_MGE_AMR_prediction_detail_temp.log"
24
    params:
25
26
27
        outdir="{datadir}",
        runtime=config["pathofact"]["runtime"]["medium"],
        mem=config["pathofact"]["mem"]["normal_mem_per_core_gb"]
28
29
30
31
    conda:
        "../../envs/R.yaml"
    script:
        "../../scripts/AMR_MGE.R"
Laura Denies's avatar
Laura Denies committed
32
33

rule modify_details:
34
    input:
35
        "{datadir}/{project}/AMR/{sample}_MGE_AMR_prediction_detail_temp.csv"
36
    output:
37
        "{datadir}/{project}/AMR/{sample}_AMR_MGE_prediction_detailed.tsv"
38
    params:
39
40
41
        outdir="{datadir}",
        runtime=config["pathofact"]["runtime"]["short"],
        mem=config["pathofact"]["mem"]["normal_mem_per_core_gb"]
42
43
    shell:
        """
44
        sed 's/"//g' {input} | sed 's/,/\\t/g' > {output}
45
        """
Laura Denies's avatar
Laura Denies committed
46

47
48
rule modify_report:
    input:
49
        "{datadir}/{project}/AMR/{sample}_MGE_AMR_prediction_report_temp.csv"
50
    output:
51
        "{datadir}/{project}/AMR_MGE_prediction_{sample}_report.tsv"
52
    params:
53
54
55
        outdir="{datadir}",
        runtime=config["pathofact"]["runtime"]["short"],
        mem=config["pathofact"]["mem"]["normal_mem_per_core_gb"]
56
57
    shell:
        """
58
        sed 's/"//g' {input} | sed 's/,/\\t/g' > {output}
59
        """