changeset 8:8292f8262a9d draft

planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit f72ff88ee11d09703bf38524dbb8026ee14bc3ef-dirty
author pjbriggs
date Mon, 18 Jun 2018 07:12:56 -0400
parents 1cd017d72920
children 32a43bc3dd58
files amplicon_analysis_pipeline.py
diffstat 1 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/amplicon_analysis_pipeline.py	Mon Jun 18 05:48:24 2018 -0400
+++ b/amplicon_analysis_pipeline.py	Mon Jun 18 07:12:56 2018 -0400
@@ -96,6 +96,14 @@
     if filen is not None:
         fp.close()
 
+def find_executable(name):
+    # Locate executable on PATH
+    for p in os.environ['PATH'].split(os.pathsep):
+        exe = os.path.join(name)
+        if os.path.isfike(exe) os.access(exe,os.X_OK):
+            return exe
+    return None
+
 if __name__ == "__main__":
     # Command line
     print "Amplicon analysis: starting"
@@ -159,6 +167,33 @@
     else:
         ref_database = "gg"
 
+    # Executables
+    os.mkdir("bin")
+    os.environ["PATH"] = os.path.abspath("bin") + \
+                         os.pathsep + \
+                         os.environ["PATH"])
+    print "-- updated PATH: %s" % os.environ["PATH"]
+    # Pipeline wants 'vsearch113' but bioconda version is just
+    # 'vsearch'
+    vsearch = find_executable("vsearch113")
+    if vsearch is None:
+        vsearch = find_executable("vsearch")
+    if vsearch:
+        os.symlink(vsearch,os.path.join("bin","vsearch113"))
+        print "-- made symlink to %s" % vsearch
+    else:
+        sys.stderr.write("Missing 'vsearch[113]'\n")
+    # Pipeline wants 'fasta-splitter.pl' but bioconda provides
+    # 'fasta-splitter'
+    fasta_splitter = find_executable("fasta-splitter.pl")
+    if fasta_splitter is None:
+        fasta_splitter = os.path.readlink(
+            find_executable("fasta-splitter"))
+    if fasta_splitter:
+        os.symlink(vsearch,os.path.join("bin","fasta-splitter.pl"))
+    else:
+        sys.stderr.write("Missing 'fasta-splitter[.pl]'\n")
+
     # Construct the pipeline command
     print "Amplicon analysis: constructing pipeline command"
     pipeline = PipelineCmd("Amplicon_analysis_pipeline.sh")