Mercurial > repos > pjbriggs > amplicon_analysis_pipeline
comparison amplicon_analysis_pipeline.py @ 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 | a898ee628343 |
| children | 32a43bc3dd58 |
comparison
equal
deleted
inserted
replaced
| 7:1cd017d72920 | 8:8292f8262a9d |
|---|---|
| 93 fp.write("---- %d: %s\n" % (ix, | 93 fp.write("---- %d: %s\n" % (ix, |
| 94 os.path.relpath(f,results_dir))) | 94 os.path.relpath(f,results_dir))) |
| 95 # Close output file | 95 # Close output file |
| 96 if filen is not None: | 96 if filen is not None: |
| 97 fp.close() | 97 fp.close() |
| 98 | |
| 99 def find_executable(name): | |
| 100 # Locate executable on PATH | |
| 101 for p in os.environ['PATH'].split(os.pathsep): | |
| 102 exe = os.path.join(name) | |
| 103 if os.path.isfike(exe) os.access(exe,os.X_OK): | |
| 104 return exe | |
| 105 return None | |
| 98 | 106 |
| 99 if __name__ == "__main__": | 107 if __name__ == "__main__": |
| 100 # Command line | 108 # Command line |
| 101 print "Amplicon analysis: starting" | 109 print "Amplicon analysis: starting" |
| 102 p = argparse.ArgumentParser() | 110 p = argparse.ArgumentParser() |
| 156 ref_database = "silva" | 164 ref_database = "silva" |
| 157 elif args.use_homd: | 165 elif args.use_homd: |
| 158 ref_database = "homd" | 166 ref_database = "homd" |
| 159 else: | 167 else: |
| 160 ref_database = "gg" | 168 ref_database = "gg" |
| 169 | |
| 170 # Executables | |
| 171 os.mkdir("bin") | |
| 172 os.environ["PATH"] = os.path.abspath("bin") + \ | |
| 173 os.pathsep + \ | |
| 174 os.environ["PATH"]) | |
| 175 print "-- updated PATH: %s" % os.environ["PATH"] | |
| 176 # Pipeline wants 'vsearch113' but bioconda version is just | |
| 177 # 'vsearch' | |
| 178 vsearch = find_executable("vsearch113") | |
| 179 if vsearch is None: | |
| 180 vsearch = find_executable("vsearch") | |
| 181 if vsearch: | |
| 182 os.symlink(vsearch,os.path.join("bin","vsearch113")) | |
| 183 print "-- made symlink to %s" % vsearch | |
| 184 else: | |
| 185 sys.stderr.write("Missing 'vsearch[113]'\n") | |
| 186 # Pipeline wants 'fasta-splitter.pl' but bioconda provides | |
| 187 # 'fasta-splitter' | |
| 188 fasta_splitter = find_executable("fasta-splitter.pl") | |
| 189 if fasta_splitter is None: | |
| 190 fasta_splitter = os.path.readlink( | |
| 191 find_executable("fasta-splitter")) | |
| 192 if fasta_splitter: | |
| 193 os.symlink(vsearch,os.path.join("bin","fasta-splitter.pl")) | |
| 194 else: | |
| 195 sys.stderr.write("Missing 'fasta-splitter[.pl]'\n") | |
| 161 | 196 |
| 162 # Construct the pipeline command | 197 # Construct the pipeline command |
| 163 print "Amplicon analysis: constructing pipeline command" | 198 print "Amplicon analysis: constructing pipeline command" |
| 164 pipeline = PipelineCmd("Amplicon_analysis_pipeline.sh") | 199 pipeline = PipelineCmd("Amplicon_analysis_pipeline.sh") |
| 165 if args.forward_pcr_primer: | 200 if args.forward_pcr_primer: |
