Skip to content

Commit

Permalink
Merge pull request #11 from bio-tools/dev
Browse files Browse the repository at this point in the history
push v0.3.0 to master and pypi
  • Loading branch information
khillion committed Jun 30, 2017
2 parents b45234c + 4a41aa8 commit 088fc20
Show file tree
Hide file tree
Showing 31 changed files with 2,099 additions and 103 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ the description of tools from [Bio.tools](https://bio.tools).

#### Requirements

You need Docker to be installed on your computer in order to perform the code analysis step of ToolDog.

You can then install ToolDog using pip with the following command:

```bash
Expand All @@ -37,20 +39,24 @@ usage: tooldog [-h] [-g/--galaxy] [-c/--cwl] [-f OUTFILE] biotool_entry
To import from [bio.tools](https://bio.tools), specify the `biotool_entry` with the following format: `id/version`:

```bash
tooldog --galaxy SARTools/1.4.0 > sartools.xml
tooldog --galaxy integron_finder/1.5.1 > integron_finder.xml
```

You can also use local file downloaded from [bio.tools](https://bio.tools) API
by giving its name directly:

```bash
tooldog --galaxy sartools.json > sartools.xml
tooldog --galaxy integron_finder.json > integron_finder.xml
```

More information about ToolDog usage [here](http://tooldog.readthedocs.io/en/latest/how_to_use.html).

## References

Kenzo-Hugo Hillion, Jon Ison and Hervé Ménager. ToolDog – generating tool descriptors from the ELIXIR tool registry.
F1000Research 2017, 6:767 (poster at ELIXIR all hands meeting).
doi: [10.7490/f1000research.1114125.1](https://f1000research.com/posters/6-767)

Hervé Ménager, Matúš Kalaš, Kristoffer Rapacki and Jon Ison. Using registries to integrate
bioinformatics tools and services into workbench environments. International Journal on
Software Tools for Technology Transfer (2016) doi: [10.1007/s10009-015-0392-z](http://link.springer.com/article/10.1007/s10009-015-0392-z)
18 changes: 18 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ Changelogs

Summary of developments of ToolDog software.

v0.3
====

v0.3.0
------

* Addition of source code analysis feature:

* use argparse2tool in a docker container
* only cover python tools using argparse

* Both part of ToolDog can be run independently:

* `tooldog --analyse tool_id/version`
* `tooldog --annotate tool_id/version`

* Options are available to specify language of the tool manually, as well as a path to access source code locally

v0.2
====

Expand Down
2 changes: 2 additions & 0 deletions doc/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ ToolDog is built with Python 3.6.0 and uses the following libraries:
.. _galaxyxml: https://github.com/erasche/galaxyxml
.. _cwlgen: https://github.com/common-workflow-language/python-cwlgen

Docker is also required in order to perform the code analysis part of the code.

.. Note::
We highly recommend the use of a virtual environment with Python 3.6.0
using `virtualenv`_ or `conda`_.
Expand Down
263 changes: 263 additions & 0 deletions experiments/protocol-01.06.2017.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Protocol of experiments 01.06.2017"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"__Goals:__\n",
" 1. Try out the proposed pipeline (see google slides)\n",
" 1. Send file back to today from future."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"__Requirements:__\n",
"1. Installed [Docker](https://store.docker.com/search?type=edition&offering=community) with the internet access\n",
"1. Python3, pip\n",
"1. Installed dependencies from requirements.txt \n",
"1. Archive of the [Integron_Finder](https://github.com/gem-pasteur/Integron_Finder/archive/master.zip)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Again, we import the Container class from docker_wrapper module."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import os"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"exec(open('../tooldog/analyse/container.py').read())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As in previous experiment we will define some useful constants and util functions for later use."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def write_to_file(filename, string = ''):\n",
" \"\"\"Write string to file\n",
"\n",
" :param str filename: Filename\n",
" :param str string: String to write\n",
" \"\"\"\n",
" f = open(filename, 'w')\n",
" f.write(string)\n",
" f.close()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"PYTHON_VERSION = 2 # version of python tool"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"TOOL_NAME = 'gem-pasteur-Integron_Finder-4d54052' # name of the tool, assuming it is available via PyPi"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"OUTPUT_FORMAT = 'cwl' # output: cwl / xml"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"OUTPUT_FILENAME = TOOL_NAME + \".\" + OUTPUT_FORMAT # output filename"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"PYTHON_PATH = \"/usr/local/lib/python3.5/dist-packages/\" if PYTHON_VERSION == 3 else \\\n",
"\"/usr/local/lib/python2.7/dist-packages/\" # PYTHONPATH, required for argparse2tool"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"CURRENT_PATH = os.path.realpath(os.getcwd())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we are ready to create a container."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"c = Container(\"inkuzm/tooldog-analyser-sandbox\",\n",
" \"tail -f /dev/null\", # run until we will stop the container\n",
" environment={'PYTHONPATH': PYTHON_PATH})"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Put tarball inside the container. For this we will:\n",
" * Download tarball https://api.github.com/repos/gem-pasteur/Integron_Finder/tarball"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"c.put(CURRENT_PATH + \"/tool.tar\", \"/\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's create an executional context and a helper to execute the commands in it."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"WORKDIR = \"/\" + TOOL_NAME"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def cd(path, cmd):\n",
" return \"bash -c 'cd \" + path + \" && \" + cmd + \"'\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's do it!"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"cwl_tool = '' \n",
"with c:\n",
" exe1 = c.exec(cd(WORKDIR, \"pip2 install .\"))\n",
" for line in exe1:\n",
" print(line)\n",
" \n",
" exe2 = c.exec(cd(WORKDIR, \"pip2 install argparse2tool\"))\n",
" for line in exe2:\n",
" print(line)\n",
" \n",
" exe3 = c.exec(cd(WORKDIR, 'integron_finder --generate_cwl_tool')) # TODO: find a way to get the toolname\n",
" for line in exe3:\n",
" cwl_tool += line.decode(\"utf-8\")[:-1]\n",
" \n",
" write_to_file(OUTPUT_FILENAME, cwl_tool)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
Loading

0 comments on commit 088fc20

Please sign in to comment.