diff build_ctb_gene.py @ 11:517691812452 draft

planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc.git commit 3f5361a7226127ec8b8d6cb5591b5bb4f52bb6fe
author sanbi-uwc
date Tue, 17 May 2016 03:45:58 -0400
parents cb322069c7bc
children 7d49ea27d9f6
line wrap: on
line diff
--- a/build_ctb_gene.py	Mon May 16 10:34:46 2016 -0400
+++ b/build_ctb_gene.py	Tue May 17 03:45:58 2016 -0400
@@ -21,43 +21,25 @@
         '''
 
         # Check whether the options are specified and saves them into the object
-        assert args != None
+        #assert args != None
         self.args = args
 
     def build_ctb_gene(self, output_file1, output_dir, input_file, mount_point):
-        # cmdline_str = "build_ctb_gene goterms ${}".format(input_file)
+        #cmdline_str = "build_ctb_gene goterms ${}".format(input_file)
+        #cmdline_str = "build_ctb_gene goterms --help"
         cmdline_str = "touch /tmp/foo.bar"
         build_ctb = False
         cmdline_str = self.newSplit(cmdline_str)
         try:
             check_call(cmdline_str)
-            build_ctb = True
+            #build_ctb = True
         except CalledProcessError:
             print("Error running the build_ctb_gene gotermS", file=sys.stderr)
 
-        # Read the files at the mount point and load the html file
-        if build_ctb:
-            files = glob.glob(mount_point)
-            output_file1 = """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-                            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-                            <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-                            <meta name="generator" content="Galaxy %s tool output - see http://g2.trac.bx.psu.edu/" />
-                            <title></title>
-                            <link rel="stylesheet" href="/static/style/base.css" type="text/css" />
-                            </head>
-                            <body>
-                            <div class="toolFormBody">
-                            <table>
-                                <th>Files</th>
-                            """
-            for f in files:
-                output_file1 += "<tr><td>" + f + "</td></tr>"
-            output_file1 += """</table></div></body></html>\n"""
+        self.copy_output_file_to_dataset()
+        self.args.output_file1 = self.args.outputdir
 
-        self.copy_output_file_to_dataset()
-        return output_file1
-
-    def newSplit(value):
+    def newSplit(self, value):
         lex = shlex.shlex(value)
         lex.quotes = '"'
         lex.whitespace_split = True
@@ -71,9 +53,12 @@
 
         # retrieve neo4j files to the working gx directory
         result_file = glob.glob(self.args.mount_point + '/*')
-        with open(result_file[0], 'rb') as fsrc:
-            with open(self.args.outputdir, 'wb') as fdest:
-                shutil.copyfileobj(fsrc, fdest)
+        for file_name in result_file:
+            shutil.copy(file_name, self.args.outputdir)
+
+        #with open(result_file[0], 'rb') as fsrc:
+            #with open(self.args.outputdir, 'wb') as fdest:
+            #shutil.copy(fsrc, self.args.outputdir)
 
 
 def main():
@@ -103,3 +88,4 @@
 
 
 if __name__ == "__main__": main()
+