Mercurial > repos > trinity_ctat > ctat_lncrna_data_manager
changeset 1:df03033c3bb2 draft
Uploaded separated data entry points for hg19, hg38, mm9, mm10
author | trinity_ctat |
---|---|
date | Mon, 04 Jun 2018 14:54:49 -0400 |
parents | 1da522a43f15 |
children | cc020da34af0 |
files | data_manager/add_ctat_lncrna_annotations.py |
diffstat | 1 files changed, 44 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/data_manager/add_ctat_lncrna_annotations.py Mon Jun 04 14:20:45 2018 -0400 +++ b/data_manager/add_ctat_lncrna_annotations.py Mon Jun 04 14:54:49 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 @@ -244,43 +244,76 @@ 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 = annotations_directory + annotations_file_path_mm9 = annotations_directory+"/mm9" + annotations_file_path_mm10 = annotations_directory+"/mm10" + annotations_file_path_hg19 = annotations_directory+"/hg19" + annotations_file_path_hg38 = annotations_directory+"/hg38" # Set the display_name if (args.display_name is None) or (args.display_name == ""): # Use the root_annotations_dirname. if (root_annotations_dirname != None) and (root_annotations_dirname != ""): - display_name = _CTAT_lncrna_DisplayNamePrefix + root_annotations_dirname + display_name_hg19 = "hg19" + display_name_hg38 = "hg38" + display_name_mm10 = "mm10" + display_name_mm9 = "mm9" else: display_name = _CTAT_lncrna_DisplayNamePrefix + _CTAT_lncrnaDir_Name print "WARNING: Did not set the display name. Using the default: {:s}".format(display_name_value) else: display_name = _CTAT_lncrna_annotations_DisplayNamePrefix + args.display_name - display_name = display_name.replace(" ","_") + # display_name = display_name.replace(" ","_") # Set the unique_id datetime_stamp = datetime.now().strftime("_%Y_%m_%d_%H_%M_%S_%f") if (root_annotations_dirname != None) and (root_annotations_dirname != ""): - unique_id = root_annotations_dirname + datetime_stamp + hg19_unique_id = "ctat_lncrna_hg19" + datetime_stamp + mm10_unique_id = "ctat_lncrna_mm10" + datetime_stamp + mm9_unique_id = "ctat_lncrna_mm9" + datetime_stamp + hg38_unique_id = "ctat_lncrna_hg38" + datetime_stamp else: unique_id = _CTAT_lncrnaDir_Name + datetime_stamp - print "The Index's display_name will be set to: {:s}\n".format(display_name) - print "Its unique_id will be set to: {:s}\n".format(unique_id) - print "Its dir_path will be set to: {:s}\n".format(annotations_file_path) + print "The hg19 Index's display_name will be set to: {:s}\n".format(display_name_hg19) + print "Its hg19 unique_id will be set to: {:s}\n".format(hg19_unique_id) + print "Its hg19 dir_path will be set to: {:s}\n".format(annotations_file_path_hg19) + + + print "The hg38 Index's display_name will be set to: {:s}\n".format(display_name_hg38) + print "Its hg38 unique_id will be set to: {:s}\n".format(hg38_unique_id) + print "Its hg38 dir_path will be set to: {:s}\n".format(annotations_file_path_hg38) + + + print "The mm9 Index's display_name will be set to: {:s}\n".format(display_name_mm9) + print "Its mm9 unique_id will be set to: {:s}\n".format(mm9_unique_id) + print "Its mm9 dir_path will be set to: {:s}\n".format(annotations_file_path_mm9) + + + print "The mm10 Index's display_name will be set to: {:s}\n".format(display_name_mm10) + print "Its mm10 unique_id will be set to: {:s}\n".format(mm10_unique_id) + print "Its mm10 dir_path will be set to: {:s}\n".format(annotations_file_path_mm10) data_manager_dict = {} data_manager_dict['data_tables'] = {} data_manager_dict['data_tables'][_CTAT_lncrnaTableName] = [] - data_table_entry = dict(value=unique_id, name=display_name, path=annotations_file_path) - data_manager_dict['data_tables'][_CTAT_lncrnaTableName].append(data_table_entry) + data_table_entry_mm9 = dict(value=mm9_unique_id, name=display_name_mm9, path=annotations_file_path_mm9) + data_manager_dict['data_tables'][_CTAT_lncrnaTableName].append(data_table_entry_mm9) + + data_table_entry_mm10 = dict(value=mm10_unique_id, name=display_name_mm10, path=annotations_file_path_mm10) + data_manager_dict['data_tables'][_CTAT_lncrnaTableName].append(data_table_entry_mm10) + + data_table_entry_hg19 = dict(value=hg19_unique_id, name=display_name_hg19, path=annotations_file_path_hg19) + data_manager_dict['data_tables'][_CTAT_lncrnaTableName].append(data_table_entry_hg19) + + data_table_entry_hg38 = dict(value=hg38_unique_id, name=display_name_hg38, path=annotations_file_path_hg38) + data_manager_dict['data_tables'][_CTAT_lncrnaTableName].append(data_table_entry_hg38) # 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)) # 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()