项目作者: omsai

项目描述 :
Cache inteins.com InBase database locally as Pandas DataFrame.
高级语言: Python
项目地址: git://github.com/omsai/inbase.git
创建时间: 2018-02-01T00:33:59Z
项目社区:https://github.com/omsai/inbase

开源协议:Other

下载


InBase

Build Status
Coverage
License: CC0-1.0

InBase provides a convenient pandas DataFrame of the 585 inteins in
the unmaintained inteins.com InBase database.
The protein sequences are available as biopython SeqRecord objects,
but otherwise nothing else is changed from the inteins.com metadata.

InBase was collected using scrapy and can
updated as detailed in the “update database” section below.

Installation

  1. pip install --user git+https://github.com/omsai/inbase

Usage

  1. from inbase import INBASE
  2. # See first few lines of all inteins.
  3. INBASE.head()
  4. # See first intein.
  5. INBASE.ix[0]
  6. # Access biopython seq record information of first intein.
  7. INBASE.ix[0, 'Intein aa Sequence']
  8. # Count archea inteins.
  9. INBASE['Domain of Life'].unique()
  10. (INBASE['Domain of Life'] == 'Archaea').sum()
  11. # Count all inteins.
  12. len(INBASE)

Development Environment

Virtual environments and tests are orchestrated using tox. Install
tox using pip:

  1. pip install --user tox

Make sure that ~/.local/bin or similar is in your path per
PEP 370.

Install without tests:

  1. tox --notest -e py27

Update DataBase

Unfortunately scrapy does not provide an update function to check
against the existing JSON data. One has to redownload the database,
but which only takes a few seconds. First, you will need to clone
this repository and create a “development environment” as described in
the section above. Then initialize the data environment with the
scrapy extras package:

  1. tox --notest -e data

Check the current number of inbase records:

  1. cat data/inbase.json | wc -l | xargs expr -2 +

Redownload the data:

  1. rm data/inbase.json
  2. .tox/data/bin/scrapy runspider -o data/inbase.json inbase/update.py

Check the new number of records:

  1. cat data/inbase.json | wc -l | xargs expr -2 +

If there indeed are more records, update your Manifest checksums,
re-run the data tests and update your git repository and submit a pull
request:

  1. version=$(date +%Y%m%d.1)
  2. sed -i -E "s#(version=').*('.+)#\1${version}\2#" setup.py
  3. .tox/data/bin/gemato create --hashes "MD5 SHA1 SHA256" data/
  4. tox -e data
  5. git commit setup.py data/* -m "MAINT: Update inbase database on $(date -I)"
  6. git push

Tests

Run all non-data tests using:

  1. tox

Debug failing tests:

  1. tox --pdb

If you add dependencies and get import errors, you need to recreate
the tox environment:

  1. tox --recreate

When you edit the files, you’re likely going to create lots of linter
errors caught by the tox unit tests if your text editor doesn’t have
interactive error reporting. If you use Emacs, you can configure it
for python development by installing
elpy.