changeset 16:06f8b9c84b67 draft

Uploaded
author trinity_ctat
date Fri, 22 Jun 2018 12:31:25 -0400
parents ca57480062d1
children ed9a7b924391
files data_manager/add_ctat_lncrna_annotations.py
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/data_manager/add_ctat_lncrna_annotations.py	Fri Jun 22 12:24:02 2018 -0400
+++ b/data_manager/add_ctat_lncrna_annotations.py	Fri Jun 22 12:31:25 2018 -0400
@@ -13,7 +13,7 @@
 from datetime import *
 
 # Remove the following line when testing without galaxy package:
-# from galaxy.util.json import to_json_string
+from galaxy.util.json import to_json_string
 # Am not using the following:
 # from galaxy.util.json import from_json_string
 
@@ -245,10 +245,10 @@
     print "\nThe location of the Lncrna annotations is {:s}.\n".format(annotations_directory)
     files_in_annotations_directory = set(os.listdir(annotations_directory))
     annotations_file_found = False
-    annotations_file_path_mm9 = annotations_directory+"/annotations.config"
-    annotations_file_path_mm10 = annotations_directory+"/annotations.config"
-    annotations_file_path_hg19 = annotations_directory+"/annotations.config"
-    annotations_file_path_hg38 = annotations_directory+"/annotations.config"
+    annotations_file_path_mm9 = annotations_directory+"/annotations_abs_paths.config"
+    annotations_file_path_mm10 = annotations_directory+"/annotations_abs_paths.config"
+    annotations_file_path_hg19 = annotations_directory+"/annotations_abs_paths.config"
+    annotations_file_path_hg38 = annotations_directory+"/annotations_abs_paths.config"
 
     # Set the display_name
     # if (args.display_name is None) or (args.display_name == ""):
@@ -315,6 +315,8 @@
     # Temporarily the output file's dictionary is written for debugging:
     print "The dictionary for the output file is:\n\t{:s}".format(str(data_manager_dict))
 
+    if not os.path.isfile(os.path.join(annotations_directory,"annotations.config")):
+        raise ValueError("Cannot find annotations.config file in tar ball downloaded")
     # Make a new annotations.config with absolute paths
     annot_abs_path=[]
     with open(os.path.join(annotations_directory,"annotations.config"),"r") as annot_reader:
@@ -330,7 +332,7 @@
     # Save info to json file. This is used to transfer data from the DataManager tool, to the data manager,
     # which then puts it into the correct .loc file (I think).
     # Remove the following line when testing without galaxy package.
-    # open(args.output_filename, 'wb').write(to_json_string(data_manager_dict))
+    open(args.output_filename, 'wb').write(to_json_string(data_manager_dict))
 
 if __name__ == "__main__":
     main()