comparison strelka_wrapper.py @ 7:3e8541ece3c7

trying to fix environment variable 0.0.1
author mini
date Fri, 26 Sep 2014 14:30:27 +0200
parents 87568e5a7d4f
children 2cee4ed50058
comparison
equal deleted inserted replaced
6:87568e5a7d4f 7:3e8541ece3c7
24 24
25 def _create_config(args, config_path): 25 def _create_config(args, config_path):
26 conf_file = open(config_path, "w") 26 conf_file = open(config_path, "w")
27 conf_file.write("[user]\n") 27 conf_file.write("[user]\n")
28 for option in args: 28 for option in args:
29 if not option in ["tumorBam", "normalBam", "refFile", "configFile"] and args[option]!=None: 29 if not option in ["tumorBam", "normalBam", "refFile", "configFile", "scriptPath"] and args[option]!=None:
30 conf_file.write("%s=%s\n" % (option, args[option])) 30 conf_file.write("%s=%s\n" % (option, args[option]))
31 conf_file.close() 31 conf_file.close()
32 32
33 def my_Popen(cmd, prefix_for_stderr_name, tmp_dir, msg_error): 33 def my_Popen(cmd, prefix_for_stderr_name, tmp_dir, msg_error):
34 stderr_name = tempfile.NamedTemporaryFile( prefix = prefix_for_stderr_name ).name 34 stderr_name = tempfile.NamedTemporaryFile( prefix = prefix_for_stderr_name ).name
62 my_Popen( command, "fasta_index_stderr", tmp_dir, "Error during indexation of fasta file :" + fasta_filename) 62 my_Popen( command, "fasta_index_stderr", tmp_dir, "Error during indexation of fasta file :" + fasta_filename)
63 63
64 def __main__(): 64 def __main__():
65 #Parse Command Line OPTPARSE DEPRECIATED USE ARGPARSE INSTEAD 65 #Parse Command Line OPTPARSE DEPRECIATED USE ARGPARSE INSTEAD
66 #MKTEMP DEPRECIATED USE MKDTlizations#EMP INSTEAD 66 #MKTEMP DEPRECIATED USE MKDTlizations#EMP INSTEAD
67
68 root_dir= "/home/galaxyusr/data/galaxy_dist/tools/strelka2"
69 expected_dir="for_tests"
70 job_dir=os.getcwd()
71 analysis_dir=job_dir + "/StrelkaAnalysis"
72 config_script=root_dir + "/configureStrelkaWorkflow.pl"
73 tmp_dir = "tmp" #tempfile.mkdtemp( prefix='tmp-strelkaAnalysis-' )
74 config_ini = "%s/config.ini" % (tmp_dir)
75
76 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)
77
78 #manage parsing 67 #manage parsing
79 parser = argparse.ArgumentParser() 68 parser = argparse.ArgumentParser()
80 parser.add_argument( '-t', '--tumorBam', help='path to tumor bam file', required = False ) 69 parser.add_argument( '-t', '--tumorBam', help='path to tumor bam file', required = False )
81 parser.add_argument( '-n', '--normalBam', help='path to tumor bam file', required = False ) 70 parser.add_argument( '-n', '--normalBam', help='path to tumor bam file', required = False )
82 parser.add_argument( '-r', '--refFile', help='path to tumor bam file', required = False ) 71 parser.add_argument( '-r', '--refFile', help='path to tumor bam file', required = False )
99 parser.add_argument( '--isWriteRealignedBam', help='path to tumor bam file', required = False ) 88 parser.add_argument( '--isWriteRealignedBam', help='path to tumor bam file', required = False )
100 parser.add_argument( '--binSize', help='path to tumor bam file', required = False ) 89 parser.add_argument( '--binSize', help='path to tumor bam file', required = False )
101 parser.add_argument( '--extraStrelkaArguments', help='path to tumor bam file', required = False ) 90 parser.add_argument( '--extraStrelkaArguments', help='path to tumor bam file', required = False )
102 parser.add_argument( '--isSkipDepthFilters', help='path to tumor bam file', required = False ) 91 parser.add_argument( '--isSkipDepthFilters', help='path to tumor bam file', required = False )
103 parser.add_argument( '--maxInputDepth', help='path to tumor bam file', required = False ) 92 parser.add_argument( '--maxInputDepth', help='path to tumor bam file', required = False )
93 parser.add_argument( '--scriptPath', help='path to tumor bam file', required = False )
104 args = parser.parse_args() 94 args = parser.parse_args()
95
96 root_dir= SCRIPT_PATH
97 expected_dir="for_tests"
98 job_dir=os.getcwd()
99 analysis_dir=job_dir + "/StrelkaAnalysis"
100 config_script=root_dir + "/configureStrelkaWorkflow.pl"
101 tmp_dir = "tmp" #tempfile.mkdtemp( prefix='tmp-strelkaAnalysis-' )
102 config_ini = "%s/config.ini" % (tmp_dir)
103
104 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)
105
105 106
106 #verifying eveything's ok 107 #verifying eveything's ok
107 if not os.path.isfile(config_script): 108 if not os.path.isfile(config_script):
108 sys.exit("ERROR: The strelka workflow must be built prior to running. See installation instructions in '$root_dir/README'") 109 sys.exit("ERROR: The strelka workflow must be built prior to running. See installation instructions in '$root_dir/README'")
109 print("configuring...", file=sys.stdout) 110 print("configuring...", file=sys.stdout)