changeset 9:a2a7096897a8

FIXED the xena import process
author melissacline
date Mon, 08 Sep 2014 13:26:21 -0700
parents dc42b6bbc22b
children cb0bb2406736 d76020802feb
files xena_import.py
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/xena_import.py	Thu Sep 04 16:01:58 2014 -0700
+++ b/xena_import.py	Mon Sep 08 13:26:21 2014 -0700
@@ -10,6 +10,7 @@
 
 import argparse
 import json
+import os
 import shutil
 
 def main():
@@ -20,6 +21,7 @@
     args = parser.parse_args()
 
     xenaBaseDir = os.getenv("XENA_BASE_DIR", "~")
+    xenaFileDir = xenaBaseDir + "/files"
 
     # Assemble the metadata in JSON format
     metadata = { 'cohort': args.cohort, 'type': args.type }
@@ -28,19 +30,20 @@
     # Write the metadata to a file in the Xena directory.  Use the filename
     # of the genomic data file, with an added .json extension.
     genomicDataFilename = args.genomicDataPathname.split("/")[-1]
-    jsonMetadataPathname = "%s/%s.json" % (args.xenaInputDir, 
+    jsonMetadataPathname = "%s/%s.json" % (xenaFileDir, 
                                            genomicDataFilename)
-    fp = open("/Users/melissacline/tmp/xena.out", "w")
-    fp.write("xena base dir %s\n" % (xenaBaseDir))
-    fp.write(cmdline)
-    fp.close()
+    #fp = open("/inside/home/cline/tmp/xena_import.out", "w")
+    #fp.write("xena file dir %s\n" % (xenaFileDir))
+    #fp.write("copying metadata to %s and data to %s" % (jsonMetadataPathname, 
+    #                                                    xenaFileDir))
+    #fp.close()
 
     fp = open(jsonMetadataPathname, "w")
     fp.write("%s\n" % (jsonMetadata))
     fp.close()
 
     # Finally, copy the genomic data into the Xena directory
-    shutil.copy(args.genomicDataPathname, args.xenaInputDir)
+    shutil.copy(args.genomicDataPathname, xenaFileDir)
 
 if __name__ == "__main__":
     main()