Giter Site home page Giter Site logo

codonpair's Introduction

Build Status PyPI version PyPI - Downloads DOI

codonpair

codonpair calculates codon pair score and codon pair bias. CPS values are identical to those produced by the perl script from Dimitris Papamichail (cps_perl directory) and, presumably, used in the following work:

Virus attenuation by genome-scale changes in codon pair bias.
Coleman JR1, Papamichail D, Skiena S, Futcher B, Wimmer E, Mueller S.
Science. 2008 Jun 27;320(5884):1784-7. doi: 10.1126/science.1155761.
https://www.ncbi.nlm.nih.gov/pubmed/18583614

Installation

Either, clone the repo and install with pip

git clone [email protected]:smsaladi/codonpair.git
pip install ./codonpair

Or... have pip handle the details:

pip install git+git://github.com/smsaladi/codonpair@master#codonpair

All dependencies should be checked for and, if necessary, installed automatically by pip.

Usage

Initialize a codonpair.CodonPair object by specifying a list of reference sequences CodonPair.from_sequences, from a named reference CodonPair.from_named_reference, a reference file CodonPair.from_reference_file, or simply providing a pd.DataFrame with codon counts to CodonPair.

The following named references are recognized/bundled with this package.

  • E. coli (BL21 DE3)
  • S. pneumoniae (TIGR4)
  • cps_perl - the reference file provided with the perl implementation

The default constructor CodonPair() uses the E. coli.

Then calculate the codon pair score for a provided sequence with CodonPair.cpb which returns a dictionary with the

  • total codon pair score total_cps - the sum of the values of each codon pair
  • the number of codons n_pair - excluding codon pairs not found in the reference
  • the codon pair bias cpb - total_cps/n_pair

For one-off calculations, codonpair.calc_cpb can be used directly for with the sequence of interest (calling the default constructor under the hood).

import codonpair
cp = codonpair.CodonPair.from_named_reference('E. coli')
cp.cpb("ATGATCCCCTTACAACATGGACTGATCCTCGCGGCAATCTTATTCGTTCTTGGCTTAACC")

For convenience, the executable cps installed into the path by pip:

cps test.fasta > test.scores.txt

See CodonPair.write_reference to write codon pair counts for a reference set to the filename provided to be used with future calculations.

codonpair's People

Contributors

alexechu avatar smsaladi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

codonpair's Issues

codonpair package on pypi doesn't include data files

Hi,

I'm trying codonpair python package. First, I installed it from pypi via pip, I got following error.

FileNotFoundError: [Errno 2] File /usr/local/var/pyenv/versions/3.7.4/lib/python3.7/site-packages/codonpair/data/ec_de3_ref.cps.tbd does not exist: '/usr/local/var/pyenv/versions/3.7.4/lib/python3.7/site-packages/codonpair/data/ec_de3_ref.cps.tbd'

Because codonpair-0.1.1.tar.gz does not contains data directory, it does not install reference data.

x drwxrwxr-x  0 travis travis      0  2 21  2020 codonpair-0.1.1/
x drwxrwxr-x  0 travis travis      0  2 21  2020 codonpair-0.1.1/codonpair.egg-info/
x -rw-rw-r--  0 travis travis   3636  2 21  2020 codonpair-0.1.1/codonpair.egg-info/PKG-INFO
x -rw-rw-r--  0 travis travis      1  2 21  2020 codonpair-0.1.1/codonpair.egg-info/zip-safe
x -rw-rw-r--  0 travis travis      1  2 21  2020 codonpair-0.1.1/codonpair.egg-info/dependency_links.txt
x -rw-rw-r--  0 travis travis     10  2 21  2020 codonpair-0.1.1/codonpair.egg-info/top_level.txt
x -rw-rw-r--  0 travis travis    315  2 21  2020 codonpair-0.1.1/codonpair.egg-info/SOURCES.txt
x -rw-rw-r--  0 travis travis     23  2 21  2020 codonpair-0.1.1/codonpair.egg-info/requires.txt
x -rw-rw-r--  0 travis travis     50  2 21  2020 codonpair-0.1.1/codonpair.egg-info/entry_points.txt
x -rw-rw-r--  0 travis travis   3636  2 21  2020 codonpair-0.1.1/PKG-INFO
x -rw-rw-r--  0 travis travis   2709  2 21  2020 codonpair-0.1.1/README.md
x -rw-rw-r--  0 travis travis     38  2 21  2020 codonpair-0.1.1/setup.cfg
x drwxrwxr-x  0 travis travis      0  2 21  2020 codonpair-0.1.1/test/
x -rw-rw-r--  0 travis travis   2452  2 21  2020 codonpair-0.1.1/test/test_regression.py
x -rw-rw-r--  0 travis travis    917  2 21  2020 codonpair-0.1.1/setup.py
x drwxrwxr-x  0 travis travis      0  2 21  2020 codonpair-0.1.1/codonpair/
x -rw-rw-r--  0 travis travis   9420  2 21  2020 codonpair-0.1.1/codonpair/codonpair.py
x -rw-rw-r--  0 travis travis     66  2 21  2020 codonpair-0.1.1/codonpair/__init__.py

I've checkout the repo and build the package with python setup.py bdist_wheel and python setup.py sdist command. These command generated codonpair-0.1.1-py3-none-any.whl and codonpair-0.1.1.tar.gz contains data dir as expected. So setup.py does not have issues.

Could you please re-build a distribution contains data dir and publish it to pypi ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.