Mercurial > repos > fubar > tool_factory_docker
changeset 6:482386d6cc43 draft default tip
Uploaded
author | fubar |
---|---|
date | Sun, 24 Jan 2021 03:54:01 +0000 |
parents | f17a2b1972f1 |
children | |
files | toolfactory_docker/TFdocker_make_demo_jan24.ga toolfactory_docker/rgToolFactory2.py toolfactory_docker/rgToolFactory2.xml |
diffstat | 3 files changed, 1495 insertions(+), 434 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolfactory_docker/TFdocker_make_demo_jan24.ga Sun Jan 24 03:54:01 2021 +0000 @@ -0,0 +1,892 @@ +{ + "a_galaxy_workflow": "true", + "annotation": "", + "format-version": "0.1", + "name": "ToolFactory - make, test and install demonstration tools", + "steps": { + "0": { + "annotation": "", + "content_id": null, + "errors": null, + "id": 0, + "input_connections": {}, + "inputs": [ + { + "description": "", + "name": "rgToolFactory2.py" + } + ], + "label": "rgToolFactory2.py", + "name": "Input dataset", + "outputs": [], + "position": { + "bottom": 237.32916259765625, + "height": 65.76666259765625, + "left": 496.8333435058594, + "right": 656.8333435058594, + "top": 171.5625, + "width": 160, + "x": 496.8333435058594, + "y": 171.5625 + }, + "tool_id": null, + "tool_state": "{\"optional\": false}", + "tool_version": null, + "type": "data_input", + "uuid": "104dbbf5-eaf4-43f3-b1ae-8077dbe92d00", + "workflow_outputs": [ + { + "label": null, + "output_name": "output", + "uuid": "397c4ecd-021f-42c4-9974-b095b1ac2ec1" + } + ] + }, + "1": { + "annotation": "", + "content_id": null, + "errors": null, + "id": 1, + "input_connections": {}, + "inputs": [ + { + "description": "", + "name": "bwa-mem-fastq1.fq" + } + ], + "label": "bwa-mem-fastq1.fq", + "name": "Input dataset", + "outputs": [], + "position": { + "bottom": 337.32916259765625, + "height": 65.76666259765625, + "left": 498.0833435058594, + "right": 658.0833435058594, + "top": 271.5625, + "width": 160, + "x": 498.0833435058594, + "y": 271.5625 + }, + "tool_id": null, + "tool_state": "{\"optional\": false}", + "tool_version": null, + "type": "data_input", + "uuid": "dc32342c-13b5-45e4-951d-7f4d3e363ff4", + "workflow_outputs": [ + { + "label": null, + "output_name": "output", + "uuid": "8206a188-904c-4f09-9fd6-b96caaa7badb" + } + ] + }, + "2": { + "annotation": "", + "content_id": null, + "errors": null, + "id": 2, + "input_connections": {}, + "inputs": [ + { + "description": "", + "name": "phiX.fasta" + } + ], + "label": "phiX.fasta", + "name": "Input dataset", + "outputs": [], + "position": { + "bottom": 418.49583435058594, + "height": 49.43333435058594, + "left": 481.8333435058594, + "right": 641.8333435058594, + "top": 369.0625, + "width": 160, + "x": 481.8333435058594, + "y": 369.0625 + }, + "tool_id": null, + "tool_state": "{\"optional\": false}", + "tool_version": null, + "type": "data_input", + "uuid": "06cebe75-3a87-4bf1-9745-c37060adf6e4", + "workflow_outputs": [ + { + "label": null, + "output_name": "output", + "uuid": "251adfc2-6560-4e0e-b698-f907a1a7eec4" + } + ] + }, + "3": { + "annotation": "", + "content_id": null, + "errors": null, + "id": 3, + "input_connections": {}, + "inputs": [ + { + "description": "", + "name": "bwa-mem-mt-genome.fa" + } + ], + "label": "bwa-mem-mt-genome.fa", + "name": "Input dataset", + "outputs": [], + "position": { + "bottom": 597.3291625976562, + "height": 65.76666259765625, + "left": 496.8333435058594, + "right": 656.8333435058594, + "top": 531.5625, + "width": 160, + "x": 496.8333435058594, + "y": 531.5625 + }, + "tool_id": null, + "tool_state": "{\"optional\": false}", + "tool_version": null, + "type": "data_input", + "uuid": "be08461b-63f4-4809-8326-ef5789f14947", + "workflow_outputs": [ + { + "label": null, + "output_name": "output", + "uuid": "99c082da-36d3-4d41-baff-4af7e0254499" + } + ] + }, + "4": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "errors": null, + "id": 4, + "input_connections": {}, + "inputs": [], + "label": null, + "name": "toolfactory", + "outputs": [ + { + "name": "TF_run_report", + "type": "input" + }, + { + "name": "new_tool", + "type": "tgz" + } + ], + "position": { + "bottom": 864.6791687011719, + "height": 213.11666870117188, + "left": 496.8333435058594, + "right": 656.8333435058594, + "top": 651.5625, + "width": 160, + "x": 496.8333435058594, + "y": 651.5625 + }, + "post_job_actions": {}, + "tool_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "tool_state": "{\"__input_ext\": \"input\", \"chromInfo\": \"/home/ross/galaxy-dev/tool-data/shared/ucsc/chrom/?.len\", \"cl_prefix\": \"\", \"cover\": {\"commover\": \"no\", \"__current_case__\": 0, \"command_override\": \"\", \"test_override\": \"\"}, \"deps\": {\"packages\": \"planemo\", \"usescript\": {\"choosescript\": \"yes\", \"__current_case__\": 1, \"scriptrunner\": \"bash\", \"dynScript\": \"cp $1 foo.tar.gz\\ntar -xvf foo.tar.gz\\nTOOLNAME=`find . -name \\\"*.xml\\\"`\\necho \\\"TOOLNAME = $TOOLNAME\\\"\\nplanemo test --test_output $2 $TOOLNAME\"}}, \"io_param\": {\"ppass\": {\"parampass\": \"positional\", \"__current_case__\": 1, \"io\": {\"history_inputs\": [{\"__index__\": 0, \"input_files\": null, \"input_formats\": [\"tgz\"], \"input_label\": \"ToolFactory toolshed archive from the history to test\", \"input_help\": \"\", \"input_CL\": \"1\", \"input_repeat\": \"false\"}], \"history_outputs\": [{\"__index__\": 0, \"history_name\": \"planemo_test_output\", \"history_format\": \"txt\", \"history_CL\": \"2\", \"history_test\": \"sim_size:0.05\"}], \"collection_outputs\": []}, \"addparam\": {\"edit_params\": \"yes\", \"additional_parameters\": []}}}, \"make\": {\"makeMode\": {\"make_Tool\": \"gentest\", \"__current_case__\": 1, \"galaxy_apikey\": \"\", \"toolshed_apikey\": \"\", \"galaxy_url\": \"\", \"toolshed_url\": \"\", \"tool_version\": \"0.01\", \"tool_desc\": \"Tests a ToolFactory tool\", \"help_text\": \"**What it Does**\\n\\nRuns planemo test on a ToolFactory or other toolshed archive\", \"citations\": []}}, \"tool_name\": \"planemo_test\", \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "2.00", + "type": "tool", + "uuid": "ac1dfbcf-8f39-45a8-b3d4-93691bd8d974", + "workflow_outputs": [ + { + "label": null, + "output_name": "TF_run_report", + "uuid": "43750d1d-218f-499b-85d8-56e8ffdc78bd" + }, + { + "label": null, + "output_name": "new_tool", + "uuid": "a24992fe-44b5-4984-8c95-3d534666fc68" + } + ] + }, + "5": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "errors": null, + "id": 5, + "input_connections": {}, + "inputs": [], + "label": null, + "name": "toolfactory", + "outputs": [ + { + "name": "TF_run_report", + "type": "input" + }, + { + "name": "new_tool", + "type": "tgz" + } + ], + "position": { + "bottom": 845.3291625976562, + "height": 73.76666259765625, + "left": 496.8333435058594, + "right": 656.8333435058594, + "top": 771.5625, + "width": 160, + "x": 496.8333435058594, + "y": 771.5625 + }, + "post_job_actions": {}, + "tool_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "tool_state": "{\"__input_ext\": \"input\", \"__workflow_invocation_uuid__\": \"f1d43bed5d0811ebac99cda6b6778595\", \"chromInfo\": \"/home/ross/galaxy-dev/tool-data/shared/ucsc/chrom/?.len\", \"cl_prefix\": \"\", \"cover\": {\"commover\": \"yes\", \"__current_case__\": 1, \"command_override\": \"\", \"test_override\": \" <tests>\\n <test>\\n <param name=\\\"nplot\\\" value=\\\"3\\\" />\\n <output_collection name=\\\"plots\\\" type=\\\"list\\\">\\n <element file=\\\"yet_1_anotherplot_sample\\\" name=\\\"yet_1_anotherplot\\\" ftype=\\\"pdf\\\" compare=\\\"sim_size\\\" delta_frac=\\\"0.05\\\"/>\\n <\/output_collection>\\n <\/test>\\n <\/tests>\\n\"}, \"deps\": {\"packages\": \"r-base\", \"usescript\": {\"choosescript\": \"yes\", \"__current_case__\": 1, \"scriptrunner\": \"Rscript\", \"dynScript\": \"# demo\\nargs = commandArgs(trailingOnly=TRUE)\\nif (length(args)==0) {\\n n_plots = 3 \\n} else {\\n n_plots = as.integer(args[1]) }\\ndir.create('plots')\\nfor (i in 1:n_plots) {\\n foo = runif(100)\\n bar = rnorm(100)\\n bar = foo + 0.05*bar\\n pdf(paste('plots/yet',i,\\\"anotherplot.pdf\\\",sep='_'))\\n plot(foo,bar,main=paste(\\\"Foo by Bar plot #\\\",i),col=\\\"maroon\\\", pch=3,cex=0.6)\\n dev.off()\\n foo = data.frame(a=runif(100),b=runif(100),c=runif(100),d=runif(100),e=runif(100),f=runif(100))\\n bar = as.matrix(foo)\\n pdf(paste('plots/yet',i,\\\"anotherheatmap.pdf\\\",sep='_'))\\n heatmap(bar,main='Random Heatmap')\\n dev.off()\\n}\\n\"}}, \"io_param\": {\"ppass\": {\"parampass\": \"positional\", \"__current_case__\": 1, \"io\": {\"history_inputs\": [], \"history_outputs\": [], \"collection_outputs\": [{\"__index__\": 0, \"name\": \"plots\", \"kind\": \"list\", \"label\": \"Plots\", \"discover\": \"__name_and_ext__\"}]}, \"addparam\": {\"edit_params\": \"yes\", \"additional_parameters\": [{\"__index__\": 0, \"param_name\": \"nplot\", \"ap_type\": {\"param_type\": \"text\", \"__current_case__\": 0, \"param_value\": \"3\"}, \"param_label\": \"Number of random plots pairs to draw\", \"param_help\": \"\", \"param_CL\": \"1\", \"param_CLprefixed\": \"\"}]}}}, \"make\": {\"makeMode\": {\"make_Tool\": \"gentest\", \"__current_case__\": 1, \"galaxy_apikey\": \"\", \"toolshed_apikey\": \"\", \"galaxy_url\": \"\", \"toolshed_url\": \"\", \"tool_version\": \"0.01\", \"tool_desc\": \"Makes random plots\", \"help_text\": \"**What it Does**\\nMakes plots into a collection demonstration\", \"citations\": []}}, \"tool_name\": \"plotter\", \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "2.00", + "type": "tool", + "uuid": "85af8c81-6fe0-4ade-961d-bd09cc3e364c", + "workflow_outputs": [ + { + "label": null, + "output_name": "TF_run_report", + "uuid": "eb6e2939-06ee-432c-8e11-7876758e8b5a" + }, + { + "label": null, + "output_name": "new_tool", + "uuid": "4108acda-f6ca-4fe0-a604-c17a143b291b" + } + ] + }, + "6": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "errors": null, + "id": 6, + "input_connections": {}, + "inputs": [], + "label": null, + "name": "toolfactory", + "outputs": [ + { + "name": "TF_run_report", + "type": "input" + }, + { + "name": "new_tool", + "type": "tgz" + } + ], + "position": { + "bottom": 827.8958282470703, + "height": 90.08332824707031, + "left": 783.0833435058594, + "right": 943.0833435058594, + "top": 737.8125, + "width": 160, + "x": 783.0833435058594, + "y": 737.8125 + }, + "post_job_actions": {}, + "tool_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "tool_state": "{\"__input_ext\": \"input\", \"__workflow_invocation_uuid__\": \"f1d43bed5d0811ebac99cda6b6778595\", \"chromInfo\": \"/home/ross/galaxy-dev/tool-data/shared/ucsc/chrom/?.len\", \"cl_prefix\": \"\", \"cover\": {\"commover\": \"no\", \"__current_case__\": 0, \"command_override\": \"\", \"test_override\": \"\"}, \"deps\": {\"packages\": \"\", \"usescript\": {\"choosescript\": \"yes\", \"__current_case__\": 1, \"scriptrunner\": \"bash\", \"dynScript\": \"echo \\\"You chose $1\\\"\"}}, \"io_param\": {\"ppass\": {\"parampass\": \"positional\", \"__current_case__\": 1, \"io\": {\"history_inputs\": [], \"history_outputs\": [{\"__index__\": 0, \"history_name\": \"select_out\", \"history_format\": \"txt\", \"history_CL\": \"STDOUT\", \"history_test\": \"diff:0\"}], \"collection_outputs\": []}, \"addparam\": {\"edit_params\": \"yes\", \"additional_parameters\": [{\"__index__\": 0, \"param_name\": \"choose\", \"ap_type\": {\"param_type\": \"selecttext\", \"__current_case__\": 4, \"selectTexts\": [{\"__index__\": 0, \"select_text\": \"one\", \"select_value\": \"won\"}, {\"__index__\": 1, \"select_text\": \"two\", \"select_value\": \"too\"}, {\"__index__\": 2, \"select_text\": \"three\", \"select_value\": \"free\"}]}, \"param_label\": \"Choose\", \"param_help\": \"\", \"param_CL\": \"1\", \"param_CLprefixed\": \"\"}]}}}, \"make\": {\"makeMode\": {\"make_Tool\": \"gentest\", \"__current_case__\": 1, \"galaxy_apikey\": \"\", \"toolshed_apikey\": \"\", \"galaxy_url\": \"\", \"toolshed_url\": \"\", \"tool_version\": \"0.01\", \"tool_desc\": \"Test select\", \"help_text\": \"**What it Does**\\nToolFactory select tester\", \"citations\": []}}, \"tool_name\": \"select_test\", \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "2.00", + "type": "tool", + "uuid": "f887f9ad-c0c5-4102-b85c-202ee8fb5a37", + "workflow_outputs": [ + { + "label": null, + "output_name": "TF_run_report", + "uuid": "dd4d7378-9b35-4cbe-8562-1c285b33f29e" + }, + { + "label": null, + "output_name": "new_tool", + "uuid": "3acc8a86-9b86-47ff-b575-8b539f3ff8a8" + } + ] + }, + "7": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "errors": null, + "id": 7, + "input_connections": {}, + "inputs": [], + "label": null, + "name": "toolfactory", + "outputs": [ + { + "name": "TF_run_report", + "type": "input" + }, + { + "name": "new_tool", + "type": "tgz" + } + ], + "position": { + "bottom": 985.5291595458984, + "height": 122.71665954589844, + "left": 784.3333435058594, + "right": 944.3333435058594, + "top": 862.8125, + "width": 160, + "x": 784.3333435058594, + "y": 862.8125 + }, + "post_job_actions": {}, + "tool_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "tool_state": "{\"__input_ext\": \"input\", \"__workflow_invocation_uuid__\": \"f1d43bed5d0811ebac99cda6b6778595\", \"chromInfo\": \"/home/ross/galaxy-dev/tool-data/shared/ucsc/chrom/?.len\", \"cl_prefix\": \"\", \"cover\": {\"commover\": \"no\", \"__current_case__\": 0, \"command_override\": \"\", \"test_override\": \"\"}, \"deps\": {\"packages\": \"\", \"usescript\": {\"choosescript\": \"yes\", \"__current_case__\": 1, \"scriptrunner\": \"bash\", \"dynScript\": \"echo \\\"Hello $1\\\"\"}}, \"io_param\": {\"ppass\": {\"parampass\": \"positional\", \"__current_case__\": 1, \"io\": {\"history_inputs\": [], \"history_outputs\": [{\"__index__\": 0, \"history_name\": \"Hello_output\", \"history_format\": \"txt\", \"history_CL\": \"STDOUT\", \"history_test\": \"diff:0\"}], \"collection_outputs\": []}, \"addparam\": {\"edit_params\": \"yes\", \"additional_parameters\": [{\"__index__\": 0, \"param_name\": \"say_hello_to\", \"ap_type\": {\"param_type\": \"text\", \"__current_case__\": 0, \"param_value\": \"\"}, \"param_label\": \"Say hello to\", \"param_help\": \"\", \"param_CL\": \"1\", \"param_CLprefixed\": \"\"}]}}}, \"make\": {\"makeMode\": {\"make_Tool\": \"gentest\", \"__current_case__\": 1, \"galaxy_apikey\": \"fakekey\", \"toolshed_apikey\": \"fakekey\", \"galaxy_url\": \"http://localhost:8080\", \"toolshed_url\": \"http://localhost:9009\", \"tool_version\": \"0.01\", \"tool_desc\": \"Says hello\", \"help_text\": \"**What it Does**\\nToolFactory demonstration - hello world in Galaxy\", \"citations\": []}}, \"tool_name\": \"hello_toolshed\", \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "2.00", + "type": "tool", + "uuid": "6648ac6e-fd4d-4c20-bf28-9909b994d283", + "workflow_outputs": [ + { + "label": null, + "output_name": "TF_run_report", + "uuid": "6fb5e7a3-e448-4d10-90a2-2f8632a5250b" + }, + { + "label": null, + "output_name": "new_tool", + "uuid": "6d0a7d80-4dff-479d-b914-b95c076a8459" + } + ] + }, + "8": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "errors": null, + "id": 8, + "input_connections": {}, + "inputs": [], + "label": null, + "name": "toolfactory", + "outputs": [ + { + "name": "TF_run_report", + "type": "input" + }, + { + "name": "new_tool", + "type": "tgz" + } + ], + "position": { + "bottom": 850.5291595458984, + "height": 122.71665954589844, + "left": 1299.3333435058594, + "right": 1459.3333435058594, + "top": 727.8125, + "width": 160, + "x": 1299.3333435058594, + "y": 727.8125 + }, + "post_job_actions": {}, + "tool_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "tool_state": "{\"__input_ext\": \"input\", \"__workflow_invocation_uuid__\": \"f1d43bed5d0811ebac99cda6b6778595\", \"chromInfo\": \"/home/ross/galaxy-dev/tool-data/shared/ucsc/chrom/?.len\", \"cl_prefix\": \"\", \"cover\": {\"commover\": \"no\", \"__current_case__\": 0, \"command_override\": \"\", \"test_override\": \"\"}, \"deps\": {\"packages\": \"\", \"usescript\": {\"choosescript\": \"yes\", \"__current_case__\": 1, \"scriptrunner\": \"bash\", \"dynScript\": \"# pathetic attempt at a malicious script in Galaxy\\n# it fails because the job execution environment gives write access to few places\\necho \\\"ls -la\\\"\\nls -la\\ncd /\\necho \\\"ls -la after changing to /\\\"\\nls -la\\ntouch \\\"foo_was.here\\\"\\necho \\\"ls -la in root after touch foo_was.here - foo_was_not.here more like it\\\"\\nls -la\\n\"}}, \"io_param\": {\"ppass\": {\"parampass\": \"positional\", \"__current_case__\": 1, \"io\": {\"history_inputs\": [], \"history_outputs\": [{\"__index__\": 0, \"history_name\": \"evil_script_output\", \"history_format\": \"txt\", \"history_CL\": \"STDOUT\", \"history_test\": \"sim_size:0.05\"}], \"collection_outputs\": []}, \"addparam\": {\"edit_params\": \"yes\", \"additional_parameters\": []}}}, \"make\": {\"makeMode\": {\"make_Tool\": \"gentest\", \"__current_case__\": 1, \"galaxy_apikey\": \"fakekey\", \"toolshed_apikey\": \"fakekey\", \"galaxy_url\": \"http://localhost:8080\", \"toolshed_url\": \"http://localhost:9009\", \"tool_version\": \"0.01\", \"tool_desc\": \"Pathetic attempt at malicious scripting with the ToolFactory\", \"help_text\": \"**What it Does**\\n\\nFails to write outside the job working directory and lists /etc/passwd inside the biodocker container because, well, you can.\\nAFAIK it's not possible to actually do much real mischief...\", \"citations\": []}}, \"tool_name\": \"evil_script_that_fails\", \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "2.00", + "type": "tool", + "uuid": "2c731d9e-388b-496d-9bdf-9fa6025dc34f", + "workflow_outputs": [ + { + "label": null, + "output_name": "TF_run_report", + "uuid": "e55f5a3e-aa87-4735-93c6-be52d0b239c0" + }, + { + "label": null, + "output_name": "new_tool", + "uuid": "8a93a60c-fbd0-4158-bd7e-b0db64f223eb" + } + ] + }, + "9": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "errors": null, + "id": 9, + "input_connections": { + "io_param|ppass|io|history_inputs_0|input_files": { + "id": 0, + "output_name": "output" + } + }, + "inputs": [], + "label": null, + "name": "toolfactory", + "outputs": [ + { + "name": "TF_run_report", + "type": "input" + }, + { + "name": "new_tool", + "type": "tgz" + } + ], + "position": { + "bottom": 360.9291687011719, + "height": 213.11666870117188, + "left": 743.0833435058594, + "right": 903.0833435058594, + "top": 147.8125, + "width": 160, + "x": 743.0833435058594, + "y": 147.8125 + }, + "post_job_actions": {}, + "tool_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "tool_state": "{\"__input_ext\": \"input\", \"__workflow_invocation_uuid__\": \"f1d43bed5d0811ebac99cda6b6778595\", \"chromInfo\": \"/home/ross/galaxy-dev/tool-data/shared/ucsc/chrom/?.len\", \"cl_prefix\": \"\", \"cover\": {\"commover\": \"no\", \"__current_case__\": 0, \"command_override\": \"\", \"test_override\": \"\"}, \"deps\": {\"packages\": \"python\", \"usescript\": {\"choosescript\": \"yes\", \"__current_case__\": 1, \"scriptrunner\": \"python\", \"dynScript\": \"## reverse order of text by row\\n## ToolFactory demonstration\\n## positional parameters\\nimport sys\\ninp = sys.argv[1]\\noutp = sys.argv[2]\\ni = open(inp,'r').readlines()\\no = open(outp,'w')\\nfor row in i:\\n rs = row.rstrip()\\n rs = list(rs)\\n rs.reverse()\\n o.write(''.join(rs))\\n o.write('\\\\n')\\no.close()\"}}, \"io_param\": {\"ppass\": {\"parampass\": \"positional\", \"__current_case__\": 1, \"io\": {\"history_inputs\": [{\"__index__\": 0, \"input_files\": {\"__class__\": \"ConnectedValue\"}, \"input_formats\": [\"txt\"], \"input_label\": \"Input text file to be reversed\", \"input_help\": \"\", \"input_CL\": \"1\", \"input_repeat\": \"false\"}], \"history_outputs\": [{\"__index__\": 0, \"history_name\": \"pyrev_positionalparse_output\", \"history_format\": \"txt\", \"history_CL\": \"2\", \"history_test\": \"diff:0\"}], \"collection_outputs\": []}, \"addparam\": {\"edit_params\": \"yes\", \"additional_parameters\": []}}}, \"make\": {\"makeMode\": {\"make_Tool\": \"gentest\", \"__current_case__\": 1, \"galaxy_apikey\": \"fakekey\", \"toolshed_apikey\": \"fakekey\", \"galaxy_url\": \"http://localhost:8080\", \"toolshed_url\": \"http://localhost:9009\", \"tool_version\": \"0.01\", \"tool_desc\": \"ToolFactory demonstration python script with positional parameters\", \"help_text\": \"**What it Does**\\nReverse lines in a text file\\nToolFactory positional parameter python script example\", \"citations\": []}}, \"tool_name\": \"pyrev_pos_test\", \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "2.00", + "type": "tool", + "uuid": "943b3b56-4a1f-43c6-a200-df7233f9378f", + "workflow_outputs": [ + { + "label": null, + "output_name": "TF_run_report", + "uuid": "af3db4c8-24a6-46ce-9e0c-cffc8a95afac" + }, + { + "label": null, + "output_name": "new_tool", + "uuid": "104216a3-2979-4e75-b540-c2403db53a00" + } + ] + }, + "10": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "errors": null, + "id": 10, + "input_connections": { + "io_param|ppass|io|history_inputs_0|input_files": { + "id": 0, + "output_name": "output" + } + }, + "inputs": [], + "label": null, + "name": "toolfactory", + "outputs": [ + { + "name": "TF_run_report", + "type": "input" + }, + { + "name": "new_tool", + "type": "tgz" + } + ], + "position": { + "bottom": 377.1791687011719, + "height": 213.11666870117188, + "left": 1005.5833435058594, + "right": 1165.5833435058594, + "top": 164.0625, + "width": 160, + "x": 1005.5833435058594, + "y": 164.0625 + }, + "post_job_actions": {}, + "tool_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "tool_state": "{\"__input_ext\": \"input\", \"__workflow_invocation_uuid__\": \"f1d43bed5d0811ebac99cda6b6778595\", \"chromInfo\": \"/home/ross/galaxy-dev/tool-data/shared/ucsc/chrom/?.len\", \"cl_prefix\": \"\", \"cover\": {\"commover\": \"no\", \"__current_case__\": 0, \"command_override\": \"\", \"test_override\": \"\"}, \"deps\": {\"packages\": \"python\", \"usescript\": {\"choosescript\": \"yes\", \"__current_case__\": 1, \"scriptrunner\": \"python\", \"dynScript\": \"# reverse order of text by row\\nimport argparse\\nparser = argparse.ArgumentParser()\\na = parser.add_argument\\na('--infile',default='')\\na('--pyrevargparse_outfile',default=None)\\nargs = parser.parse_args()\\ninp = args.infile\\noutp = args.pyrevargparse_outfile\\ni = open(inp,'r').readlines()\\no = open(outp,'w')\\nfor row in i:\\n rs = row.rstrip()\\n rs = list(rs)\\n rs.reverse()\\n o.write(''.join(rs))\\n o.write('\\\\n')\\no.close()\"}}, \"io_param\": {\"ppass\": {\"parampass\": \"argparse\", \"__current_case__\": 0, \"io\": {\"history_inputs\": [{\"__index__\": 0, \"input_files\": {\"__class__\": \"ConnectedValue\"}, \"input_formats\": [\"txt\"], \"input_label\": \"input file to be reversed\", \"input_help\": \"\", \"input_CL\": \"infile\", \"input_repeat\": \"false\"}], \"history_outputs\": [{\"__index__\": 0, \"history_name\": \"pyrevargparse_outfile\", \"history_format\": \"txt\", \"history_CL\": \"pyrevargparse_outfile\", \"history_test\": \"diff:0\"}], \"collection_outputs\": []}, \"addparam\": {\"edit_params\": \"yes\", \"additional_parameters\": []}}}, \"make\": {\"makeMode\": {\"make_Tool\": \"gentest\", \"__current_case__\": 1, \"galaxy_apikey\": \"fakekey\", \"toolshed_apikey\": \"fakekey\", \"galaxy_url\": \"http://localhost:8080\", \"toolshed_url\": \"http://localhost:9009\", \"tool_version\": \"0.01\", \"tool_desc\": \"Toolshed demonstration python script with argparse style parameters\", \"help_text\": \"**What it Does**\\nReverses lines in a text file.\\nToolFactory demonstration of argparse/python script\", \"citations\": []}}, \"tool_name\": \"pyrev_argparse_test\", \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "2.00", + "type": "tool", + "uuid": "13c34ba4-483c-4968-bdc0-3443a6f7abc0", + "workflow_outputs": [ + { + "label": null, + "output_name": "TF_run_report", + "uuid": "68fc4dc8-01d5-4f17-a127-f679da8acdf5" + }, + { + "label": null, + "output_name": "new_tool", + "uuid": "3b0ad2d2-ad3f-473c-b264-cf4a787cd2b9" + } + ] + }, + "11": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "errors": null, + "id": 11, + "input_connections": { + "io_param|ppass|io|history_inputs_0|input_files": { + "id": 0, + "output_name": "output" + } + }, + "inputs": [], + "label": null, + "name": "toolfactory", + "outputs": [ + { + "name": "TF_run_report", + "type": "input" + }, + { + "name": "new_tool", + "type": "tgz" + } + ], + "position": { + "bottom": 345.7291717529297, + "height": 164.1666717529297, + "left": 1261.8333435058594, + "right": 1421.8333435058594, + "top": 181.5625, + "width": 160, + "x": 1261.8333435058594, + "y": 181.5625 + }, + "post_job_actions": {}, + "tool_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "tool_state": "{\"__input_ext\": \"input\", \"__workflow_invocation_uuid__\": \"f1d43bed5d0811ebac99cda6b6778595\", \"chromInfo\": \"/home/ross/galaxy-dev/tool-data/shared/ucsc/chrom/?.len\", \"cl_prefix\": \"\", \"cover\": {\"commover\": \"no\", \"__current_case__\": 0, \"command_override\": \"\", \"test_override\": \"\"}, \"deps\": {\"packages\": \"\", \"usescript\": {\"choosescript\": \"yes\", \"__current_case__\": 1, \"scriptrunner\": \"bash\", \"dynScript\": \"tac | rev\"}}, \"io_param\": {\"ppass\": {\"parampass\": \"0\", \"__current_case__\": 2, \"io\": {\"history_inputs\": [{\"__index__\": 0, \"input_files\": {\"__class__\": \"ConnectedValue\"}, \"input_formats\": [\"txt\"], \"input_label\": \"Input text file to be reversed\", \"input_help\": \"\", \"input_CL\": \"STDIN\", \"input_repeat\": \"false\"}], \"history_outputs\": [{\"__index__\": 0, \"history_name\": \"tacrev_reversed_output\", \"history_format\": \"txt\", \"history_CL\": \"STDOUT\", \"history_test\": \"diff:0\"}], \"collection_outputs\": []}}}, \"make\": {\"makeMode\": {\"make_Tool\": \"gentest\", \"__current_case__\": 1, \"galaxy_apikey\": \"fakekey\", \"toolshed_apikey\": \"fakekey\", \"galaxy_url\": \"http://localhost:8080\", \"toolshed_url\": \"http://localhost:9009\", \"tool_version\": \"0.01\", \"tool_desc\": \"ToolFactory demonstration bash script STDIN/STDOUT\", \"help_text\": \"**What it Does**\\ntac | rev\", \"citations\": []}}, \"tool_name\": \"tacrev\", \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "2.00", + "type": "tool", + "uuid": "9bf7e621-e45c-48c2-83ec-0f3abb9d7af1", + "workflow_outputs": [ + { + "label": null, + "output_name": "TF_run_report", + "uuid": "536b8fe5-8ae6-4fe6-90fd-44558585bd6d" + }, + { + "label": null, + "output_name": "new_tool", + "uuid": "722e9d70-5576-4b27-8b65-5a2da366885d" + } + ] + }, + "12": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "errors": null, + "id": 12, + "input_connections": { + "io_param|ppass|io|history_inputs_0|input_files": { + "id": 2, + "output_name": "output" + } + }, + "inputs": [], + "label": null, + "name": "toolfactory", + "outputs": [ + { + "name": "TF_run_report", + "type": "input" + }, + { + "name": "new_tool", + "type": "tgz" + } + ], + "position": { + "bottom": 645.9291687011719, + "height": 213.11666870117188, + "left": 791.8333435058594, + "right": 951.8333435058594, + "top": 432.8125, + "width": 160, + "x": 791.8333435058594, + "y": 432.8125 + }, + "post_job_actions": {}, + "tool_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "tool_state": "{\"__input_ext\": \"input\", \"__workflow_invocation_uuid__\": \"f1d43bed5d0811ebac99cda6b6778595\", \"chromInfo\": \"/home/ross/galaxy-dev/tool-data/shared/ucsc/chrom/?.len\", \"cl_prefix\": \"\", \"cover\": {\"commover\": \"no\", \"__current_case__\": 0, \"command_override\": \"\", \"test_override\": \"\"}, \"deps\": {\"packages\": \"perl\", \"usescript\": {\"choosescript\": \"yes\", \"__current_case__\": 1, \"scriptrunner\": \"perl\", \"dynScript\": \"#!/usr/bin/perl -w\\n\\n# usage : perl toolExample.pl <FASTA file> <output file>\\n\\nopen (IN, \\\"<$ARGV[0]\\\");\\nopen (OUT, \\\">$ARGV[1]\\\");\\nwhile (<IN>) {\\n chop;\\n if (m/^>/) {\\n s/^>//;\\n if ($. > 1) {\\n print OUT sprintf(\\\"%.3f\\\", $gc/$length) . \\\"\\\\n\\\";\\n }\\n $gc = 0;\\n $length = 0;\\n } else {\\n ++$gc while m/[gc]/ig;\\n $length += length $_;\\n }\\n}\\nprint OUT sprintf(\\\"%.3f\\\", $gc/$length) . \\\"\\\\n\\\";\\nclose( IN );\\nclose( OUT );\"}}, \"io_param\": {\"ppass\": {\"parampass\": \"positional\", \"__current_case__\": 1, \"io\": {\"history_inputs\": [{\"__index__\": 0, \"input_files\": {\"__class__\": \"ConnectedValue\"}, \"input_formats\": [\"fasta\"], \"input_label\": \"Input fasta for GC estimate\", \"input_help\": \"\", \"input_CL\": \"1\", \"input_repeat\": \"false\"}], \"history_outputs\": [{\"__index__\": 0, \"history_name\": \"perl_gc_output\", \"history_format\": \"txt\", \"history_CL\": \"2\", \"history_test\": \"diff:0\"}], \"collection_outputs\": []}, \"addparam\": {\"edit_params\": \"yes\", \"additional_parameters\": []}}}, \"make\": {\"makeMode\": {\"make_Tool\": \"gentest\", \"__current_case__\": 1, \"galaxy_apikey\": \"fakekey\", \"toolshed_apikey\": \"fakekey\", \"galaxy_url\": \"http://localhost:8080\", \"toolshed_url\": \"http://localhost:9009\", \"tool_version\": \"0.01\", \"tool_desc\": \"ToolFactory demonstration of a perl script with positional parameters \", \"help_text\": \"**What it Does**\\n\\nGC calculation simple tool example from Planemo documentation.\", \"citations\": []}}, \"tool_name\": \"perl_gc_counter\", \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "2.00", + "type": "tool", + "uuid": "9d0f5255-5190-4498-976e-cb82e920fc1d", + "workflow_outputs": [ + { + "label": null, + "output_name": "TF_run_report", + "uuid": "7016b25e-02fa-4082-911f-ac12d738be4d" + }, + { + "label": null, + "output_name": "new_tool", + "uuid": "679626f2-75c7-4c6e-9275-ee9f587e4529" + } + ] + }, + "13": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "errors": null, + "id": 13, + "input_connections": { + "io_param|ppass|io|history_inputs_0|input_files": { + "id": 1, + "output_name": "output" + }, + "io_param|ppass|io|history_inputs_1|input_files": { + "id": 2, + "output_name": "output" + } + }, + "inputs": [], + "label": null, + "name": "toolfactory", + "outputs": [ + { + "name": "TF_run_report", + "type": "input" + }, + { + "name": "new_tool", + "type": "tgz" + } + ], + "position": { + "bottom": 438.0958251953125, + "height": 319.0333251953125, + "left": 1448.0833435058594, + "right": 1608.0833435058594, + "top": 119.0625, + "width": 160, + "x": 1448.0833435058594, + "y": 119.0625 + }, + "post_job_actions": {}, + "tool_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "tool_state": "{\"__input_ext\": \"input\", \"__workflow_invocation_uuid__\": \"491d7ad65c4211ebac99cda6b6778595\", \"chromInfo\": \"/home/ross/galaxy-dev/tool-data/shared/ucsc/chrom/?.len\", \"cl_prefix\": \"\", \"cover\": {\"commover\": \"no\", \"__current_case__\": 0, \"command_override\": \"\", \"test_override\": \"\"}, \"deps\": {\"packages\": \"bwa=0.7.15, samtools=1.3\", \"usescript\": {\"choosescript\": \"yes\", \"__current_case__\": 1, \"scriptrunner\": \"bash\", \"dynScript\": \"REFFILE=$1\\nFASTQ=$2\\nBAMOUT=$3\\nrm -f \\\"refalias\\\"\\nln -s \\\"$REFFILE\\\" \\\"refalias\\\"\\nbwa index -a is \\\"refalias\\\"\\nbwa mem -t \\\"2\\\" -v 1 \\\"refalias\\\" \\\"$FASTQ\\\" > tempsam\\nsamtools view -Sb tempsam > temporary_bam_file.bam\\nsamtools sort -o \\\"$BAMOUT\\\" temporary_bam_file.bam\\n\"}}, \"io_param\": {\"ppass\": {\"parampass\": \"positional\", \"__current_case__\": 1, \"io\": {\"history_inputs\": [{\"__index__\": 0, \"input_files\": {\"__class__\": \"ConnectedValue\"}, \"input_formats\": [\"fasta\"], \"input_label\": \"Reference sequence to map reads against\", \"input_help\": \"\", \"input_CL\": \"1\", \"input_repeat\": \"false\"}, {\"__index__\": 1, \"input_files\": {\"__class__\": \"ConnectedValue\"}, \"input_formats\": [\"fastq\"], \"input_label\": \"Reads to map\", \"input_help\": \"\", \"input_CL\": \"2\", \"input_repeat\": \"false\"}], \"history_outputs\": [{\"__index__\": 0, \"history_name\": \"bwa_test_bash_output\", \"history_format\": \"bam\", \"history_CL\": \"3\", \"history_test\": \"sim_size:0.01\"}], \"collection_outputs\": []}, \"addparam\": {\"edit_params\": \"yes\", \"additional_parameters\": []}}}, \"make\": {\"makeMode\": {\"make_Tool\": \"gentest\", \"__current_case__\": 1, \"galaxy_apikey\": \"fakekey\", \"toolshed_apikey\": \"fakekey\", \"galaxy_url\": \"http://localhost:8080\", \"toolshed_url\": \"http://localhost:9009\", \"tool_version\": \"0.01\", \"tool_desc\": \"bwa mem example as a ToolFactory positional parameter bash script\", \"help_text\": \"**What it Does**\\n\\nbwa mem Planemo example as a bash script ToolFactory tool.\", \"citations\": []}}, \"tool_name\": \"bwa_test_toolfactory_positional_bash\", \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "2.00", + "type": "tool", + "uuid": "2793ad73-b24d-4906-8372-f9e06e3a3149", + "workflow_outputs": [ + { + "label": null, + "output_name": "TF_run_report", + "uuid": "21c99dae-bc68-416d-8b8b-e864529bf86f" + }, + { + "label": null, + "output_name": "new_tool", + "uuid": "8fe4fa99-b976-423c-b2de-59e2b52640de" + } + ] + }, + "14": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "errors": null, + "id": 14, + "input_connections": { + "io_param|ppass|io|history_inputs_0|input_files": { + "id": 2, + "output_name": "output" + } + }, + "inputs": [], + "label": null, + "name": "toolfactory", + "outputs": [ + { + "name": "TF_run_report", + "type": "input" + }, + { + "name": "new_tool", + "type": "tgz" + } + ], + "position": { + "bottom": 318.4291687011719, + "height": 213.11666870117188, + "left": 1681.8333435058594, + "right": 1841.8333435058594, + "top": 105.3125, + "width": 160, + "x": 1681.8333435058594, + "y": 105.3125 + }, + "post_job_actions": {}, + "tool_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "tool_state": "{\"__input_ext\": \"input\", \"__workflow_invocation_uuid__\": \"f1d43bed5d0811ebac99cda6b6778595\", \"chromInfo\": \"/home/ross/galaxy-dev/tool-data/shared/ucsc/chrom/?.len\", \"cl_prefix\": \"\", \"cover\": {\"commover\": \"no\", \"__current_case__\": 0, \"command_override\": \"\", \"test_override\": \"\"}, \"deps\": {\"packages\": \"sed\", \"usescript\": {\"choosescript\": \"no\", \"__current_case__\": 0, \"dynScript\": \"\", \"scriptrunner\": \"\"}}, \"io_param\": {\"ppass\": {\"parampass\": \"positional\", \"__current_case__\": 1, \"io\": {\"history_inputs\": [{\"__index__\": 0, \"input_files\": {\"__class__\": \"ConnectedValue\"}, \"input_formats\": [\"txt\"], \"input_label\": \"Input text to be edited\", \"input_help\": \"\", \"input_CL\": \"2\", \"input_repeat\": \"false\"}], \"history_outputs\": [{\"__index__\": 0, \"history_name\": \"sedtest_edited_output\", \"history_format\": \"txt\", \"history_CL\": \"STDOUT\", \"history_test\": \"diff:0\"}], \"collection_outputs\": []}, \"addparam\": {\"edit_params\": \"yes\", \"additional_parameters\": [{\"__index__\": 0, \"param_name\": \"sedstring\", \"ap_type\": {\"param_type\": \"text\", \"__current_case__\": 0, \"param_value\": \"s/A/Abjork!/g\"}, \"param_label\": \"sed edit string - subsitute some text for some other text globally\", \"param_help\": \"\", \"param_CL\": \"1\", \"param_CLprefixed\": \"\"}]}}}, \"make\": {\"makeMode\": {\"make_Tool\": \"gentest\", \"__current_case__\": 1, \"galaxy_apikey\": \"fakekey\", \"toolshed_apikey\": \"fakekey\", \"galaxy_url\": \"http://localhost:8080\", \"toolshed_url\": \"http://localhost:9009\", \"tool_version\": \"0.01\", \"tool_desc\": \"ToolFactory sed example\", \"help_text\": \"**What it Does**\\nEdits a text file using a sed string\", \"citations\": []}}, \"tool_name\": \"sedtest_toolshed\", \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "2.00", + "type": "tool", + "uuid": "eeebca90-20e3-48fe-a894-846833a3298f", + "workflow_outputs": [ + { + "label": null, + "output_name": "TF_run_report", + "uuid": "255b5192-5573-4471-a5c2-a8e685a91581" + }, + { + "label": null, + "output_name": "new_tool", + "uuid": "c5789e2e-9928-4559-a647-937f41c4e943" + } + ] + }, + "15": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "errors": null, + "id": 15, + "input_connections": { + "io_param|ppass|io|history_inputs_0|input_files": { + "id": 3, + "output_name": "output" + }, + "io_param|ppass|io|history_inputs_1|input_files": { + "id": 1, + "output_name": "output" + } + }, + "inputs": [], + "label": null, + "name": "toolfactory", + "outputs": [ + { + "name": "TF_run_report", + "type": "input" + }, + { + "name": "new_tool", + "type": "tgz" + } + ], + "position": { + "bottom": 714.3458251953125, + "height": 319.0333251953125, + "left": 1703.0833435058594, + "right": 1863.0833435058594, + "top": 395.3125, + "width": 160, + "x": 1703.0833435058594, + "y": 395.3125 + }, + "post_job_actions": {}, + "tool_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "tool_state": "{\"__input_ext\": \"input\", \"__workflow_invocation_uuid__\": \"f1d43bed5d0811ebac99cda6b6778595\", \"chromInfo\": \"/home/ross/galaxy-dev/tool-data/shared/ucsc/chrom/?.len\", \"cl_prefix\": \"\", \"cover\": {\"commover\": \"no\", \"__current_case__\": 0, \"command_override\": \"\", \"test_override\": \"\"}, \"deps\": {\"packages\": \"bwa=0.7.15, samtools=1.3\", \"usescript\": {\"choosescript\": \"yes\", \"__current_case__\": 1, \"scriptrunner\": \"bash\", \"dynScript\": \"REFFILE=$1\\nFASTQ=$2\\nBAMOUT=$3\\nrm -f \\\"refalias\\\"\\nln -s \\\"$REFFILE\\\" \\\"refalias\\\"\\nbwa index -a is \\\"refalias\\\"\\nbwa mem -t \\\"2\\\" -v 1 \\\"refalias\\\" \\\"$FASTQ\\\" > tempsam\\nsamtools view -Sb tempsam > temporary_bam_file.bam\\nsamtools sort -o \\\"$BAMOUT\\\" temporary_bam_file.bam\\n\"}}, \"io_param\": {\"ppass\": {\"parampass\": \"positional\", \"__current_case__\": 1, \"io\": {\"history_inputs\": [{\"__index__\": 0, \"input_files\": {\"__class__\": \"ConnectedValue\"}, \"input_formats\": [\"fasta\"], \"input_label\": \"Reference sequence to map reads against\", \"input_help\": \"\", \"input_CL\": \"1\", \"input_repeat\": \"false\"}, {\"__index__\": 1, \"input_files\": {\"__class__\": \"ConnectedValue\"}, \"input_formats\": [\"fastq\"], \"input_label\": \"Reads to map\", \"input_help\": \"\", \"input_CL\": \"2\", \"input_repeat\": \"false\"}], \"history_outputs\": [{\"__index__\": 0, \"history_name\": \"bwa_test_bash_output\", \"history_format\": \"bam\", \"history_CL\": \"3\", \"history_test\": \"sim_size:0.01\"}], \"collection_outputs\": []}, \"addparam\": {\"edit_params\": \"yes\", \"additional_parameters\": []}}}, \"make\": {\"makeMode\": {\"make_Tool\": \"gentest\", \"__current_case__\": 1, \"galaxy_apikey\": \"fakekey\", \"toolshed_apikey\": \"fakekey\", \"galaxy_url\": \"http://localhost:8080\", \"toolshed_url\": \"http://localhost:9009\", \"tool_version\": \"0.01\", \"tool_desc\": \"bwa mem example as a ToolFactory positional parameter bash script\", \"help_text\": \"**What it Does**\\n\\nbwa mem Planemo example as a bash script ToolFactory tool.\", \"citations\": []}}, \"tool_name\": \"bwa_test_toolfactory_positional_bash\", \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "2.00", + "type": "tool", + "uuid": "c2e9186d-b357-40b6-93ee-75465975c310", + "workflow_outputs": [ + { + "label": null, + "output_name": "TF_run_report", + "uuid": "4e29a365-794a-4899-93e9-6ba7c9d839c9" + }, + { + "label": null, + "output_name": "new_tool", + "uuid": "3ad67e08-7d40-4b9d-924f-c69270243624" + } + ] + }, + "16": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "errors": null, + "id": 16, + "input_connections": { + "io_param|ppass|io|history_inputs_0|input_files": { + "id": 3, + "output_name": "output" + }, + "io_param|ppass|io|history_inputs_1|input_files": { + "id": 1, + "output_name": "output" + } + }, + "inputs": [], + "label": null, + "name": "toolfactory", + "outputs": [ + { + "name": "TF_run_report", + "type": "input" + }, + { + "name": "new_tool", + "type": "tgz" + } + ], + "position": { + "bottom": 639.3458251953125, + "height": 319.0333251953125, + "left": 1923.0833435058594, + "right": 2083.0833435058594, + "top": 320.3125, + "width": 160, + "x": 1923.0833435058594, + "y": 320.3125 + }, + "post_job_actions": {}, + "tool_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "tool_state": "{\"__input_ext\": \"input\", \"__workflow_invocation_uuid__\": \"f1d43bed5d0811ebac99cda6b6778595\", \"chromInfo\": \"/home/ross/galaxy-dev/tool-data/shared/ucsc/chrom/?.len\", \"cl_prefix\": \"\", \"cover\": {\"commover\": \"yes\", \"__current_case__\": 1, \"command_override\": \"## Build reference\\n#set $reference_fasta_filename = \\\"localref.fa\\\"\\nln -s \\\"${ref_file}\\\" \\\"${reference_fasta_filename}\\\" ;\\nbwa index -a is \\\"${reference_fasta_filename}\\\" ;\\nbwa mem -t \\\"\\\\${GALAXY_SLOTS:-4}\\\" -v 1 \\\"${reference_fasta_filename}\\\" \\\"${fastq_input1}\\\" | samtools view -Sb - > temporary_bam_file.bam ;\\nsamtools sort -o \\\"${bwa_test_commover_bam_output}\\\" temporary_bam_file.bam\", \"test_override\": \"\"}, \"deps\": {\"packages\": \"bwa=0.7.15, samtools=1.3\", \"usescript\": {\"choosescript\": \"no\", \"__current_case__\": 0, \"dynScript\": \"\", \"scriptrunner\": \"\"}}, \"io_param\": {\"ppass\": {\"parampass\": \"argparse\", \"__current_case__\": 0, \"io\": {\"history_inputs\": [{\"__index__\": 0, \"input_files\": {\"__class__\": \"ConnectedValue\"}, \"input_formats\": [\"fasta\"], \"input_label\": \"Reference sequence to align reads\", \"input_help\": \"\", \"input_CL\": \"ref_file\", \"input_repeat\": \"false\"}, {\"__index__\": 1, \"input_files\": {\"__class__\": \"ConnectedValue\"}, \"input_formats\": [\"fastqsanger\"], \"input_label\": \"Fastqsanger file containing reads to be mapped against reference\", \"input_help\": \"\", \"input_CL\": \"fastq_input1\", \"input_repeat\": \"false\"}], \"history_outputs\": [{\"__index__\": 0, \"history_name\": \"bwa_test_commover_bam_output\", \"history_format\": \"bam\", \"history_CL\": \"\", \"history_test\": \"sim_size:0.01\"}], \"collection_outputs\": []}, \"addparam\": {\"edit_params\": \"yes\", \"additional_parameters\": []}}}, \"make\": {\"makeMode\": {\"make_Tool\": \"gentest\", \"__current_case__\": 1, \"galaxy_apikey\": \"fakekey\", \"toolshed_apikey\": \"fakekey\", \"galaxy_url\": \"http://localhost:8080\", \"toolshed_url\": \"http://localhost:9009\", \"tool_version\": \"0.01\", \"tool_desc\": \"bwa mem example ToolFactory implementation\", \"help_text\": \"**What it Does**\\n\\nbwa mem Planemo example reproduced with command over-ride in the ToolFactory\", \"citations\": []}}, \"tool_name\": \"bwa_test_command_override\", \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "2.00", + "type": "tool", + "uuid": "f773080d-adb5-48ba-af01-b25cd0977d30", + "workflow_outputs": [ + { + "label": null, + "output_name": "TF_run_report", + "uuid": "915dddb0-5d5b-46e7-aa49-318672bf932b" + }, + { + "label": null, + "output_name": "new_tool", + "uuid": "4938a710-5395-41b2-9863-e69dc2a2cc9c" + } + ] + }, + "17": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "errors": null, + "id": 17, + "input_connections": { + "io_param|ppass|io|history_inputs_0|input_files": { + "id": 15, + "output_name": "new_tool" + } + }, + "inputs": [], + "label": null, + "name": "toolfactory", + "outputs": [ + { + "name": "TF_run_report", + "type": "input" + }, + { + "name": "new_tool", + "type": "tgz" + } + ], + "position": { + "bottom": 942.1791687011719, + "height": 213.11666870117188, + "left": 1928.0833435058594, + "right": 2088.0833435058594, + "top": 729.0625, + "width": 160, + "x": 1928.0833435058594, + "y": 729.0625 + }, + "post_job_actions": {}, + "tool_id": "toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_docker/rgtfd/2.00", + "tool_state": "{\"__input_ext\": \"input\", \"__workflow_invocation_uuid__\": \"f1d43bed5d0811ebac99cda6b6778595\", \"chromInfo\": \"/home/ross/galaxy-dev/tool-data/shared/ucsc/chrom/?.len\", \"cl_prefix\": \"\", \"cover\": {\"commover\": \"no\", \"__current_case__\": 0, \"command_override\": \"\", \"test_override\": \"\"}, \"deps\": {\"packages\": \"planemo=0.74.1\", \"usescript\": {\"choosescript\": \"yes\", \"__current_case__\": 1, \"scriptrunner\": \"bash\", \"dynScript\": \"cp $1 foo.tar \\ntar -xvf foo.tar\\nTOOLNAME=`find . -name \\\"*.xml\\\"`\\necho \\\"$$$$$TOOLNAME = $TOOLNAME\\\" > $2\\nplanemo lint $TOOLNAME >> $2\"}}, \"io_param\": {\"ppass\": {\"parampass\": \"positional\", \"__current_case__\": 1, \"io\": {\"history_inputs\": [{\"__index__\": 0, \"input_files\": {\"__class__\": \"ConnectedValue\"}, \"input_formats\": [\"tgz\"], \"input_label\": \"Toolshed archive to be linted\", \"input_help\": \"\", \"input_CL\": \"1\", \"input_repeat\": \"false\"}], \"history_outputs\": [{\"__index__\": 0, \"history_name\": \"lint_output\", \"history_format\": \"txt\", \"history_CL\": \"2\", \"history_test\": \"diff:5\"}], \"collection_outputs\": []}, \"addparam\": {\"edit_params\": \"yes\", \"additional_parameters\": []}}}, \"make\": {\"makeMode\": {\"make_Tool\": \"gentest\", \"__current_case__\": 1, \"galaxy_apikey\": \"\", \"toolshed_apikey\": \"\", \"galaxy_url\": \"\", \"toolshed_url\": \"\", \"tool_version\": \"0.01\", \"tool_desc\": \"Lints a ToolFactory or other xml using planemo\", \"help_text\": \"**What it Does**\\nPlanemo lint\", \"citations\": []}}, \"tool_name\": \"planemo_lint\", \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "2.00", + "type": "tool", + "uuid": "a840dc9b-f235-4962-9830-b7fa9466ca3f", + "workflow_outputs": [ + { + "label": null, + "output_name": "TF_run_report", + "uuid": "5f5ed947-c7b8-405c-9ffd-fde5bb8252fa" + }, + { + "label": null, + "output_name": "new_tool", + "uuid": "b55a2ff0-002c-413d-934a-023a5d802075" + } + ] + } + }, + "tags": [], + "uuid": "dab5623a-1a77-4965-bff6-9d2682915a68", + "version": 1 +}
--- a/toolfactory_docker/rgToolFactory2.py Fri Jan 08 06:58:02 2021 +0000 +++ b/toolfactory_docker/rgToolFactory2.py Sun Jan 24 03:54:01 2021 +0000 @@ -21,6 +21,7 @@ import argparse import copy +import json import logging import os import re @@ -49,40 +50,6 @@ verbose = True debug = True toolFactoryURL = "https://github.com/fubar2/toolfactory" -ourdelim = "~~~" - -# --input_files="$intab.input_files~~~$intab.input_CL~~~ -# $intab.input_formats# ~~~$intab.input_label -# ~~~$intab.input_help" -IPATHPOS = 0 -ICLPOS = 1 -IFMTPOS = 2 -ILABPOS = 3 -IHELPOS = 4 -IOCLPOS = 5 - -# --output_files "$otab.history_name~~~$otab.history_format~~~ -# $otab.history_CL~~~$otab.history_test" -ONAMEPOS = 0 -OFMTPOS = 1 -OCLPOS = 2 -OTESTPOS = 3 -OOCLPOS = 4 - - -# --additional_parameters="$i.param_name~~~$i.param_value~~~ -# $i.param_label~~~$i.param_help~~~$i.param_type -# ~~~$i.CL~~~i$.param_CLoverride" -ANAMEPOS = 0 -AVALPOS = 1 -ALABPOS = 2 -AHELPPOS = 3 -ATYPEPOS = 4 -ACLPOS = 5 -AOVERPOS = 6 -AOCLPOS = 7 - - foo = len(lxml.__version__) # fug you, flake8. Say my name! FAKEEXE = "~~~REMOVE~~~ME~~~" @@ -95,32 +62,9 @@ return time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(time.time())) -def quote_non_numeric(s): - """return a prequoted string for non-numerics - useful for perl and Rscript parameter passing? - """ - try: - _ = float(s) - return s - except ValueError: - return '"%s"' % s - - -html_escape_table = { - "&": "&", - ">": ">", - "<": "<", - "#": "#", - "$": "$", -} cheetah_escape_table = {"$": "\\$", "#": "\\#"} -def html_escape(text): - """Produce entities within text.""" - return "".join([html_escape_table.get(c, c) for c in text]) - - def cheetah_escape(text): """Produce entities within text.""" return "".join([cheetah_escape_table.get(c, c) for c in text]) @@ -138,12 +82,6 @@ return citation_tuples -class Error(Exception): - """Base class for exceptions in this module.""" - - pass - - class ScriptRunner: """Wrapper for an arbitrary script uses galaxyxml @@ -157,9 +95,48 @@ """ self.ourcwd = os.getcwd() self.ourenv = copy.deepcopy(os.environ) - self.infiles = [x.split(ourdelim) for x in args.input_files] - self.outfiles = [x.split(ourdelim) for x in args.output_files] - self.addpar = [x.split(ourdelim) for x in args.additional_parameters] + self.collections = [] + if len(args.collection) > 0: + try: + self.collections = [ + json.loads(x) for x in args.collection if len(x.strip()) > 1 + ] + except Exception: + print( + f"--collections parameter {str(args.collection)} is malformed - should be a dictionary" + ) + try: + self.infiles = [ + json.loads(x) for x in args.input_files if len(x.strip()) > 1 + ] + except Exception: + print( + f"--input_files parameter {str(args.input_files)} is malformed - should be a dictionary" + ) + try: + self.outfiles = [ + json.loads(x) for x in args.output_files if len(x.strip()) > 1 + ] + except Exception: + print( + f"--output_files parameter {args.output_files} is malformed - should be a dictionary" + ) + try: + self.addpar = [ + json.loads(x) for x in args.additional_parameters if len(x.strip()) > 1 + ] + except Exception: + print( + f"--additional_parameters {args.additional_parameters} is malformed - should be a dictionary" + ) + try: + self.selpar = [ + json.loads(x) for x in args.selecttext_parameters if len(x.strip()) > 1 + ] + except Exception: + print( + f"--selecttext_parameters {args.selecttext_parameters} is malformed - should be a dictionary" + ) self.args = args self.cleanuppar() self.lastclredirect = None @@ -235,48 +212,104 @@ if self.args.parampass == "0": self.clsimple() else: - clsuffix = [] - xclsuffix = [] - for i, p in enumerate(self.infiles): - if p[IOCLPOS].upper() == "STDIN": - appendme = [ - p[ICLPOS], - p[ICLPOS], - p[IPATHPOS], - "< %s" % p[IPATHPOS], - ] - xappendme = [ - p[ICLPOS], - p[ICLPOS], - p[IPATHPOS], - "< $%s" % p[ICLPOS], - ] - else: - appendme = [p[IOCLPOS], p[ICLPOS], p[IPATHPOS], ""] - xappendme = [p[IOCLPOS], p[ICLPOS], "$%s" % p[ICLPOS], ""] - clsuffix.append(appendme) - xclsuffix.append(xappendme) - for i, p in enumerate(self.outfiles): - if p[OOCLPOS] == "STDOUT": - self.lastclredirect = [">", p[ONAMEPOS]] - self.lastxclredirect = [">", "$%s" % p[OCLPOS]] - else: - clsuffix.append([p[OCLPOS], p[ONAMEPOS], p[ONAMEPOS], ""]) - xclsuffix.append([p[OCLPOS], p[ONAMEPOS], "$%s" % p[ONAMEPOS], ""]) - for p in self.addpar: - clsuffix.append([p[AOCLPOS], p[ACLPOS], p[AVALPOS], p[AOVERPOS]]) - xclsuffix.append( - [p[AOCLPOS], p[ACLPOS], '"$%s"' % p[ANAMEPOS], p[AOVERPOS]] - ) - clsuffix.sort() - xclsuffix.sort() - self.xclsuffix = xclsuffix - self.clsuffix = clsuffix if self.args.parampass == "positional": + self.prepclpos() self.clpositional() else: + self.prepargp() self.clargparse() + def clsimple(self): + """no parameters - uses < and > for i/o""" + aCL = self.cl.append + aXCL = self.xmlcl.append + if len(self.infiles) > 0: + aCL("<") + aCL(self.infiles[0]["infilename"]) + aXCL("<") + aXCL("$%s" % self.infiles[0]["infilename"]) + if len(self.outfiles) > 0: + aCL(">") + aCL(self.outfiles[0]["name"]) + aXCL(">") + aXCL("$%s" % self.outfiles[0]["name"]) + + def prepargp(self): + clsuffix = [] + xclsuffix = [] + for i, p in enumerate(self.infiles): + if p["origCL"].strip().upper() == "STDIN": + appendme = [ + p["infilename"], + p["infilename"], + "< %s" % p["infilename"], + ] + xappendme = [ + p["infilename"], + p["infilename"], + "< $%s" % p["infilename"], + ] + else: + appendme = [p["CL"], p["CL"], ""] + xappendme = [p["CL"], "$%s" % p["CL"], ""] + clsuffix.append(appendme) + xclsuffix.append(xappendme) + for i, p in enumerate(self.outfiles): + if p["origCL"].strip().upper() == "STDOUT": + self.lastclredirect = [">", p["name"]] + self.lastxclredirect = [">", "$%s" % p["name"]] + else: + clsuffix.append([p["name"], p["name"], ""]) + xclsuffix.append([p["name"], "$%s" % p["name"], ""]) + for p in self.addpar: + clsuffix.append([p["CL"], p["name"], p["override"]]) + xclsuffix.append([p["CL"], '"$%s"' % p["name"], p["override"]]) + for p in self.selpar: + clsuffix.append([p["CL"], p["name"], p["override"]]) + xclsuffix.append([p["CL"], '"$%s"' % p["name"], p["override"]]) + clsuffix.sort() + xclsuffix.sort() + self.xclsuffix = xclsuffix + self.clsuffix = clsuffix + + def prepclpos(self): + clsuffix = [] + xclsuffix = [] + for i, p in enumerate(self.infiles): + if p["origCL"].strip().upper() == "STDIN": + appendme = [ + "999", + p["infilename"], + "< $%s" % p["infilename"], + ] + xappendme = [ + "999", + p["infilename"], + "< $%s" % p["infilename"], + ] + else: + appendme = [p["CL"], p["infilename"], ""] + xappendme = [p["CL"], "$%s" % p["infilename"], ""] + clsuffix.append(appendme) + xclsuffix.append(xappendme) + for i, p in enumerate(self.outfiles): + if p["origCL"].strip().upper() == "STDOUT": + self.lastclredirect = [">", p["name"]] + self.lastxclredirect = [">", "$%s" % p["name"]] + else: + clsuffix.append([p["CL"], p["name"], ""]) + xclsuffix.append([p["CL"], "$%s" % p["name"], ""]) + for p in self.addpar: + clsuffix.append([p["CL"], p["name"], p["override"]]) + xclsuffix.append([p["CL"], '"$%s"' % p["name"], p["override"]]) + for p in self.selpar: + clsuffix.append([p["CL"], p["name"], p["override"]]) + xclsuffix.append([p["CL"], '"$%s"' % p["name"], p["override"]]) + clsuffix.sort() + xclsuffix.sort() + self.xclsuffix = xclsuffix + self.clsuffix = clsuffix + def prepScript(self): rx = open(self.args.script_path, "r").readlines() rx = [x.rstrip() for x in rx] @@ -301,78 +334,50 @@ if self.args.parampass == "positional": for i, p in enumerate(self.infiles): assert ( - p[ICLPOS].isdigit() or p[ICLPOS].strip().upper() == "STDIN" + p["CL"].isdigit() or p["CL"].strip().upper() == "STDIN" ), "Positional parameters must be ordinal integers - got %s for %s" % ( - p[ICLPOS], - p[ILABPOS], + p["CL"], + p["label"], ) for i, p in enumerate(self.outfiles): assert ( - p[OCLPOS].isdigit() or p[OCLPOS].strip().upper() == "STDOUT" + p["CL"].isdigit() or p["CL"].strip().upper() == "STDOUT" ), "Positional parameters must be ordinal integers - got %s for %s" % ( - p[OCLPOS], - p[ONAMEPOS], + p["CL"], + p["name"], ) for i, p in enumerate(self.addpar): assert p[ - ACLPOS + "CL" ].isdigit(), "Positional parameters must be ordinal integers - got %s for %s" % ( - p[ACLPOS], - p[ANAMEPOS], + p["CL"], + p["name"], ) for i, p in enumerate(self.infiles): infp = copy.copy(p) - icl = infp[ICLPOS] - infp.append(icl) - if ( - infp[ICLPOS].isdigit() - or self.args.parampass == "0" - or infp[ICLPOS].strip().upper() == "STDOUT" - ): - scl = "input%d" % (i + 1) - infp[ICLPOS] = scl + infp["origCL"] = infp["CL"] + if self.args.parampass in ["positional", "0"]: + infp["infilename"] = infp["label"].replace(" ", "_") + else: + infp["infilename"] = infp["CL"] self.infiles[i] = infp for i, p in enumerate(self.outfiles): - p.append(p[OCLPOS]) # keep copy - if (p[OOCLPOS].isdigit() and self.args.parampass != "positional") or p[ - OOCLPOS - ].strip().upper() == "STDOUT": - scl = p[ONAMEPOS] - p[OCLPOS] = scl + p["origCL"] = p["CL"] # keep copy self.outfiles[i] = p for i, p in enumerate(self.addpar): - p.append(p[ACLPOS]) - if p[ACLPOS].isdigit(): - scl = "param%s" % p[ACLPOS] - p[ACLPOS] = scl + p["origCL"] = p["CL"] self.addpar[i] = p - def clsimple(self): - """no parameters - uses < and > for i/o""" - aCL = self.cl.append - aXCL = self.xmlcl.append - - if len(self.infiles) > 0: - aCL("<") - aCL(self.infiles[0][IPATHPOS]) - aXCL("<") - aXCL("$%s" % self.infiles[0][ICLPOS]) - if len(self.outfiles) > 0: - aCL(">") - aCL(self.outfiles[0][OCLPOS]) - aXCL(">") - aXCL("$%s" % self.outfiles[0][ONAMEPOS]) - def clpositional(self): # inputs in order then params aCL = self.cl.append - for (o_v, k, v, koverride) in self.clsuffix: + for (k, v, koverride) in self.clsuffix: if " " in v: aCL("%s" % v) else: aCL(v) aXCL = self.xmlcl.append - for (o_v, k, v, koverride) in self.xclsuffix: + for (k, v, koverride) in self.xclsuffix: aXCL(v) if self.lastxclredirect: aXCL(self.lastxclredirect[0]) @@ -384,7 +389,7 @@ aXCL = self.xmlcl.append # inputs then params in argparse named form - for (o_v, k, v, koverride) in self.xclsuffix: + for (k, v, koverride) in self.xclsuffix: if koverride > "": k = koverride elif len(k.strip()) == 1: @@ -393,7 +398,7 @@ k = "--%s" % k aXCL(k) aXCL(v) - for (o_v, k, v, koverride) in self.clsuffix: + for (k, v, koverride) in self.clsuffix: if koverride > "": k = koverride elif len(k.strip()) == 1: @@ -414,12 +419,12 @@ def doXMLparam(self): """flake8 made me do this...""" - for ( - p - ) in ( - self.outfiles - ): # --output_files "$otab.history_name~~~$otab.history_format~~~$otab.history_CL~~~$otab.history_test" - newname, newfmt, newcl, test, oldcl = p + for p in self.outfiles: + newname = p["name"] + newfmt = p["format"] + newcl = p["CL"] + test = p["test"] + oldcl = p["origCL"] test = test.strip() ndash = self.getNdash(newcl) aparm = gxtp.OutputData( @@ -464,39 +469,50 @@ delta=delta, delta_frac=delta_frac, ) + else: + c = test + tp = gxtp.TestOutput( + name=newname, + value="%s_sample" % newname, + compare=c, + ) self.testparam.append(tp) for p in self.infiles: - newname = p[ICLPOS] - newfmt = p[IFMTPOS] + newname = p["infilename"] + newfmt = p["format"] ndash = self.getNdash(newname) - if not len(p[ILABPOS]) > 0: - alab = p[ICLPOS] + if not len(p["label"]) > 0: + alab = p["CL"] else: - alab = p[ILABPOS] + alab = p["label"] aninput = gxtp.DataParam( newname, optional=False, label=alab, - help=p[IHELPOS], + help=p["help"], format=newfmt, multiple=False, num_dashes=ndash, ) aninput.positional = self.is_positional + if self.is_positional: + if p["origCL"].upper() == "STDIN": + aparm.positional = 9999998 + aparm.command_line_override = "> $%s" % newname + else: + aparm.positional = int(p["origCL"]) + aparm.command_line_override = "$%s" % newname self.tinputs.append(aninput) tparm = gxtp.TestParam(name=newname, value="%s_sample" % newname) self.testparam.append(tparm) for p in self.addpar: - ( - newname, - newval, - newlabel, - newhelp, - newtype, - newcl, - override, - oldcl, - ) = p + newname = p["name"] + newval = p["value"] + newlabel = p["label"] + newhelp = p["help"] + newtype = p["type"] + newcl = p["CL"] + oldcl = p["origCL"] if not len(newlabel) > 0: newlabel = newname ndash = self.getNdash(newname) @@ -524,6 +540,14 @@ value=newval, num_dashes=ndash, ) + elif newtype == "boolean": + aparm = gxtp.BooleanParam( + newname, + label=newname, + help=newhelp, + value=newval, + num_dashes=ndash, + ) else: raise ValueError( 'Unrecognised parameter type "%s" for\ @@ -536,43 +560,90 @@ self.tinputs.append(aparm) tparm = gxtp.TestParam(newname, value=newval) self.testparam.append(tparm) + for p in self.selpar: + newname = p["name"] + newval = p["value"] + newlabel = p["label"] + newhelp = p["help"] + newtype = p["type"] + newcl = p["CL"] + if not len(newlabel) > 0: + newlabel = newname + ndash = self.getNdash(newname) + if newtype == "selecttext": + newtext = p["texts"] + aparm = gxtp.SelectParam( + newname, + label=newlabel, + help=newhelp, + num_dashes=ndash, + ) + for i in range(len(newval)): + anopt = gxtp.SelectOption( + value=newval[i], + text=newtext[i], + ) + aparm.append(anopt) + aparm.positional = self.is_positional + if self.is_positional: + aparm.positional = int(newcl) + self.tinputs.append(aparm) + tparm = gxtp.TestParam(newname, value=newval) + self.testparam.append(tparm) + else: + raise ValueError( + 'Unrecognised parameter type "%s" for\ + selecttext parameter %s in makeXML' + % (newtype, newname) + ) + for p in self.collections: + newkind = p["kind"] + newname = p["name"] + newlabel = p["label"] + newdisc = p["discover"] + collect = gxtp.OutputCollection(newname, label=newlabel, type=newkind) + disc = gxtp.DiscoverDatasets( + pattern=newdisc, directory=f"{newname}", visible="false" + ) + collect.append(disc) + self.toutputs.append(collect) + tparm = gxtp.TestOutput(newname, ftype="pdf") + self.testparam.append(tparm) def doNoXMLparam(self): """filter style package - stdin to stdout""" if len(self.infiles) > 0: - alab = self.infiles[0][ILABPOS] + alab = self.infiles[0]["label"] if len(alab) == 0: - alab = self.infiles[0][ICLPOS] + alab = self.infiles[0]["infilename"] max1s = ( "Maximum one input if parampass is 0 but multiple input files supplied - %s" % str(self.infiles) ) assert len(self.infiles) == 1, max1s - newname = self.infiles[0][ICLPOS] + newname = self.infiles[0]["infilename"] aninput = gxtp.DataParam( newname, optional=False, label=alab, - help=self.infiles[0][IHELPOS], - format=self.infiles[0][IFMTPOS], + help=self.infiles[0]["help"], + format=self.infiles[0]["format"], multiple=False, num_dashes=0, ) aninput.command_line_override = "< $%s" % newname - aninput.positional = self.is_positional + aninput.positional = True self.tinputs.append(aninput) tp = gxtp.TestParam(name=newname, value="%s_sample" % newname) self.testparam.append(tp) if len(self.outfiles) > 0: - newname = self.outfiles[0][OCLPOS] - newfmt = self.outfiles[0][OFMTPOS] + newname = self.outfiles[0]["name"] + newfmt = self.outfiles[0]["format"] anout = gxtp.OutputData(newname, format=newfmt, num_dashes=0) anout.command_line_override = "> $%s" % newname anout.positional = self.is_positional self.toutputs.append(anout) - tp = gxtp.TestOutput( - name=newname, value="%s_sample" % newname, - ) + tp = gxtp.TestOutput(name=newname, value="%s_sample" % newname) self.testparam.append(tp) def makeXML(self): @@ -657,7 +728,7 @@ ): # cannot do this inside galaxyxml as it expects lxml objects for tests part1 = exml.split("<tests>")[0] part2 = exml.split("</tests>")[1] - fixed = "%s\n%s\n%s" % (part1, self.test_override, part2) + fixed = "%s\n%s\n%s" % (part1, "\n".join(self.test_override), part2) exml = fixed # exml = exml.replace('range="1:"', 'range="1000:"') xf = open("%s.xml" % self.tool_name, "w") @@ -666,7 +737,6 @@ xf.close() # ready for the tarball - def run(self): """ generate test outputs by running a command line @@ -700,11 +770,11 @@ retval = subp.returncode else: # work around special case - stdin and write to stdout if len(self.infiles) > 0: - sti = open(self.infiles[0][IPATHPOS], "rb") + sti = open(self.infiles[0]["name"], "rb") else: sti = sys.stdin if len(self.outfiles) > 0: - sto = open(self.outfiles[0][ONAMEPOS], "wb") + sto = open(self.outfiles[0]["name"], "wb") else: sto = sys.stdout subp = subprocess.run( @@ -723,6 +793,211 @@ logging.debug("run done") return retval + def shedLoad(self): + """ + use bioblend to create new repository + or update existing + + """ + if os.path.exists(self.tlog): + sto = open(self.tlog, "a") + else: + sto = open(self.tlog, "w") + + ts = toolshed.ToolShedInstance( + url=self.args.toolshed_url, + key=self.args.toolshed_api_key, + verify=False, + ) + repos = ts.repositories.get_repositories() + rnames = [x.get("name", "?") for x in repos] + rids = [x.get("id", "?") for x in repos] + tfcat = "ToolFactory generated tools" + if self.tool_name not in rnames: + tscat = ts.categories.get_categories() + cnames = [x.get("name", "?").strip() for x in tscat] + cids = [x.get("id", "?") for x in tscat] + catID = None + if tfcat.strip() in cnames: + ci = cnames.index(tfcat) + catID = cids[ci] + res = ts.repositories.create_repository( + name=self.args.tool_name, + synopsis="Synopsis:%s" % self.args.tool_desc, + description=self.args.tool_desc, + type="unrestricted", + remote_repository_url=self.args.toolshed_url, + homepage_url=None, + category_ids=catID, + ) + tid = res.get("id", None) + sto.write(f"#create_repository {self.args.tool_name} tid={tid} res={res}\n") + else: + i = rnames.index(self.tool_name) + tid = rids[i] + try: + res = ts.repositories.update_repository( + id=tid, tar_ball_path=self.newtarpath, commit_message=None + ) + sto.write(f"#update res id {id} ={res}\n") + except ConnectionError: + sto.write( + "####### Is the toolshed running and the API key correct? Bioblend shed upload failed\n" + ) + sto.close() + + def eph_galaxy_load(self): + """ + use ephemeris to load the new tool from the local toolshed after planemo uploads it + """ + if os.path.exists(self.tlog): + tout = open(self.tlog, "a") + else: + tout = open(self.tlog, "w") + cll = [ + "shed-tools", + "install", + "-g", + self.args.galaxy_url, + "--latest", + "-a", + self.args.galaxy_api_key, + "--name", + self.tool_name, + "--owner", + "fubar", + "--toolshed", + self.args.toolshed_url, + "--section_label", + "ToolFactory", + ] + tout.write("running\n%s\n" % " ".join(cll)) + subp = subprocess.run( + cll, + env=self.ourenv, + cwd=self.ourcwd, + shell=False, + stderr=tout, + stdout=tout, + ) + tout.write( + "installed %s - got retcode %d\n" % (self.tool_name, subp.returncode) + ) + tout.close() + return subp.returncode + + def writeShedyml(self): + """for planemo""" + yuser = self.args.user_email.split("@")[0] + yfname = os.path.join(self.tooloutdir, ".shed.yml") + yamlf = open(yfname, "w") + odict = { + "name": self.tool_name, + "owner": yuser, + "type": "unrestricted", + "description": self.args.tool_desc, + "synopsis": self.args.tool_desc, + "category": "TF Generated Tools", + } + yaml.dump(odict, yamlf, allow_unicode=True) + yamlf.close() + + def makeTool(self): + """write xmls and input samples into place""" + if self.args.parampass == 0: + self.doNoXMLparam() + else: + self.makeXML() + if self.args.script_path: + stname = os.path.join(self.tooloutdir, self.sfile) + if not os.path.exists(stname): + shutil.copyfile(self.sfile, stname) + xreal = "%s.xml" % self.tool_name + xout = os.path.join(self.tooloutdir, xreal) + shutil.copyfile(xreal, xout) + for p in self.infiles: + pth = p["name"] + dest = os.path.join(self.testdir, "%s_sample" % p["infilename"]) + shutil.copyfile(pth, dest) + dest = os.path.join(self.repdir, "%s_sample" % p["infilename"]) + shutil.copyfile(pth, dest) + + def makeToolTar(self, report_fail=False): + """move outputs into test-data and prepare the tarball""" + excludeme = "_planemo_test_report.html" + + def exclude_function(tarinfo): + filename = tarinfo.name + return None if filename.endswith(excludeme) else tarinfo + + if os.path.exists(self.tlog): + tout = open(self.tlog, "a") + else: + tout = open(self.tlog, "w") + for p in self.outfiles: + oname = p["name"] + tdest = os.path.join(self.testdir, "%s_sample" % oname) + src = os.path.join(self.testdir, oname) + if not os.path.isfile(tdest): + if os.path.isfile(src): + shutil.copyfile(src, tdest) + dest = os.path.join(self.repdir, "%s.sample" % (oname)) + shutil.copyfile(src, dest) + else: + if report_fail: + tout.write( + "###Tool may have failed - output file %s not found in testdir after planemo run %s." + % (tdest, self.testdir) + ) + tf = tarfile.open(self.newtarpath, "w:gz") + tf.add( + name=self.tooloutdir, + arcname=self.tool_name, + filter=exclude_function, + ) + tf.close() + shutil.copyfile(self.newtarpath, self.args.new_tool) + + def moveRunOutputs(self): + """need to move planemo or run outputs into toolfactory collection""" + with os.scandir(self.tooloutdir) as outs: + for entry in outs: + if not entry.is_file(): + continue + if "." in entry.name: + _, ext = os.path.splitext(entry.name) + if ext in [".tgz", ".json"]: + continue + if ext in [".yml", ".xml", ".yaml"]: + newname = f"{entry.name.replace('.','_')}.txt" + else: + newname = entry.name + else: + newname = f"{entry.name}.txt" + dest = os.path.join(self.repdir, newname) + src = os.path.join(self.tooloutdir, entry.name) + shutil.copyfile(src, dest) + if self.args.include_tests: + with os.scandir(self.testdir) as outs: + for entry in outs: + if (not entry.is_file()) or entry.name.endswith( + "_planemo_test_report.html" + ): + continue + if "." in entry.name: + _, ext = os.path.splitext(entry.name) + if ext in [".tgz", ".json"]: + continue + if ext in [".yml", ".xml", ".yaml"]: + newname = f"{entry.name.replace('.','_')}.txt" + else: + newname = entry.name + else: + newname = f"{entry.name}.txt" + dest = os.path.join(self.repdir, newname) + src = os.path.join(self.testdir, entry.name) + shutil.copyfile(src, dest) + def copy_to_container(self, src, dest, container): """Recreate the src directory tree at dest - full path included""" idir = os.getcwd() @@ -799,17 +1074,17 @@ cl = "chown -R biodocker /toolfactory" prun(container, tout, cl, user="root") _ = container.exec_run(f"ls -la {destdir}") - ptestcl = f"planemo test --update_test_data --no_cleanup --test_data {destdir}/tfout/test-data --galaxy_root /home/biodocker/galaxy-central {ptestpath}" + ptestcl = f"planemo test --test_output {imrep} --update_test_data --no_cleanup --test_data {destdir}/tfout/test-data --galaxy_root /home/biodocker/galaxy-central {ptestpath}" try: _ = container.exec_run(ptestcl) # fails because test outputs missing but updates the test-data directory - except Error: + except Exception: e = sys.exc_info()[0] tout.write(f"#### error: {e} from {ptestcl}\n") cl = f"planemo test --test_output {imrep} --no_cleanup --test_data {destdir}/tfout/test-data --galaxy_root /home/biodocker/galaxy-central {ptestpath}" try: prun(container, tout, cl) - except Error: + except Exception: e = sys.exc_info()[0] tout.write(f"#### error: {e} from {ptestcl}\n") testouts = tempfile.mkdtemp(suffix=None, prefix="tftemp", dir=".") @@ -828,191 +1103,11 @@ tvol.remove() shutil.rmtree(testouts) # leave for debugging - def shedLoad(self): - """ - use bioblend to create new repository - or update existing - - """ - if os.path.exists(self.tlog): - sto = open(self.tlog, "a") - else: - sto = open(self.tlog, "w") - - ts = toolshed.ToolShedInstance( - url=self.args.toolshed_url, key=self.args.toolshed_api_key, verify=False - ) - repos = ts.repositories.get_repositories() - rnames = [x.get("name", "?") for x in repos] - rids = [x.get("id", "?") for x in repos] - tfcat = "ToolFactory generated tools" - if self.tool_name not in rnames: - tscat = ts.categories.get_categories() - cnames = [x.get("name", "?").strip() for x in tscat] - cids = [x.get("id", "?") for x in tscat] - catID = None - if tfcat.strip() in cnames: - ci = cnames.index(tfcat) - catID = cids[ci] - res = ts.repositories.create_repository( - name=self.args.tool_name, - synopsis="Synopsis:%s" % self.args.tool_desc, - description=self.args.tool_desc, - type="unrestricted", - remote_repository_url=self.args.toolshed_url, - homepage_url=None, - category_ids=catID, - ) - tid = res.get("id", None) - sto.write(f"#create_repository {self.args.tool_name} tid={tid} res={res}\n") - else: - i = rnames.index(self.tool_name) - tid = rids[i] - try: - res = ts.repositories.update_repository( - id=tid, tar_ball_path=self.newtarpath, commit_message=None - ) - sto.write(f"#update res id {id} ={res}\n") - except ConnectionError: - sto.write( - "####### Is the toolshed running and the API key correct? Bioblend shed upload failed\n" - ) - sto.close() - - def eph_galaxy_load(self): - """ - use ephemeris to load the new tool from the local toolshed after planemo uploads it - """ - if os.path.exists(self.tlog): - tout = open(self.tlog, "a") - else: - tout = open(self.tlog, "w") - cll = [ - "shed-tools", - "install", - "-g", - self.args.galaxy_url, - "--latest", - "-a", - self.args.galaxy_api_key, - "--name", - self.tool_name, - "--owner", - "fubar", - "--toolshed", - self.args.toolshed_url, - "--section_label", - "ToolFactory", - ] - tout.write("running\n%s\n" % " ".join(cll)) - subp = subprocess.run( - cll, env=self.ourenv, cwd=self.ourcwd, shell=False, stderr=tout, stdout=tout - ) - tout.write( - "installed %s - got retcode %d\n" % (self.tool_name, subp.returncode) - ) - tout.close() - return subp.returncode - - def writeShedyml(self): - """for planemo""" - yuser = self.args.user_email.split("@")[0] - yfname = os.path.join(self.tooloutdir, ".shed.yml") - yamlf = open(yfname, "w") - odict = { - "name": self.tool_name, - "owner": yuser, - "type": "unrestricted", - "description": self.args.tool_desc, - "synopsis": self.args.tool_desc, - "category": "TF Generated Tools", - } - yaml.dump(odict, yamlf, allow_unicode=True) - yamlf.close() - - def makeTool(self): - """write xmls and input samples into place""" - self.makeXML() - if self.args.script_path: - stname = os.path.join(self.tooloutdir, "%s" % (self.sfile)) - if not os.path.exists(stname): - shutil.copyfile(self.sfile, stname) - xreal = "%s.xml" % self.tool_name - xout = os.path.join(self.tooloutdir, xreal) - shutil.copyfile(xreal, xout) - for p in self.infiles: - pth = p[IPATHPOS] - dest = os.path.join(self.testdir, "%s_sample" % p[ICLPOS]) - shutil.copyfile(pth, dest) - - def makeToolTar(self): - """move outputs into test-data and prepare the tarball""" - excludeme = "_planemo_test_report.html" - - def exclude_function(tarinfo): - filename = tarinfo.name - return None if filename.endswith(excludeme) else tarinfo - - if os.path.exists(self.tlog): - tout = open(self.tlog, "a") - else: - tout = open(self.tlog, "w") - for p in self.outfiles: - oname = p[ONAMEPOS] - tdest = os.path.join(self.testdir, "%s_sample" % oname) - if not os.path.isfile(tdest): - src = os.path.join(self.testdir, oname) - if os.path.isfile(src): - shutil.copyfile(src, tdest) - dest = os.path.join(self.repdir, "%s.sample" % (oname)) - shutil.copyfile(src, dest) - else: - tout.write( - "###Output file %s not found in testdir %s. This is normal during the first Planemo run that generates test outputs" - % (tdest, self.testdir) - ) - tf = tarfile.open(self.newtarpath, "w:gz") - tf.add(name=self.tooloutdir, arcname=self.tool_name, filter=exclude_function) - tf.close() - shutil.copyfile(self.newtarpath, self.args.new_tool) - - def moveRunOutputs(self): - """need to move planemo or run outputs into toolfactory collection""" - with os.scandir(self.tooloutdir) as outs: - for entry in outs: - if not entry.is_file(): - continue - if "." in entry.name: - nayme, ext = os.path.splitext(entry.name) - if ext in [".yml", ".xml", ".json", ".yaml"]: - ext = f"{ext}.txt" - else: - ext = ".txt" - ofn = "%s%s" % (entry.name.replace(".", "_"), ext) - dest = os.path.join(self.repdir, ofn) - src = os.path.join(self.tooloutdir, entry.name) - shutil.copyfile(src, dest) - with os.scandir(self.testdir) as outs: - for entry in outs: - if ( - (not entry.is_file()) - or entry.name.endswith("_sample") - or entry.name.endswith("_planemo_test_report.html") - ): - continue - if "." in entry.name: - nayme, ext = os.path.splitext(entry.name) - else: - ext = ".txt" - newname = f"{entry.name}{ext}" - dest = os.path.join(self.repdir, newname) - src = os.path.join(self.testdir, entry.name) - shutil.copyfile(src, dest) - def main(): """ - This is a Galaxy wrapper. It expects to be called by a special purpose tool.xml + This is a Galaxy wrapper. + It expects to be called by a special purpose tool.xml """ parser = argparse.ArgumentParser() @@ -1036,17 +1131,21 @@ a("--command_override", default=None) a("--test_override", default=None) a("--additional_parameters", action="append", default=[]) + a("--selecttext_parameters", action="append", default=[]) a("--edit_additional_parameters", action="store_true", default=False) a("--parampass", default="positional") a("--tfout", default="./tfout") a("--new_tool", default="new_tool") a("--galaxy_url", default="http://localhost:8080") a("--toolshed_url", default="http://localhost:9009") - # make sure this is identical to tool_sheds_conf.xml localhost != 127.0.0.1 so validation fails + # make sure this is identical to tool_sheds_conf.xml + # localhost != 127.0.0.1 so validation fails a("--toolshed_api_key", default="fakekey") a("--galaxy_api_key", default="fakekey") a("--galaxy_root", default="/galaxy-central") a("--galaxy_venv", default="/galaxy_venv") + a("--collection", action="append", default=[]) + a("--include_tests", default=False, action="store_true") args = parser.parse_args() assert not args.bad_user, ( 'UNAUTHORISED: %s is NOT authorized to use this tool until Galaxy admin adds %s to "admin_users" in the galaxy.yml Galaxy configuration file' @@ -1056,10 +1155,6 @@ assert ( args.sysexe or args.packages ), "## Tool Factory wrapper expects an interpreter or an executable package" - args.input_files = [x.replace('"', "").replace("'", "") for x in args.input_files] - # remove quotes we need to deal with spaces in CL params - for i, x in enumerate(args.additional_parameters): - args.additional_parameters[i] = args.additional_parameters[i].replace('"', "") r = ScriptRunner(args) r.writeShedyml() r.makeTool()
--- a/toolfactory_docker/rgToolFactory2.xml Fri Jan 08 06:58:02 2021 +0000 +++ b/toolfactory_docker/rgToolFactory2.xml Sun Jan 24 03:54:01 2021 +0000 @@ -1,6 +1,32 @@ <tool id="rgtfd" name="toolfactory" version="2.00" profile="16.04" > <description>Scripts into tools v2.0</description> <macros> + <xml name="singleText"> + <param name="param_value" type="text" value="" label="Enter this parameter's default text value"> + </param> + </xml> + <xml name="singleInt"> + <param name="param_value" type="integer" value="" label="Enter this parameter's default integer value" > + </param> + </xml> + <xml name="singleFloat"> + <param name="param_value" type="float" value="" label="Enter this parameter's default value"> + </param> + </xml> + <xml name="singleBoolean"> + <param name="param_value" type="boolean" value="" label="Enter this parameter's default value" /> + <param name="truevalue" type="text" value="True" label="Command line value to emit when True" /> + <param name="falsevalue" type="boolean" value="True" label="Command line value to emit when False" /> + </xml> + <xml name="selectText"> + <repeat name="selectTexts" title="Add each option to be presented in a text select box" min="2" default="2" + help="Each text added here will also have a value to be emitted on the command line when the text is chosen"> + <param name="select_text" type="text" value="" label="Enter the explanatory text the user will see for this choice" > + </param> + <param name="select_value" type="text" value="" label="Enter the value for the command line when the user selects this option"> + </param> + </repeat> + </xml> <xml name="tool_metadata"> <param name="tool_version" label="Tool Version - bump this to warn users trying to redo old analyses" type="text" value="0.01" help="If you change your script and regenerate the 'same' tool, you should inform Galaxy (and users) by changing (bumping is traditional) this number"/> @@ -38,9 +64,9 @@ </xml> <xml name="io"> <section name="io" title="Input and output files" expanded="true"> - <repeat name="history_inputs" title="zero or more input data files to pass as parameters to the executable." + <repeat name="history_inputs" title="zero or more input data files to pass on the command line to the executable." help="USE SMALL SAMPLES for the new tool's test. Prompts will form a history item selector as input for users of this new tool"> - <param name="input_files" type="data" format="data" label="Select an input file from your history" optional="true" multiple="false" + <param name="input_files" type="data" format="data" label="Select an input file from your history" multiple="false" help=""/> <param name="input_formats" type="select" multiple="true" label="Select the datatype(s) that your tool/script accepts as input" help="If your datatype is not listed here, it has to be added in galaxy's datatypes_conf.xml" value="tabular"> @@ -48,27 +74,14 @@ <column name="value" index="0"/> </options> </param> - <param name="input_label" type="text" value="" label="This will become the user prompt for the form so please make it informative" - help="Note that '~~~' is an internal delimiter so must not appear in this text field - please work around this technical limitation" > - <sanitizer invalid_char=""> - <valid initial="string.printable"> - <remove value='~~~' /> - </valid> - <mapping initial="none"/> - </sanitizer> + <param name="input_label" type="text" value="" label="This will become the user prompt for the form so please make it informative" > </param> - <param name="input_help" type="text" value="" label="This will become help text on the form." - help="Note that three consecutive ~ cannot be used in this text field - please work around this technical limitation"> - <sanitizer invalid_char=""> - <valid initial="string.printable"> - <remove value='~~~' /> - </valid> - <mapping initial="none"/> - </sanitizer> + <param name="input_help" type="text" value="" label="This will become help text on the form." > </param> <param name="input_CL" type="text" label="Positional: ordinal integer. Argparse: argument name. STDIN if the executable/script expects it" help="If you will pass positional parameters, enter the integer ordinal for this parameter. If Argparse style, '--' will be prepended or '-' if single character" value=""> </param> + <param name="input_repeat" type="boolean" checked="False" truevalue="1" falsevalue="0" label="Allow user to repeat this input as many times as needed." /> </repeat> <repeat name="history_outputs" title="one or more new history items output by the executable to appear in the user history after the tool runs" help="The name will become a history item for users of the new tool you are making containing one of it's outputs"> @@ -91,6 +104,26 @@ <param name="history_test" type="text" label="Test pass decision criterion for this output compared to test generation" help="Available options are diff:[lines], sim_size:[delta (integer) or delta_frac (float)" value="diff:0"/> </repeat> + <repeat name="collection_outputs" title="zero or more new history collections to appear in the user history after the tool runs" + help="A collection contains outputs not needed for downstream tools such as images and intermediate reports" default="0"> + <param name="name" type="text" label="Name for new collection with all outputs not individually passed to history outputs" + help="No spaces! "> + <sanitizer invalid_char="_"> + <valid initial="string.ascii_letters,string.digits" > + <add value="_" /> + </valid> + </sanitizer> + </param> + <param name="kind" type="select" multiple="false" label="Select the kind of collection for this output" + help=""> + <option value="list" selected="true">List</option> + <option value="paired">Paired</option> + <option value="list:paired">List of paired</option> + </param> + <param name="label" type="text" label="Label for this collection" help="" value=""/> + <param name="discover" type="text" label="Discover datasets expression" help="__name_and_ext__ should catch all filenames with extensions" value="__name_and_ext__"/> + </repeat> + </section> </xml> <xml name="additparam"> @@ -100,8 +133,7 @@ <option value="yes" selected="true">Yes, allow user to edit all additional parameters on the generated tool form</option> <option value="no">No - use the fixed values for all additional parameters - no user editing</option> </param> - - <repeat name="additional_parameters" title="zero or more settings to be set by the tool user and passed on the command line" + <repeat name="additional_parameters" title="zero or more command line settings for the user to pass to the executable" help="See examples below to see how these can be parsed by scripts in the various languages"> <param name="param_name" type="text" value="" label="Choose the name for this parameter - MUST not be blank!"> <sanitizer invalid_char=""> @@ -109,37 +141,33 @@ <mapping initial="none"/> </sanitizer> </param> + <conditional name="ap_type"> <param name="param_type" type="select" label="Select the type for this parameter"> - <option value="text" selected="true">text</option> - <option value="integer">integer</option> - <option value="float">float</option> - </param> - <param name="param_value" type="text" value="" label="Enter this parameter's default value" - help="Note that '~~~' is an internal delimiter must not appear in this text field - please work around this technical limitation" > - <sanitizer invalid_char=""> - <valid initial="string.printable"> - <remove value='~~~' /> - </valid> - <mapping initial="none"/> - </sanitizer> + <option value="text" selected="true">Text string</option> + <option value="integer">Integer</option> + <option value="float">Float</option> + <option value="boolean">Boolean</option> + <option value="selecttext">Select text string</option> </param> - <param name="param_label" type="text" value="" label="Enter this parameter's label for the form" - help="Note that '~~~' is an internal delimiter so must not appear in this text field - please work around this technical limitation" > - <sanitizer invalid_char=""> - <valid initial="string.printable"> - <remove value='~~~'/> - </valid> - <mapping initial="none"/> - </sanitizer> + <when value = "text"> + <expand macro="singleText" /> + </when> + <when value = "integer"> + <expand macro="singleInt" /> + </when> + <when value = "float"> + <expand macro="singleFloat" /> + </when> + <when value = "boolean"> + <expand macro="singleBoolean" /> + </when> + <when value = "selecttext"> + <expand macro="selectText" /> + </when> + </conditional> + <param name="param_label" type="text" value="" label="Enter this parameter's label for the form"> </param> - <param name="param_help" type="text" value="" label="Help for this parameter" - help="Note that three consecutive ~ cannot be used in this text field - please work around this technical limitation" > - <sanitizer invalid_char=""> - <valid initial="string.printable"> - <remove value='~~~'/> - </valid> - <mapping initial="none"/> - </sanitizer> + <param name="param_help" type="text" value="" label="Help for this parameter"> </param> <param name="param_CL" type="text" label="Positional ordinal | argparse argument name" help="Using positional parameters, enter the integer ordinal for this parameter on the command line. Using Argparse style, '--' will be prepended on the CL" value="" /> @@ -198,15 +226,40 @@ #if str($io_param.ppass.addparam.edit_params) == "yes": --edit_additional_parameters #end if - #for apar in $io_param.ppass.addparam.additional_parameters: ---additional_parameters "$apar.param_name~~~$apar.param_value~~~$apar.param_label~~~$apar.param_help~~~$apar.param_type~~~$apar.param_CL~~~$apar.param_CLprefixed" + #for $apar in $io_param.ppass.addparam.additional_parameters: + #if $apar.ap_type.param_type=="selecttext": +--selecttext_parameters '{"name":"$apar.param_name", "label":"$apar.param_label", "help":"$apar.param_help", +"type":"$apar.ap_type.param_type","CL":"$apar.param_CL","override":"$apar.param_CLprefixed","value": [ + #for $i,$st in enumerate($apar.ap_type.selectTexts): + "$st.select_value" + #if ($i < (len($apar.ap_type.selectTexts)-1)): + , + #end if + #end for + ], "texts": [ + #for $i,$st in enumerate($apar.ap_type.selectTexts): + "$st.select_text" + #if ($i < (len($apar.ap_type.selectTexts)-1)): + , + #end if + + #end for + ] + }' + #else: +--additional_parameters '{"name": "$apar.param_name", "value": "$apar.ap_type.param_value", "label": "$apar.param_label", "help": "$apar.param_help", +"type": "$apar.ap_type.param_type","CL": "$apar.param_CL","override": "$apar.param_CLprefixed" }' + #end if #end for #end if #for $intab in $io_param.ppass.io.history_inputs: ---input_files "$intab.input_files~~~$intab.input_CL~~~$intab.input_formats~~~$intab.input_label~~~$intab.input_help" +--input_files '{"name": "$intab.input_files", "CL": "$intab.input_CL", "format": "$intab.input_formats", "label": "$intab.input_label", "help": "$intab.input_help", "repeat": "$intab.input_repeat"}' #end for #for $otab in $io_param.ppass.io.history_outputs: ---output_files "$otab.history_name~~~$otab.history_format~~~$otab.history_CL~~~$otab.history_test" +--output_files '{"name": "$otab.history_name", "format": "$otab.history_format", "CL": "$otab.history_CL", "test": "$otab.history_test"}' + #end for + #for $collect in $io_param.ppass.io.collection_outputs: +--collection '{"name": "$collect.name", "kind": "$collect.kind", "discover": "$collect.discover", "label": "$collect.label"}' #end for --galaxy_root "$__root_dir__" --tool_dir "$__tool_directory__" @@ -260,7 +313,7 @@ <section name="deps" title="Dependencies, optional script and script interpreter" expanded="true"> <param name="packages" type="text" value="" label="Conda dependencies as package name[:version, name:version...]. These will always be available when this tool executes" - optional="false" help="Use =[ver] or :[ver] for specific version - 'bwa=0.17.0'. Default is latest. Will be used every time the tool is (re)run. Only Conda is currently supported" /> + help="Use =[ver] or :[ver] for specific version - 'bwa=0.17.0'. Default is latest. Will be used every time the tool is (re)run. Only Conda is currently supported" /> <conditional name="usescript"> <param name="choosescript" type="select" display="radio" label="Supply a script for a dependency (e.g. python/R/bash) or a system executable such as Bash" @@ -345,8 +398,8 @@ <param name="make_Tool" type="select" display="radio" label="Choose the steps you want to run. The TF Docker container is recommended for local installation" help="Installation in this Galaxy is optional" > <option value="generate" >Run to generate tests only. Should fail if dependencies needed.</option> - <option value="gentest">Test with planemo after generating.</option> - <option value="gentestinstall" selected="true">Install in this Galaxy after generation and testing. Must have local ToolShed as in the TF Docker container</option> + <option value="gentest" selected="true">Test with planemo after generating.</option> + <option value="gentestinstall">Install in this Galaxy after generation and testing. Must have local ToolShed as in the TF Docker container</option> </param> <when value="generate"> <param name="galaxy_apikey" value="" type="hidden" ></param> @@ -416,7 +469,7 @@ <param name="input_help" value="help" /> <param name="tool_name" value="pyrevpos" /> <param name="parampass" value="positional" /> - <param name="make_Tool" value="generate" /> + <param name="make_Tool" value="gentest" /> <param name="tool_version" value="0.01" /> <param name="tool_desc" value="positional reverse" /> <param name="help_text" value="help text goes here" /> @@ -515,6 +568,27 @@ o.write('\n') o.close() +R script to draw some plots - use a collection. + +:: + + + \# note this script takes NO input because it generates random data + dir.create('plots') + for (i in 1:10) { + foo = runif(100) + bar = rnorm(100) + bar = foo + 0.05*bar + pdf(paste('plots/yet',i,"anotherplot.pdf",sep='_')) + plot(foo,bar,main=paste("Foo by Bar plot \#",i),col="maroon", pch=3,cex=0.6) + dev.off() + foo = data.frame(a=runif(100),b=runif(100),c=runif(100),d=runif(100),e=runif(100),f=runif(100)) + bar = as.matrix(foo) + pdf(paste('plots/yet',i,"anotherheatmap.pdf",sep='_')) + heatmap(bar,main='Random Heatmap') + dev.off() + } + Paper_