From a57d78cd9bf0824b362f1374e082c3f312083904 Mon Sep 17 00:00:00 2001 From: Guruprasad Anada Date: Fri, 21 Mar 2008 15:51:40 +0000 Subject: [PATCH] Changes to liftOver tool: Modified the liftOver.loc file and changed the script files as required. --- tools/extract/liftOver_wrapper.py | 19 ++++--------------- tools/extract/liftOver_wrapper.xml | 4 ++-- tools/extract/liftOver_wrapper_code.py | 7 +++++-- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/tools/extract/liftOver_wrapper.py b/tools/extract/liftOver_wrapper.py index 87e6e619758..94117835a65 100644 --- a/tools/extract/liftOver_wrapper.py +++ b/tools/extract/liftOver_wrapper.py @@ -17,28 +17,17 @@ infile = sys.argv[1] outfile1 = sys.argv[2] outfile2 = sys.argv[3] in_dbkey = sys.argv[4] -out_dbkey = sys.argv[5] +mapfilepath = sys.argv[5] -#ensure dbkeys are set +#ensure dbkey is set if in_dbkey == "?": stop_err( "Input dataset genome build unspecified, click the pencil icon in hte history item to specify it." ) -if out_dbkey == "?": - stop_err( "No build selected for conversion." ) -#Check if the Mapping file exists -#example file path: hg18ToHg17.over.chain -mapfilename = in_dbkey + "To" + out_dbkey.capitalize() + ".over.chain" -# TODO: Ticket # 167 - These hard-coded paths need to be removed -mapfilepath = "/depot/data2/galaxy/" + in_dbkey + "/liftOver/" + mapfilename cmd_line = "liftOver " + infile + " " + mapfilepath + " " + outfile1 + " " + outfile2 + " > /dev/null 2>&1" if not os.path.isfile( mapfilepath ): - stop_err( "Mapping information from %s to %s is not currently available." % ( in_dbkey, out_dbkey ) ) + stop_err( "%s mapping is not currently available." % ( mapfilepath.split('/')[-1].split('.')[0] ) ) try: os.system( cmd_line ) except Exception, exc: - stop_err( "Exception caught attempting conversion: %s" % str( exc ) ) - -print "%s converted to %s" % ( in_dbkey, out_dbkey ) - - + stop_err( "Exception caught attempting conversion: %s" % str( exc ) ) \ No newline at end of file diff --git a/tools/extract/liftOver_wrapper.xml b/tools/extract/liftOver_wrapper.xml index 78c85ccdd3c..4d0df852098 100644 --- a/tools/extract/liftOver_wrapper.xml +++ b/tools/extract/liftOver_wrapper.xml @@ -6,7 +6,7 @@ - + @@ -19,7 +19,7 @@ - + diff --git a/tools/extract/liftOver_wrapper_code.py b/tools/extract/liftOver_wrapper_code.py index 0d7ec90629a..4f8fd4fb921 100644 --- a/tools/extract/liftOver_wrapper_code.py +++ b/tools/extract/liftOver_wrapper_code.py @@ -1,6 +1,9 @@ def exec_before_job(app, inp_data, out_data, param_dict, tool): - out_data['out_file1'].set_dbkey(param_dict['to_dbkey']) - out_data['out_file2'].set_dbkey(param_dict['to_dbkey']) + #Assuming the path of the form liftOverDirectory/hg18ToHg17.over.chain (This is how the mapping chain files from UCSC look.) + to_dbkey = param_dict['to_dbkey'].split('.')[0].split('To')[1] + to_dbkey = to_dbkey[0].lower()+to_dbkey[1:] + out_data['out_file1'].set_dbkey(to_dbkey) + out_data['out_file2'].set_dbkey(to_dbkey) out_data['out_file1'].name = out_data['out_file1'].name + " [ MAPPED COORDINATES ]" out_data['out_file2'].name = out_data['out_file2'].name + " [ UNMAPPED COORDINATES ]"