From 2ab9da0b648627d54de4dd08af0480ec8f1d6bf6 Mon Sep 17 00:00:00 2001
From: Valentina Galata <valentina.galata@uni.lu>
Date: Wed, 3 Jun 2020 12:40:00 +0200
Subject: [PATCH] made FAA temp in rgi input rules; other minor changes (issue
 #29)

---
 2019_GDB/rules/ANALYSIS_RULES | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/2019_GDB/rules/ANALYSIS_RULES b/2019_GDB/rules/ANALYSIS_RULES
index b1811a2..7888a28 100755
--- a/2019_GDB/rules/ANALYSIS_RULES
+++ b/2019_GDB/rules/ANALYSIS_RULES
@@ -233,6 +233,7 @@ rule plasflow:
 # RGI #
 #######
 # RGI input: proteins
+# NOTE: remove stop codon symbol "*"
 # NOTE: one rule per assembly to have a workaround for the issue with file paths
 #       should be resolved properly later
 rule rgi_input_flye:
@@ -247,7 +248,7 @@ rule rgi_input_metaspades_hybrid:
     input:
         os.path.abspath(os.path.join(RESULTS_DIR, "annotation/proteins/metaspades_hybrid/lr_no_barcode-sr_ONT3_MG_xx_Rashi_S11/contigs.faa"))
     output:
-        os.path.join(RESULTS_DIR, "analysis/rgi/metaspades_hybrid.faa")
+        temp(os.path.join(RESULTS_DIR, "analysis/rgi/metaspades_hybrid.faa"))
     shell:
         "sed 's/\*$//' {input} > {output}"
 
@@ -255,7 +256,7 @@ rule rgi_input_metaspades:
     input:
         os.path.abspath(os.path.join(RESULTS_DIR, "annotation/proteins/metaspades/ONT3_MG_xx_Rashi_S11/final.contigs.faa"))
     output:
-        os.path.join(RESULTS_DIR, "analysis/rgi/metaspades.faa")
+        temp(os.path.join(RESULTS_DIR, "analysis/rgi/metaspades.faa"))
     shell:
         "sed 's/\*$//' {input} > {output}"
 
@@ -263,7 +264,7 @@ rule rgi_input_megahit:
     input:
         os.path.abspath(os.path.join(RESULTS_DIR, "annotation/proteins/megahit/ONT3_MG_xx_Rashi_S11/final.contigs.faa"))
     output:
-        os.path.join(RESULTS_DIR, "analysis/rgi/megahit.faa")
+        temp(os.path.join(RESULTS_DIR, "analysis/rgi/megahit.faa"))
     shell:
         "sed 's/\*$//' {input} > {output}"
 
@@ -300,10 +301,11 @@ rule rgi_prot:
     message:
         "AMR prediction w/ RGI: {input}"
     shell:
+        # NOTE: to make sure that the correct DB is used
         "rgi clean --local &> {log} && "
         "rgi load --card_json {input.db} --local &>> {log} && "
         "rgi database --version --local &>> {log} && "
-        # NOTE: https://github.com/arpcard/rgi/issues/93
+        # NOTE: https://github.com/arpcard/rgi/issues/93: KeyError: 'snp'
         #       need to run the CMD twice
         "rgi main --input_sequence {input.faa} --output_file {params.obname} --input_type protein --local -a {params.alignment_tool} --clean -n {threads} &>> {log} || "
         "rgi main --input_sequence {input.faa} --output_file {params.obname} --input_type protein --local -a {params.alignment_tool} --clean -n {threads} &>> {log}"
-- 
GitLab