Question: How to test tool_dependencies.xml
0
gravatar for alexander.lenail
20 months ago by
alexander.lenail0 wrote:

I'm trying to make a tool on the tool shed, which has a dependency called chipsequtil. I've written a tool_dependencies.xml file which I think should properly install chipsequtil. But after I install the tool to my galaxy (using the tool shed) and try to run the tool, I get the following error: ImportError: No module named chipsequtil which is triggered partway through the actual script that I'm trying to run, when I try to import chipsequtil.

By following the steps in chipsequtil's readme, I'm capable of getting a functional chipsequtil version up and running locally.

Is there any way to test a tool_dependencies.xml file? I couldn't find one in planemo.

I've copied it here if there's an easy-to-spot error instead:


<tool_dependency>
    <package name="chipsequtil" version="1.0">
        <install version="1.0">
            <actions>
                <action type="download_by_url">https://github.com/adamlabadorf/chipsequtil/archive/master.zip</action>
                <action type="shell_command">unzip chipsequtil-master.zip -d chipsequtil</action>
                <action type="shell_command">cd chipsequtil</action>
                <action type="shell_command">cp org_settings.cfg src/chipsequtil/</action>
                <action type="shell_command">python setup.py install</action>
            </actions>
        </install>
        <readme></readme>
    </package>
</tool_dependency>
toolshed tools • 580 views
ADD COMMENTlink modified 20 months ago by Bjoern Gruening4.8k • written 20 months ago by alexander.lenail0
4
gravatar for Dave B.
20 months ago by
Dave B.410
United States
Dave B.410 wrote:

Hello,

The fastest way to make this XML work is by adding the following after the setup.py install command in the last <action> tag: --install-lib $INSTALL_DIR/lib/python --install-scripts $INSTALL_DIR/bin, then creating a set_environment action tag as described at https://wiki.galaxyproject.org/ToolDependenciesTagSets

The best-practices way is to create a dependency on a python repository in the toolshed, then using the setup_python_environment action type, as is done in https://github.com/galaxyproject/tools-iuc/blob/master/packages/package_python_2_7_deeptools_2_0/tool_dependencies.xml

Naturally, you won't need all of the dependencies deeptools requires, so a little experimenting will be needed to find the minimum working set.

ADD COMMENTlink modified 20 months ago • written 20 months ago by Dave B.410

Can you link me to an example of a similar use of the set_environment action tag? I'm not sure I quite understand what it is or how to use it, but if I see it used in practice somewhere, I may be able to piece together what exactly it's doing.

ADD REPLYlink written 20 months ago by alexander.lenail0

Yes, this link will highlight the set_environment actions in the xml I referenced above: https://github.com/galaxyproject/tools-iuc/blob/master/packages/package_python_2_7_deeptools_2_0/tool_dependencies.xml#L52-L63

The first two are the important ones for any python package, letting the galaxy framework know how to find executables and python libraries. The rest are more relevant to packages that are used as dependencies by other packages.

ADD REPLYlink modified 20 months ago • written 20 months ago by Dave B.410

Strangely, this still isn't working. My tool_dependencies.xml file looks like:

        <install version="1.0">
            <actions>
                <action type="download_by_url">https://github.com/adamlabadorf/chipsequtil/archive/master.zip</action>
                <action type="shell_command">cp org_settings.cfg src/chipsequtil/</action>
                <action type="shell_command">python setup.py install --install-lib $INSTALL_DIR/lib/python --install-scripts $INSTALL_DIR/bin</action>
                <action type="set_environment">
                    <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR/bin</environment_variable>
                    <environment_variable name="PYTHONPATH" action="prepend_to">$INSTALL_DIR</environment_variable>
                </action>
            </actions>

When I go to galaxy_storage/galaxy-central/tool_deps/chipsequtil/1.0/alenail/chipsequtil/4f66143b385a I find what looks like a viable installation, but I'm still getting the same error. A file called env.sh reads:

PATH=/galaxy-central/tool_deps/chipsequtil/1.0/alenail/chipsequtil/4f66143b385a/bin:$PATH; export PATH
PYTHONPATH=/galaxy-central/tool_deps/chipsequtil/1.0/alenail/chipsequtil/4f66143b385a:$PYTHONPATH; export PYTHONPATH
CHIPSEQUTIL_ROOT_DIR=/galaxy-central/tool_deps/chipsequtil/1.0/alenail/chipsequtil/4f66143b385a; export CHIPSEQUTIL_ROOT_DIR

When I open python (this is on the vm) and try to import chipsequtil, it still fails (ImportError: No module named chipsequtil). This still works on my local machine.

ADD REPLYlink written 20 months ago by alexander.lenail0

Yes, the PYTHONPATH definition needs to be $INSTALL_DIR/lib/python

ADD REPLYlink written 20 months ago by Dave B.410
1
gravatar for Bjoern Gruening
20 months ago by
Bjoern Gruening4.8k
Germany
Bjoern Gruening4.8k wrote:

Just want to add that if you have a conda package available you also could use this as dependency.

ADD COMMENTlink written 20 months ago by Bjoern Gruening4.8k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 97 users visited in the last hour