From c41b730f7ccf9b8de4753e32db21cac2baec11d8 Mon Sep 17 00:00:00 2001 From: Kelly Vincent Date: Thu, 1 Oct 2009 13:16:43 -0400 Subject: [PATCH] Updated BWA and Bowtie wrapper tools so that the dbkey of the output is correctly assigned --- tools/sr_mapping/bowtie_wrapper.xml | 2 +- tools/sr_mapping/bowtie_wrapper_code.py | 15 +++++++++++++++ tools/sr_mapping/bwa_wrapper.xml | 2 -- tools/sr_mapping/bwa_wrapper_code.py | 7 +++++-- 4 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 tools/sr_mapping/bowtie_wrapper_code.py diff --git a/tools/sr_mapping/bowtie_wrapper.xml b/tools/sr_mapping/bowtie_wrapper.xml index acbc1c7719e..f77c9973914 100644 --- a/tools/sr_mapping/bowtie_wrapper.xml +++ b/tools/sr_mapping/bowtie_wrapper.xml @@ -152,7 +152,6 @@ - @@ -540,4 +539,5 @@ For aligning (bowtie):: --seed <int> Random seed. Use <int> as the seed for the pseudo-random number generator. [off] + diff --git a/tools/sr_mapping/bowtie_wrapper_code.py b/tools/sr_mapping/bowtie_wrapper_code.py new file mode 100644 index 00000000000..21a8f6b44eb --- /dev/null +++ b/tools/sr_mapping/bowtie_wrapper_code.py @@ -0,0 +1,15 @@ +import os + +def exec_before_job(app, inp_data, out_data, param_dict, tool): + try: + refFile = param_dict['refGenomeSource']['indices'].value + dbkey = os.path.split(refFile)[1].split('.')[0] + # deal with the one odd case + if dbkey.find('chrM') >= 0: + dbkey = 'equCab2' + out_data['output'].set_dbkey(dbkey) + except: + try: + refFile = param_dict['refGenomeSource']['ownFile'].dbkey + except: + out_data['output'].set_dbkey('?') diff --git a/tools/sr_mapping/bwa_wrapper.xml b/tools/sr_mapping/bwa_wrapper.xml index ccfb55bb26b..41fefbabd47 100644 --- a/tools/sr_mapping/bwa_wrapper.xml +++ b/tools/sr_mapping/bwa_wrapper.xml @@ -80,7 +80,6 @@ - @@ -100,7 +99,6 @@ - diff --git a/tools/sr_mapping/bwa_wrapper_code.py b/tools/sr_mapping/bwa_wrapper_code.py index a8e19e6bc77..cecaa528838 100644 --- a/tools/sr_mapping/bwa_wrapper_code.py +++ b/tools/sr_mapping/bwa_wrapper_code.py @@ -4,5 +4,8 @@ def exec_before_job(app, inp_data, out_data, param_dict, tool): try: refFile = param_dict['solidOrSolexa']['solidRefGenomeSource']['indices'].value out_data['output'].set_dbkey(os.path.split(refFile)[1].split('.')[0]) - except Exception, eq: - out_data['output'].set_dbkey(param_dict['dbkey']) + except: + try: + refFile = param_dict['solidOrSolexa']['solidRefGenomeSource']['ownFile'].dbkey + except: + out_data['output'].set_dbkey('?')