diff amplicon_analysis_pipeline.py @ 1:1c1902e12caf draft

Updated to version 1.2.1.0
author pjbriggs
date Wed, 25 Apr 2018 03:54:00 -0400
parents 47ec9c6f44b8
children 3ab198df8f3f
line wrap: on
line diff
--- a/amplicon_analysis_pipeline.py	Thu Nov 09 10:13:29 2017 -0500
+++ b/amplicon_analysis_pipeline.py	Wed Apr 25 03:54:00 2018 -0400
@@ -120,6 +120,7 @@
                    type=str.lower,
                    default="vsearch")
     p.add_argument("-S",dest="use_silva",action="store_true")
+    p.add_argument("-H",dest="use_homd",action="store_true")
     p.add_argument("-r",dest="reference_data_path")
     p.add_argument("-c",dest="categories_file")
     args = p.parse_args()
@@ -150,6 +151,14 @@
             final_name.write("%s\n" % '\t'.join((r2,sample_name)))
             sample_names.append(sample_name)
 
+    # Reference database
+    if args.use_silva:
+        ref_database = "silva"
+    elif args.use_homd:
+        ref_database = "homd"
+    else:
+        ref_database = "gg"
+
     # Construct the pipeline command
     print "Amplicon analysis: constructing pipeline command"
     pipeline = PipelineCmd("Amplicon_analysis_pipeline.sh")
@@ -168,8 +177,10 @@
     if args.reference_data_path:
         pipeline.add_args("-r",args.reference_data_path)
     pipeline.add_args("-P",args.pipeline)
-    if args.use_silva:
+    if ref_database == "silva":
         pipeline.add_args("-S")
+    elif ref_database == "homd":
+        pipeline.add_args("-H")
 
     # Echo the pipeline command to stdout
     print "Running %s" % pipeline
@@ -190,6 +201,7 @@
         except Exception as ex:
             # Some other problem
             sys.stderr.write("Unexpected error: %s\n" % str(ex))
+            exit_code = 1
 
     # Write out the list of outputs
     outputs_file = "Pipeline_outputs.txt"
@@ -298,8 +310,7 @@
         boxplots_dir = os.path.abspath(
             os.path.join("RESULTS",
                          "%s_%s" % (args.pipeline.title(),
-                                    ("gg" if not args.use_silva
-                                     else "silva")),
+                                    ref_database),
                          "Alpha_diversity",
                          "Alpha_diversity_boxplot",
                          "Categories_shannon"))