changeset 32:9e33d452ad8c draft

planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc.git commit cca5de2166bbc2fbbab368415853e085d474b6b2
author sanbi-uwc
date Tue, 24 May 2016 04:19:03 -0400
parents bcf4f741b94f
children f9ad7d3cd333
files build_ctb_gene.py
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/build_ctb_gene.py	Mon May 23 09:20:36 2016 -0400
+++ b/build_ctb_gene.py	Tue May 24 04:19:03 2016 -0400
@@ -37,8 +37,8 @@
         self.docker_instance_name = "build_ctb_gene_" + str(random.randrange(0, 1000, 2))
 
     def build_ctb_gene(self):
-        # cmdline_str = "build_ctb_gene goterms {}".format(self.args.input_file)
-        cmdline_str = "touch /tmp/foo.bar"
+        cmdline_str = "build_ctb_gene goterms {}".format(self.args.input_file)
+        #cmdline_str = "touch /tmp/foo.bar"
         cmdline_str = self.newSplit(cmdline_str)
         build_ctb_run = False
         try:
@@ -46,12 +46,12 @@
             build_ctb_run = True
         except CalledProcessError:
             print("Error running the build_ctb_gene goterms", file=sys.stderr)
-        if build_ctb_run:
-            self.copy_output_file_to_dataset()
-            print("Building a new DB, current time: %s" % str(datetime.date.today()))
-            # print("Noe4j Database Name: http://%s:%s@%s:%s/db/data/" % (
-            #    self.args.username, self.args.password, self.args.url, self.args.port))
-            print("GFF File - Input: %s" % str(self.args.input_file))
+            if build_ctb_run:
+                self.copy_output_file_to_dataset()
+                print("Building a new DB, current time: %s" % str(datetime.date.today()))
+                # print("Noe4j Database Name: http://%s:%s@%s:%s/db/data/" % (
+                #    self.args.username, self.args.password, self.args.url, self.args.port))
+                print("GFF File - Input: %s" % str(self.args.input_file))
 
     def newSplit(self, value):
         lex = shlex.shlex(value)
@@ -110,12 +110,12 @@
     cmd_str = "docker inspect --format='{{(index (index .NetworkSettings.Ports \"7474/tcp\") 0).HostPort}}' %s" % ctb_gene_runner.docker_instance_name
 
     # TODO: randomise the ports/names/mount_point and use the autokill image
-    export_cmd = 'export NEO4J_REST_URL=http://localhost:{}/db/data/'.format(
+    neo4j_url = 'http://localhost:{}/db/data/'.format(
               inspect_docker(cmd_str)[:-1])
     try:
-        os.system(export_cmd)
+        os.environ["NEO4J_REST_URL"] = neo4j_url
     except (OSError, ValueError), e:
-        print("Error exporting the NEO4J db environmental values", e)
+        print("Error setting the NEO4J db environmental values", e)
 
     # make the output directory
     if not os.path.exists(args.outputdir):