changeset 43:78d6e6772e30

more reliable
author jingchunzhu <jingchunzhu@gmail.com>
date Mon, 27 Jul 2015 12:21:55 -0700
parents bc9784300015
children da86478b1d64
files getXenaData.py xenaGetDataset.xml
diffstat 2 files changed, 18 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/getXenaData.py	Mon Jul 27 12:01:42 2015 -0700
+++ b/getXenaData.py	Mon Jul 27 12:21:55 2015 -0700
@@ -16,22 +16,29 @@
   url = "https://galaxyxena.soe.ucsc.edu:443/xena"
 
 #testing if the url is reachable
-#try:
-r =json.loads(xena.post(url, "(+ 1 2)")) 
-if  r!=3.0:
-  print "The hub seems can not be reached, either it is not running, the url has a typo, or it is not accessible to you."
-  print "You entered hub: %s" % (url)
-  fout.write("The hub seems can not be reached, either it is not running, the url has a typo, or it is not accessible to you.\n")
-  fout.write("You entered hub: %s\n" % (url))
-  fout.close()
-  sys.exit(1)
+try:
+  r =json.loads(xena.post(url, "(+ 1 2)")) 
+  if  r!=3.0:
+    print "The hub seems can not be reached, either it is not running, the url has a typo, or it is not accessible to you."
+    print "You entered hub: %s" % (url)
+    fout.write("The hub seems can not be reached, either it is not running, the url has a typo, or it is not accessible to you.\n")
+    fout.write("You entered hub: %s\n" % (url))
+    fout.close()
+    sys.exit(1)
+except: 
+    print "The hub seems can not be reached, either it is not running, the url has a typo, or it is not accessible to you."
+    print "You entered hub: %s" % (url)
+    fout.write("The hub seems can not be reached, either it is not running, the url has a typo, or it is not accessible to you.\n")
+    fout.write("You entered hub: %s\n" % (url))
+    fout.close()
+    sys.exit(1)
 
 samples = xena.dataset_samples (url, dataset)
 if not samples:
   print "Dataset does not exist"
   print "You entered dataset id: %s" % (dataset)
   fout.write("Dataset does not exists\n")
-  fout.wriet("You entered dataset id: %s\n" % (dataset))
+  fout.write("You entered dataset id: %s\n" % (dataset))
   fout.close()
   sys.exit(1)
 
--- a/xenaGetDataset.xml	Mon Jul 27 12:01:42 2015 -0700
+++ b/xenaGetDataset.xml	Mon Jul 27 12:21:55 2015 -0700
@@ -29,7 +29,7 @@
   </inputs>
   <outputs>
     <!-- <data format="txt" name="metadataFile" label="${dataset}.json"/> -->
-    <data format="tabular" name="dataFile" label="${dataset}" />
+    <data format="txt" name="dataFile" label="${dataset}" />
   </outputs>
   <help>
     Given the data hub name and the dataset id, download the dataset into this Galaxy. Xena dataset id can be obtained through the Explore Data in Xena tool.