Mercurial > repos > melissacline > ucsc_xena_platform
comparison getXenaData.py @ 43:78d6e6772e30
more reliable
author | jingchunzhu <jingchunzhu@gmail.com> |
---|---|
date | Mon, 27 Jul 2015 12:21:55 -0700 |
parents | bc9784300015 |
children | 3167c1a26101 |
comparison
equal
deleted
inserted
replaced
42:bc9784300015 | 43:78d6e6772e30 |
---|---|
14 | 14 |
15 if string.find(url,"galaxyxena") !=-1 and string.find(url,"ucsc.edu")!=-1: | 15 if string.find(url,"galaxyxena") !=-1 and string.find(url,"ucsc.edu")!=-1: |
16 url = "https://galaxyxena.soe.ucsc.edu:443/xena" | 16 url = "https://galaxyxena.soe.ucsc.edu:443/xena" |
17 | 17 |
18 #testing if the url is reachable | 18 #testing if the url is reachable |
19 #try: | 19 try: |
20 r =json.loads(xena.post(url, "(+ 1 2)")) | 20 r =json.loads(xena.post(url, "(+ 1 2)")) |
21 if r!=3.0: | 21 if r!=3.0: |
22 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." | 22 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." |
23 print "You entered hub: %s" % (url) | 23 print "You entered hub: %s" % (url) |
24 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") | 24 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") |
25 fout.write("You entered hub: %s\n" % (url)) | 25 fout.write("You entered hub: %s\n" % (url)) |
26 fout.close() | 26 fout.close() |
27 sys.exit(1) | 27 sys.exit(1) |
28 except: | |
29 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." | |
30 print "You entered hub: %s" % (url) | |
31 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") | |
32 fout.write("You entered hub: %s\n" % (url)) | |
33 fout.close() | |
34 sys.exit(1) | |
28 | 35 |
29 samples = xena.dataset_samples (url, dataset) | 36 samples = xena.dataset_samples (url, dataset) |
30 if not samples: | 37 if not samples: |
31 print "Dataset does not exist" | 38 print "Dataset does not exist" |
32 print "You entered dataset id: %s" % (dataset) | 39 print "You entered dataset id: %s" % (dataset) |
33 fout.write("Dataset does not exists\n") | 40 fout.write("Dataset does not exists\n") |
34 fout.wriet("You entered dataset id: %s\n" % (dataset)) | 41 fout.write("You entered dataset id: %s\n" % (dataset)) |
35 fout.close() | 42 fout.close() |
36 sys.exit(1) | 43 sys.exit(1) |
37 | 44 |
38 type = xena.dataset_type(url, dataset) | 45 type = xena.dataset_type(url, dataset) |
39 if type[0] not in ["genomicMatrix", "clinicalMatrix"]: | 46 if type[0] not in ["genomicMatrix", "clinicalMatrix"]: |