# HG changeset patch
# User melissacline
# Date 1410313990 14400
# Node ID a4253c71f31d00e052921297203f94591f668e65
Uploaded
diff -r 000000000000 -r a4253c71f31d xenaFindDatasets/tool_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xenaFindDatasets/tool_dependencies.xml Tue Sep 09 21:53:10 2014 -0400
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff -r 000000000000 -r a4253c71f31d xenaFindDatasets/xenaFindDatasets.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xenaFindDatasets/xenaFindDatasets.py Tue Sep 09 21:53:10 2014 -0400
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+
+import argparse
+import json
+from functools import partial
+import re
+import xena_query as xena
+
+# xena url for public datasets, at ucsc
+xena_url = "https://genome-cancer.ucsc.edu/proj/public/xena"
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("datasetType", type=str)
+ parser.add_argument("cohortName", type=str)
+ parser.add_argument("outfile", type=str)
+ args = parser.parse_args()
+
+ cohort = args.cohortName
+ if not re.search("^%", cohort):
+ cohort = "%" + cohort
+ if not re.search("%$", cohort):
+ cohort = cohort + "%"
+
+ # short-hand wrappers for xena methods
+ post = xena.compose(json.loads, partial(xena.post, xena_url))
+ find_datasets_type_pattern = xena.compose(post,
+ xena.find_datasets_type_pattern)
+ name_to_url = partial(xena.name_to_url, xena_url)
+ datasets = find_datasets_type_pattern(args.datasetType, cohort)
+ fp = open(args.outfile, "w")
+ fp.write("Cohort\tDataset\n")
+ for thisDataset in datasets:
+ tokens = thisDataset.split("/")
+ cohort = tokens[-2]
+ datasetName = tokens[-1]
+ fp.write("%s\t%s\n" % (cohort, datasetName))
+ fp.close()
+
+if __name__ == "__main__":
+ main()
diff -r 000000000000 -r a4253c71f31d xenaFindDatasets/xenaFindDatasets.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xenaFindDatasets/xenaFindDatasets.xml Tue Sep 09 21:53:10 2014 -0400
@@ -0,0 +1,25 @@
+
+
+ Retrieve the cohorts and datasets that match the specified pattern.
+
+
+ installXena
+
+
+ xenaFindDatasets.py ${datasetType} ${cohortName} $outFile
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Later...
+
+