Mercurial > repos > mini > strelka
comparison strelka_wrapper.py @ 14:ca84a74ff567
corriging bug in environment variable
| author | mini |
|---|---|
| date | Wed, 01 Oct 2014 12:21:13 +0200 |
| parents | 137e05f24336 |
| children | 8260a4188b08 |
comparison
equal
deleted
inserted
replaced
| 12:3421b0fbec61 | 14:ca84a74ff567 |
|---|---|
| 5 #For Geviteam 2014 | 5 #For Geviteam 2014 |
| 6 | 6 |
| 7 """ | 7 """ |
| 8 A wrapper script for running the GenomeAnalysisTK.jar commands. | 8 A wrapper script for running the GenomeAnalysisTK.jar commands. |
| 9 """ | 9 """ |
| 10 | |
| 11 from __future__ import print_function | 10 from __future__ import print_function |
| 12 import sys, argparse, os, tempfile, subprocess, shutil | 11 import sys, argparse, os, tempfile, subprocess, shutil |
| 13 from binascii import unhexlify | 12 from binascii import unhexlify |
| 14 from string import Template | 13 from string import Template |
| 15 from galaxy import eggs | 14 from galaxy import eggs |
| 56 #need to index this bam file | 55 #need to index this bam file |
| 57 command = 'samtools faidx %s %s' % ( fasta_filename, fasta_index_filename ) | 56 command = 'samtools faidx %s %s' % ( fasta_filename, fasta_index_filename ) |
| 58 my_Popen( command, "fasta_index_stderr", tmp_dir, "Error during indexation of fasta file :" + fasta_filename) | 57 my_Popen( command, "fasta_index_stderr", tmp_dir, "Error during indexation of fasta file :" + fasta_filename) |
| 59 | 58 |
| 60 def __main__(): | 59 def __main__(): |
| 61 | |
| 62 #Manage options | 60 #Manage options |
| 63 parser = argparse.ArgumentParser() | 61 parser = argparse.ArgumentParser() |
| 64 parser.add_argument( '-t', '--tumorBam', help='path to tumor bam file', required = False ) | 62 parser.add_argument( '-t', '--tumorBam', help='path to tumor bam file', required = False ) |
| 65 parser.add_argument( '-n', '--normalBam', help='path to tumor bam file', required = False ) | 63 parser.add_argument( '-n', '--normalBam', help='path to tumor bam file', required = False ) |
| 66 parser.add_argument( '-r', '--refFile', help='path to tumor bam file', required = False ) | 64 parser.add_argument( '-r', '--refFile', help='path to tumor bam file', required = False ) |
| 94 analysis_dir=job_dir + "/StrelkaAnalysis" | 92 analysis_dir=job_dir + "/StrelkaAnalysis" |
| 95 config_script=root_dir + "/configureStrelkaWorkflow.pl" | 93 config_script=root_dir + "/configureStrelkaWorkflow.pl" |
| 96 tmp_dir = tempfile.mkdtemp( prefix='tmp-strelkaAnalysis-' ) | 94 tmp_dir = tempfile.mkdtemp( prefix='tmp-strelkaAnalysis-' ) |
| 97 config_ini = "%s/config.ini" % (tmp_dir) | 95 config_ini = "%s/config.ini" % (tmp_dir) |
| 98 | 96 |
| 99 #print("root_dir: " + root_dir + "\njob_dir :" + job_dir + "\nanalysis_dir :" + analysis_dir + "\nconfig_script :" + config_script + "\ntmp_dir :" + tmp_dir + "\nconfig_ini :" + config_ini) | 97 print("root_dir: " + root_dir + "\njob_dir :" + job_dir + "\nanalysis_dir :" + analysis_dir + "\nconfig_script :" + config_script + "\ntmp_dir :" + tmp_dir + "\nconfig_ini :" + config_ini) |
| 100 | 98 |
| 101 | 99 |
| 102 #verifying eveything's ok | 100 #verifying eveything's ok |
| 103 if not os.path.isfile(config_script): | 101 if not os.path.isfile(config_script): |
| 104 sys.exit("ERROR: The strelka workflow must be built prior to running. See installation instructions in '$root_dir/README'") | 102 sys.exit("ERROR: The strelka workflow must be built prior to running. See installation instructions in '$root_dir/README'") |
| 140 print("**** starting workflow.") | 138 print("**** starting workflow.") |
| 141 print("**** workflow cmd: '" + cmd + "'") | 139 print("**** workflow cmd: '" + cmd + "'") |
| 142 my_Popen( cmd, "workflow_stderr", tmp_dir, "Error during workflow execution !") | 140 my_Popen( cmd, "workflow_stderr", tmp_dir, "Error during workflow execution !") |
| 143 print("**** completed workflow execution") | 141 print("**** completed workflow execution") |
| 144 | 142 |
| 143 if __name__=='__main__': | |
| 144 __main__() |
