# HG changeset patch # User trinity_ctat # Date 1540569335 14400 # Node ID 44a99b1d39f52869b8494770514e1837877de36e # Parent c47ac2deaaf8283b9c29e07cfe87ab53b20c83f7 Adjusting default library in list. diff -r c47ac2deaaf8 -r 44a99b1d39f5 data_manager/add_ctat_resource_lib.py --- a/data_manager/add_ctat_resource_lib.py Fri Oct 26 11:17:43 2018 -0400 +++ b/data_manager/add_ctat_resource_lib.py Fri Oct 26 11:55:35 2018 -0400 @@ -132,6 +132,7 @@ # If we can't get the list, send a default list. build_default_list = False + default_url_filename = "GRCh38_v27_CTAT_lib_Feb092018.plug-n-play.tar.gz" resource = urllib2.urlopen(_CTAT_ResourceLib_URL) if resource is None: build_default_list = True @@ -158,6 +159,9 @@ # Item two is the value that is put into the parameter associated with the option list. # Item three is a True or False value, indicating whether the item is selected. options = [] + found_default_url = False + if len([item for item in urls_to_return if default_url_filename in item]) > 0: + found_default_url = True for i, url in enumerate(filelist_parser.urls): # The urls should look like: # https://data.broadinstitute.org/Trinity/CTAT_RESOURCE_LIB/GRCh37_v19_CTAT_lib_Feb092018.plug-n-play.tar.gz @@ -173,12 +177,11 @@ # Assume the path is relative to the page location. full_url_path = os.path.join(_CTAT_ResourceLib_URL, url) filename = os.path.basename(url) - # if filename.split("_")[0] != _CTAT_MouseGenome_Prefix: - # # Don't put in the mouse genome options for now. - # # The mouse genome option is not handled correctly yet - # options.append((filename, full_url_path, i == 0)) - # Mouse genomes should work now (we hope) - FIX - still not tested. - options.append((filename, full_url_path, i == 0)) + if (found_default_url and (filename == default_url_filename)) or ((not found_default_url) and (i == 0)): + # This should be the default option chosen. + options.append((filename, full_url_path, True)) + else: + options.append((filename, full_url_path, False)) options.sort() # So the list will be in alphabetical order. # return a tuple of the urls print "The list being returned as options is:"