Mercurial > repos > gga > chado_analysis_get_analyses
changeset 10:dde12105d2d1 draft
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/chado commit 0b135f1ea2623ea68e41ac88e13d99e6b4ad8bea
author | gga |
---|---|
date | Mon, 08 Jul 2019 05:33:16 -0400 (2019-07-08) |
parents | 5812e9cddfa8 |
children | dc85293ad585 |
files | analysis_get_analyses.xml macros.xml prepare_psql.sh |
diffstat | 3 files changed, 102 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/analysis_get_analyses.xml Tue Mar 05 05:13:35 2019 -0500 +++ b/analysis_get_analyses.xml Mon Jul 08 05:33:16 2019 -0400 @@ -6,7 +6,7 @@ </macros> <expand macro="requirements"/> <command detect_errors="aggressive"><![CDATA[ -@AUTH@ +@START_PSQL@ && chakin analysis get_analyses @@ -39,18 +39,21 @@ #end if | jq -S . > '$results' + +&& @STOP_PSQL@ ]]></command> <inputs> - <!-- options --> - <param name="analysis_id" label="Analysis Id" argument="--analysis_id" type="integer" help="analysis_id filter" optional="True" /> - <param name="name" label="Name" argument="--name" type="text" help="analysis name filter" optional="True" /> - <param name="program" label="Program" argument="--program" type="text" help="analysis program filter" optional="True" /> - <param name="programversion" label="Programversion" argument="--programversion" type="text" help="analysis programversion filter" optional="True" /> - <param name="algorithm" label="Algorithm" argument="--algorithm" type="text" help="analysis algorithm filter" optional="True" /> - <param name="sourcename" label="Sourcename" argument="--sourcename" type="text" help="analysis sourcename filter" optional="True" /> - <param name="sourceversion" label="Sourceversion" argument="--sourceversion" type="text" help="analysis sourceversion filter" optional="True" /> - <param name="sourceuri" label="Sourceuri" argument="--sourceuri" type="text" help="analysis sourceuri filter" optional="True" /> - <param name="description" label="Description" argument="--description" type="text" help="analysis description" optional="True" /> + <expand macro="psql_target"/> + <!-- options --> + <param name="analysis_id" label="Analysis Id" argument="--analysis_id" type="integer" help="analysis_id filter" optional="True" /> + <param name="name" label="Name" argument="--name" type="text" help="analysis name filter" optional="True" /> + <param name="program" label="Program" argument="--program" type="text" help="analysis program filter" optional="True" /> + <param name="programversion" label="Programversion" argument="--programversion" type="text" help="analysis programversion filter" optional="True" /> + <param name="algorithm" label="Algorithm" argument="--algorithm" type="text" help="analysis algorithm filter" optional="True" /> + <param name="sourcename" label="Sourcename" argument="--sourcename" type="text" help="analysis sourcename filter" optional="True" /> + <param name="sourceversion" label="Sourceversion" argument="--sourceversion" type="text" help="analysis sourceversion filter" optional="True" /> + <param name="sourceuri" label="Sourceuri" argument="--sourceuri" type="text" help="analysis sourceuri filter" optional="True" /> + <param name="description" label="Description" argument="--description" type="text" help="analysis description" optional="True" /> </inputs> <outputs>
--- a/macros.xml Tue Mar 05 05:13:35 2019 -0500 +++ b/macros.xml Mon Jul 08 05:33:16 2019 -0400 @@ -2,12 +2,16 @@ <macros> <xml name="requirements"> <requirements> - <requirement type="package" version="2.2.5">python-chado</requirement> + <requirement type="package" version="2.2.6">python-chado</requirement> <requirement type="package" version="1.5">jq</requirement> + <requirement type="package" version="@PG_VERSION@">postgresql</requirement> + <requirement type="package" version="0.1">pglite</requirement> <yield/> </requirements> </xml> + <token name="@PG_VERSION@">11.2</token> + <xml name="stdio"> <stdio> <regex level="fatal" match="Exception:" source="stderr" /> @@ -16,7 +20,7 @@ </stdio> </xml> - <token name="@WRAPPER_VERSION@">2.2.5</token> + <token name="@WRAPPER_VERSION@">2.2.6</token> <xml name="citation"> <citations> @@ -32,19 +36,6 @@ <token name="@HELP@"><![CDATA[ ]]></token> - <token name="@AUTH@"><![CDATA[ - echo "__default: local" > '.auth.yml' && - echo "local:" >> '.auth.yml' && - echo " dbhost: \"\$GALAXY_CHADO_DBHOST\"" >> '.auth.yml' && - echo " dbname: \"\$GALAXY_CHADO_DBNAME\"" >> '.auth.yml' && - echo " dbpass: \"\$GALAXY_CHADO_DBPASS\"" >> '.auth.yml' && - echo " dbuser: \"\$GALAXY_CHADO_DBUSER\"" >> '.auth.yml' && - echo " dbschema: \"\$GALAXY_CHADO_DBSCHEMA\"" >> '.auth.yml' && - echo " dbport: \"\$GALAXY_CHADO_DBPORT\"" >> '.auth.yml' && - - CHAKIN_GLOBAL_CONFIG_PATH='.auth.yml' - ]]></token> - <xml name="sanitized"> <sanitizer> <valid initial="string.printable"> @@ -83,4 +74,63 @@ label="Sequence type of the parent" help="this should be a Sequence Ontology term" /> </xml> + + <xml name="psql_target"> + <conditional name="psql_target"> + <param name="method" type="select" label="Chado Database" help="If you select 'Remote database' make sure credentials are defined in environment variables"> + <option value="remote">Remote database</option> + <option value="pgtools">Database from history</option> + </param> + <when value="remote"/> + <when value="pgtools"> + <param name="infile" type="data" format="postgresql" label="Input database" /> + <param name="schema" type="text" label="Schema containing Chado tables" value="public" help="Can be 'chado' for a Tripal database"/> + </when> + </conditional> + </xml> + + <token name="@AUTH@"><![CDATA[ + if [ -z "$CHAKIN_GLOBAL_CONFIG_PATH" ]; then + echo "__default: local" > '.auth.yml' && + echo "local:" >> '.auth.yml' && + echo " dbhost: \"\$GALAXY_CHADO_DBHOST\"" >> '.auth.yml' && + echo " dbname: \"\$GALAXY_CHADO_DBNAME\"" >> '.auth.yml' && + echo " dbpass: \"\$GALAXY_CHADO_DBPASS\"" >> '.auth.yml' && + echo " dbuser: \"\$GALAXY_CHADO_DBUSER\"" >> '.auth.yml' && + echo " dbschema: \"\$GALAXY_CHADO_DBSCHEMA\"" >> '.auth.yml' && + echo " dbport: \"\$GALAXY_CHADO_DBPORT\"" >> '.auth.yml' && + + export CHAKIN_GLOBAL_CONFIG_PATH='.auth.yml' + ; fi + ]]></token> + + <token name="@START_PSQL@"><![CDATA[ + #if $psql_target.method == 'pgtools' + tar -xjvf '$psql_target.infile' > /dev/null && + . '$__tool_directory__/prepare_psql.sh' '$psql_target.schema' + #else + @AUTH@ + #end if + ]]></token> + + <token name="@STOP_PSQL@"><![CDATA[ + #if $psql_target.method == 'pgtools' + pglite stop -d ./postgresql && + timeout 60 bash -c 'until pglite status -d ./postgresql | grep -F -q "no server running"; do sleep 1; done' + ; + ## Make sure psql is stopped even if loading script failed + pglite stop -d ./postgresql || true + #end if + ]]></token> + + <token name="@ZIP_PSQL@"><![CDATA[ + #if $psql_target.method == 'pgtools' + pglite stop -d ./postgresql && + timeout 60 bash -c 'until pglite status -d ./postgresql | grep -F -q "no server running"; do sleep 1; done' && + tar -cvjf postgresql_out.tar.bz2 postgresql > /dev/null + ; + ## Make sure psql is stopped even if loading script failed + pglite stop -d ./postgresql || true + #end if + ]]></token> </macros>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/prepare_psql.sh Mon Jul 08 05:33:16 2019 -0400 @@ -0,0 +1,23 @@ +#!/bin/bash + +export PWD=`pwd` && +sed -i.bak "s|unix_socket_directories.*|unix_socket_directories = '$PWD/postgresql/'|" ./postgresql/db/postgresql.conf && + +pglite start -d ./postgresql && + +timeout 60 bash -c 'until pglite status -d ./postgresql | grep -F -q "server is running"; do sleep 1; done' && +pglite status -d ./postgresql && +timeout 60 bash -c 'until ls -la ./postgresql | grep -F -q ".s.PGSQL.5432"; do sleep 1; done' && +pglite status -d ./postgresql && + +echo "__default: local" > '.auth.yml' && +echo "local:" >> '.auth.yml' && +echo " dbhost: \"xxx\"" >> '.auth.yml' && +echo " dbname: \"xxx\"" >> '.auth.yml' && +echo " dbpass: \"xxx\"" >> '.auth.yml' && +echo " dbuser: \"xxx\"" >> '.auth.yml' && +echo " dbschema: \"$1\"" >> '.auth.yml' && +echo " dbport: \"xxx\"" >> '.auth.yml' && +echo " dburl: \"$(pglite url -d ./postgresql)\"" >> '.auth.yml' && + +export CHAKIN_GLOBAL_CONFIG_PATH='.auth.yml'