changeset 5:7f1257532b6f draft

Uploaded
author trinity_ctat
date Tue, 01 May 2018 15:40:08 -0400
parents c372930aaba1
children be2761745400
files data_manager/add_ctat_resource_lib.py
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/data_manager/add_ctat_resource_lib.py	Tue May 01 13:49:00 2018 -0400
+++ b/data_manager/add_ctat_resource_lib.py	Tue May 01 15:40:08 2018 -0400
@@ -74,14 +74,25 @@
     # Item three is a True or False value, indicating whether the item is selected.
     options = []
     for i, url in enumerate(filelist_parser.urls):
-        # The urls look like: 
+        # The urls should look like: 
         # https://data.broadinstitute.org/Trinity/CTAT_RESOURCE_LIB/GRCh37_v19_CTAT_lib_Feb092018.plug-n-play.tar.gz
         # https://data.broadinstitute.org/Trinity/CTAT_RESOURCE_LIB/Mouse_M16_CTAT_lib_Feb202018.source_data.tar.gz
+        # But is actuality, they are coming in looking like:
+        # GRCh37_v19_CTAT_lib_Feb092018.plug-n-play.tar.gz
+        # Mouse_M16_CTAT_lib_Feb202018.source_data.tar.gz
+        # Write code to handle both situations, or an ftp: url.
+        if (url.split(":")[0] == "http") or (url.split(":")[0] == "https") or (url.split(":")[0] == "ftp"):
+            full_url_path = url
+        else:
+            # Assume the path is relative to the page location.
+            full_url_path = "{:s}/{:s}".format(_CTAT_ResourceLib_URL, url)
         filename = url.split("/")[-1]
+
         if filename.split("_")[0] != "Mouse":
             # Take out the mouse genome options for now.
             # The mouse genome option is not handled correctly yet
-            options.append((filename, url, i == 0))
+            options.append((filename, full_url_path, i == 0))
+    options.sort() # So the list will be in alphabetical order.
     # return a tuple of the urls
     print "The list being returned as options is:"
     print "{:s}\n".format(str(options))