Installation¶
entrezpy can be installed or included into your own pipeline using two
approaches: PyPi or Append to sys.path.
Requirements¶
Python version >= 3.6
- Python Standard Library :
The standard library should be installed with Python. Just in case, these modules from the Python Standard Library are required:
- base64
- io
- json
- logging
- math
- os
- queue
- random
- socket
- sys
- threading
- time
- urllib
- uuid
- xml.etree.ElementTree
Test your Python version¶
Test if we have at least Python 3.6 :
$ python
>>> import sys
>>> sys.version_info
>>> sys.version_info(major=3, minor=6, micro=6, releaselevel='final', serial=0)
^ ^
PyPi¶
Install entrezpy via PyPi and check:
$ pip install entrezpy --user
Test if we can import entrezpy:
$ python
>>> import entrezpy
Append to sys.path¶
Add entrezpy to your pipeline via sys.path. This requires to clone
the source code adjusting sys.path.
Assuming following directory structure where entrezpy was cloned into
include:
$ git clone https://gitlab.com/ncbipy/entrezpy.git project_root/include
project_root
|
|-- src
| `-- pipeline.py
`-- include
`-- entrezpy
`-- src
`-- entrezpy
`-- efetch
Importing the module efetcher in pipeline.py by adjust sys.path in
project_root/src/pipeline.py
sys.path.insert(1, os.path.join(sys.path[0], '../include/entrezpy/src'))
import entrezpy.efetch.efetcher
ef = entrezpy.efetch.efetcher.Efetcher('toolname', 'email')
Test entrezpy¶
Run the examples in the git repository in entrezpy/examples, e.g:
$ ./path/to/entrezpy/examples/entrezpy-example.elink.py --email you@email
To adjust the examples for testing an installation via PyPi, remove the
sys.path line in the examples prior to invoking them, e.g.
for i in entrezpy/examples/*.py; do \
fname=$(basename $i | sed 's/\.py/\.adjust.py/'); \
sed '/sys.path.insert/d' $i > $fname; \
chmod +x $fname; \
done;
The examples print the results onto the standard output and additional
information onto standard error. Currently, we propose to run the examples and
redirecting standard error to a file. For example, testing efetch,
run examples/entrezpy-example.efetch.py as follows:
./examples/entrezpy-example.efetch.py --email you@email 2> efetch.stderr
efetch.stderr can be monitored as follows:
tail -f efetch.stderr