Repository 'tool_factory_2'
hg clone https://toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_2

Changeset 137:63d15caea378 (2021-04-13)
Previous changeset 136:94f5560de46d (2021-04-13) Next changeset 138:1dba6c7687a9 (2021-04-14)
Commit message:
Uploaded
modified:
toolfactory/README.md
toolfactory/rgToolFactory2.py
removed:
toolfactory/galaxyxml/__pycache__/__init__.cpython-38.pyc
toolfactory/galaxyxml/tool/__pycache__/__init__.cpython-38.pyc
toolfactory/galaxyxml/tool/__pycache__/import_xml.cpython-38.pyc
toolfactory/galaxyxml/tool/parameters/__pycache__/__init__.cpython-38.pyc
toolfactory/test-data/test1_log.txt
b
diff -r 94f5560de46d -r 63d15caea378 toolfactory/README.md
--- a/toolfactory/README.md Tue Apr 13 00:35:36 2021 +0000
+++ b/toolfactory/README.md Tue Apr 13 03:06:27 2021 +0000
[
b'@@ -1,55 +1,255 @@\n-\xef\xbb\xbf**Breaking news! Docker container is recommended as at August 2020**\n+\xef\xbb\xbf## Breaking news! Docker container at https://github.com/fubar2/toolfactory-galaxy-docker recommended as at December 2020\n \n-A Docker container can be built - see the docker directory.\n-It is highly recommended for isolation. It also has an integrated toolshed to allow installation of new tools back \n-into the Galaxy being used to generate them. \n+### New demonstration of planemo tool_factory command ![Planemo ToolFactory demonstration](images/lintplanemo-2021-01-08_18.02.45.mkv?raw=false "Demonstration inside Planemo")\n \n-Built from quay.io/bgruening/galaxy:20.05 but updates the\n-Galaxy code to the dev branch - it seems to work fine with updated bioblend>=0.14\n-with planemo and the right version of gxformat2 needed by the ToolFactory (TF).\n+## This is the original ToolFactory suitable for non-docker situations. Please use the docker container if you can because it\'s integrated with a Toolshed...\n \n-The runclean.sh script run from the docker subdirectory of your local clone of this repository\n-should create a container (eventually) and serve it at localhost:8080 with a toolshed at\n-localhost:9009.\n+# WARNING\n \n-Once it\'s up, please restart Galaxy in the container with \n-```docker exec [container name] supervisorctl restart galaxy: ```\n-Jobs just do not seem to run properly otherwise and the next steps won\'t work!\n+Install this tool to a throw-away private Galaxy or Docker container ONLY!\n \n-The generated container includes a workflow and 2 sample data sets for the workflow\n+Please NEVER on a public or production instance where a hostile user may\n+be able to gain access if they can acquire an administrative account login.\n \n-Load the workflow. Adjust the inputs for each as labelled. The perl example counts GC in phiX.fasta. \n-The python scripts use the rgToolFactory.py as their input - any text file will work but I like the\n-recursion. The BWA example has some mitochondrial reads and reference. Run the workflow and watch.\n-This should fill the history with some sample tools you can rerun and play with.\n-Note that each new tool will have been tested using Planemo. In the workflow, in Galaxy.\n-Extremely cool to watch.\n+It only runs for server administrators - the ToolFactory tool will refuse to execute for an ordinary user since\n+it can install new tools to the Galaxy server it executes on! This is not something you should allow other than\n+on a throw away instance that is protected from potentially hostile users.\n \n-*WARNING* \n-\n- Install this tool on a throw-away private Galaxy or Docker container ONLY\n- Please NEVER on a public or production instance\n-\n-*Short Story*\n+## Short Story\n \n Galaxy is easily extended to new applications by adding a new tool. Each new scientific computational package added as\n-a tool to Galaxy requires some special instructions to be written. This is sometimes termed "wrapping" the package\n-because the instructions tell Galaxy how to run the package as a new Galaxy tool. Any tool in a Galaxy is \n-readily available to all the users through a consistent and easy to use interface.\n+a tool to Galaxy requires an XML document describing how the application interacts with Galaxy.\n+This is sometimes termed "wrapping" the package because the instructions tell Galaxy how to run the package\n+as a new Galaxy tool. Any tool that has been wrapped is readily available to all the users through a consistent\n+and easy to use interface once installed in the local Galaxy server.\n+\n+Most Galaxy tool wrappers have been manually prepared by skilled programmers, many using Planemo because it\n+automates much of the boilerplate and makes the process much easier.\n+The ToolFactory (TF) now uses Planemo under the hood for testing, but hides the command\n+line complexities. The user will still need appropriate skills in terms of describing the interface between\n+Galaxy and the new application, but will be helped by a Galaxy tool form t'..b'shed fussing. Once everything quietens\n-down, find the container with\n-```docker ps```\n-and use\n-```docker exec [containername] supervisorctl restart galaxy:```\n-That colon is not a typographical mistake.\n-Not restarting after first boot seems to leave the job/worflow system confused and the workflow\n-just will not run properly until Galaxy has restarted.\n+The Docker container https://github.com/fubar2/toolfactory-galaxy-docker/blob/main/README.md\n+is the best way to use the TF because it is preconfigured\n+to automate new tool testing and has a built in local toolshed where each new tool\n+is uploaded. If you grab the docker container, it should just work after a restart and you\n+can run a workflow to generate all the sample tools. Running the samples and rerunning the ToolFactory\n+jobs that generated them allows you to add fields and experiment to see how things work.\n \n-Login as admin@galaxy.org with password "password". Feel free to change it once you are logged in. \n-There should be a companion toolshed at localhost:9090. The history should have some sample data for\n-the workflow.\n-\n-Run the workflow and make sure the right dataset is selected for each of the input files. Most of the \n-examples use text files so should run, but the bwa example needs the right ones to work properly.\n-\n-When the workflow is finished, you will have half a dozen examples to rerun and play with. They have also \n-all been tested and installed so you should find them in your tool menu under "Generated Tools"\n-\n-It is easy to install without Docker, but you will need to make some \n+It can be installed like any other tool from the Toolshed, but you will need to make some\n configuration changes (TODO write a configuration). You can install it most conveniently using the\n administrative "Search and browse tool sheds" link. Find the Galaxy Main\n toolshed at https://toolshed.g2.bx.psu.edu/ and search for the toolfactory\n repository in the Tool Maker section. Open it and review the code and select the option to install it.\n \n-Otherwise, if not already there pending an accepted PR,\n-please add:\n-<datatype extension="tgz" type="galaxy.datatypes.binary:Binary"\n-mimetype="multipart/x-gzip" subclass="True" />\n-to your local data_types_conf.xml.\n+If not already there please add:\n+\n+```\n+<datatype extension="tgz" type="galaxy.datatypes.binary:Binary" mimetype="multipart/x-gzip" subclass="True" />\n+```\n+\n+to your local config/data_types_conf.xml.\n \n \n-*Restricted execution*\n+## Restricted execution\n+\n+The tool factory tool itself will ONLY run for admin users -\n+people with IDs in config/galaxy.yml "admin_users".\n \n-The tool factory tool itself will then be usable ONLY by admin users -\n-people with IDs in admin_users. **Yes, that\'s right. ONLY\n-admin_users can run this tool** Think about it for a moment. If allowed to\n-run any arbitrary script on your Galaxy server, the only thing that would\n-impede a miscreant bent on destroying all your Galaxy data would probably\n-be lack of appropriate technical skills.\n+*ONLY admin_users can run this tool*\n \n-**Generated tool Security**\n+That doesn\'t mean it\'s safe to install on a shared or exposed instance - please don\'t.\n+\n+## Generated tool Security\n \n Once you install a generated tool, it\'s just\n another tool - assuming the script is safe. They just run normally and their\n user cannot do anything unusually insecure but please, practice safe toolshed.\n Read the code before you install any tool. Especially this one - it is really scary.\n \n-**Send Code**\n-\n-Pull requests and suggestions welcome as git issues please?\n-\n-**Attribution**\n+## Attribution\n \n Creating re-usable tools from scripts: The Galaxy Tool Factory\n Ross Lazarus; Antony Kaspi; Mark Ziemann; The Galaxy Team\n@@ -200,12 +378,3 @@\n \n http://bioinformatics.oxfordjournals.org/cgi/reprint/bts573?ijkey=lczQh1sWrMwdYWJ&keytype=ref\n \n-**Licensing**\n-\n-Copyright Ross Lazarus 2010\n-ross lazarus at g mail period com\n-\n-All rights reserved.\n-\n-Licensed under the LGPL\n-\n'
b
diff -r 94f5560de46d -r 63d15caea378 toolfactory/galaxyxml/__pycache__/__init__.cpython-38.pyc
b
Binary file toolfactory/galaxyxml/__pycache__/__init__.cpython-38.pyc has changed
b
diff -r 94f5560de46d -r 63d15caea378 toolfactory/galaxyxml/tool/__pycache__/__init__.cpython-38.pyc
b
Binary file toolfactory/galaxyxml/tool/__pycache__/__init__.cpython-38.pyc has changed
b
diff -r 94f5560de46d -r 63d15caea378 toolfactory/galaxyxml/tool/__pycache__/import_xml.cpython-38.pyc
b
Binary file toolfactory/galaxyxml/tool/__pycache__/import_xml.cpython-38.pyc has changed
b
diff -r 94f5560de46d -r 63d15caea378 toolfactory/galaxyxml/tool/parameters/__pycache__/__init__.cpython-38.pyc
b
Binary file toolfactory/galaxyxml/tool/parameters/__pycache__/__init__.cpython-38.pyc has changed
b
diff -r 94f5560de46d -r 63d15caea378 toolfactory/rgToolFactory2.py
--- a/toolfactory/rgToolFactory2.py Tue Apr 13 00:35:36 2021 +0000
+++ b/toolfactory/rgToolFactory2.py Tue Apr 13 03:06:27 2021 +0000
[
@@ -1043,6 +1043,10 @@
         and for generating test outputs if command or test overrides are
         supplied test outputs are sent to repdir for display
         """
+        penv = os.environ
+        pconfig = os.path.join(self.args.tool_dir,'.planemo.yml')
+        penv["PLANEMO_GLOBAL_CONFIG_PATH"] = pconfig
+        self.set_planemo_galaxy_root(self.args.galaxy_root,config_path=pconfig)
         xreal = "%s.xml" % self.tool_name
         tool_test_path = os.path.join(
             self.repdir, f"{self.tool_name}_planemo_test_report.html"
@@ -1067,6 +1071,7 @@
         p = subprocess.run(
             cll,
             shell=False,
+            env = penv,
             cwd=self.tooloutdir,
             stderr=tout,
             stdout=tout,
@@ -1074,6 +1079,36 @@
         tout.close()
         return p.returncode
 
+    def set_planemo_galaxy_root(self, galaxyroot='/galaxy-central', config_path=".planemo.yml"):
+        # bug in planemo - bogus '--dev-wheels' passed to run_tests.sh as at april 2021 - need a fiddled copy so it is ignored until fixed
+        CONFIG_TEMPLATE = f"""## Planemo Global Configuration File.
+## Everything in this file is completely optional - these values can all be
+## configured via command line options for the corresponding commands.
+
+## Specify a default galaxy_root for test and server commands here.
+galaxy_root: %s
+## Username used with toolshed(s).
+#shed_username: "<TODO>"
+sheds:
+  # For each tool shed you wish to target, uncomment key or both email and
+  # password.
+  toolshed:
+    #key: "<TODO>"
+    #email: "<TODO>"
+    #password: "<TODO>"
+  testtoolshed:
+    #key: "<TODO>"
+    #email: "<TODO>"
+    #password: "<TODO>"
+  local:
+    #key: "<TODO>"
+    #email: "<TODO>"
+    #password: "<TODO>"
+"""
+        if not os.path.exists(config_path):
+            with open(config_path, "w") as f:
+                f.write(CONFIG_TEMPLATE % galaxyroot)
+
 
 def main():
     """
b
diff -r 94f5560de46d -r 63d15caea378 toolfactory/test-data/test1_log.txt
--- a/toolfactory/test-data/test1_log.txt Tue Apr 13 00:35:36 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
b
@@ -1,1 +0,0 @@
-## Executing Toolfactory generated command line = python /tmp/pyrevposq5dmcdy1.python /tmp/tmpqrksf8sd/files/5/b/9/dataset_5b952a86-87df-44ad-a415-ea549f3f0cee.dat output2