Mercurial > repos > trinity_ctat > ctat_centrifuge_index_data_manager2
changeset 3:4fa8238660cc draft default tip
Uploaded
author | trinity_ctat |
---|---|
date | Tue, 01 May 2018 09:58:58 -0400 |
parents | 772b977ac9a1 |
children | |
files | data_manager/add_ctat_centrifuge_index.py data_manager/add_ctat_centrifuge_index.xml |
diffstat | 2 files changed, 23 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/data_manager/add_ctat_centrifuge_index.py Mon Apr 30 08:46:43 2018 -0400 +++ b/data_manager/add_ctat_centrifuge_index.py Tue May 01 09:58:58 2018 -0400 @@ -63,38 +63,36 @@ # End of class FileListParser def get_ctat_centrifuge_index_locations(): + # For dynamic options need to return an interable with contents that are tuples with 3 items. + # Item one is a string that is the display name put into the option list. + # 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 = [] # open the url and retrieve the filenames of the files in the directory. resource = urllib2.urlopen(_CTAT_CentrifugeIndexPage_URL) theHTML = resource.read() filelist_parser = FileListParser() filelist_parser.feed(theHTML) - # return a tuple of the filenames - # return tuple(filelist_parser.filenames) - # For now, I am printing the list, just so I can see what was returned, # This is what was returned on 2018-04-23 # ftp://ftp.ccb.jhu.edu/pub/infphilo/centrifuge/data/p_compressed_2018_4_15.tar.gz # ftp://ftp.ccb.jhu.edu/pub/infphilo/centrifuge/data/nt_2018_3_3.tar.gz # ftp://ftp.ccb.jhu.edu/pub/infphilo/centrifuge/data/p_compressed+h+v.tar.gz # ftp://ftp.ccb.jhu.edu/pub/infphilo/centrifuge/data/p+h+v.tar.gz + # Which could be hard coded: + # options.append(("p_compressed+h+v", "ftp://ftp.ccb.jhu.edu/pub/infphilo/centrifuge/data/p_compressed+h+v.tar.gz", True)) + # options.append(("p+h+v", "ftp://ftp.ccb.jhu.edu/pub/infphilo/centrifuge/data/p+h+v.tar.gz", False)) + # options.append(("nt_2018_3_3", "ftp://ftp.ccb.jhu.edu/pub/infphilo/centrifuge/data/nt_2018_3_3.tar.gz", False)) + # options.append(("p_compressed_2018_4_15", "ftp://ftp.ccb.jhu.edu/pub/infphilo/centrifuge/data/p_compressed_2018_4_15.tar.gz", False)) # but only returning the one we want, which for now is assumed to be present. + # For now, I am printing the list, just so I can see what was returned, print "FYI: The URL's that were found on Centrifuge's page are:" print "\t" + "\n\t".join(filelist_parser.filenames) - # Instead of sending back the list of found URL's, send back the one URL we want. - # vals.add(_CTAT_CentrifugeDownload_URL) - # FIX - we have been unable to figure out what the format is that we need to send back. - # I have tried various things. It seems to need something two layered, that is, - # a tuple or a dict of something that can be sequenced over using next. - # return tuple(filelist_parser.filenames) # this is what I originally had, but it doesn't work. - # return ("one","two") # only prints 'o' and 't'. - #vals=set() - #vals.add("one") - #vals.add("two") - # vals = ("one", "onemore", "/path/to/one") - vals = [dict(name="one", value="onemore", path="/path/to/one")] + # For now instead of sending back the list of found URL's, send back the one URL we want. + # Currently, only one of the options is supported. + options.append((_CTAT_CentrifugeDir_Name, _CTAT_CentrifugeDownload_URL, True)) print "The items in vals are:" - print str(vals) - return vals # works kind of, but nothing is printed in the pull down list. - # return tuple(vals) + print str(options) + return options # The following was used by the example program to get input parameters through the json. # Just leaving here for reference.
--- a/data_manager/add_ctat_centrifuge_index.xml Mon Apr 30 08:46:43 2018 -0400 +++ b/data_manager/add_ctat_centrifuge_index.xml Tue May 01 09:58:58 2018 -0400 @@ -43,13 +43,18 @@ However, I have not been able to figure out how to send information back correctly from the function and there is no documentation that I have found showing how to do it. <param name="filename" type="select" label="Select File" display="radio" - dynamic_options="get_ctat_centrifuge_index_locations()" help="Select a Centrifuge Index to Download." /> - --> + dynamic_options="get_ctat_centrifuge_index_locations()" + help="Select a Centrifuge Index to Download." /> + Hard coded version. <param name="filename" type="text" value="ftp://ftp.ccb.jhu.edu/pub/infphilo/centrifuge/data/p_compressed+h+v.tar.gz"> <option value="ftp://ftp.ccb.jhu.edu/pub/infphilo/centrifuge/data/p_compressed+h+v.tar.gz"> p_compressed+h+v </option> </param> + --> + <param name="filename" type="select" label="Select File" + dynamic_options="get_ctat_centrifuge_index_locations()" + help="Select a Centrifuge Index to Download." /> <param name="force_download" type="boolean" checked="false" label="Force New Download?" /> </when> </conditional>