Welcome to pyGFE’s documentation!¶
Copyright (c) 2017 Be The Match operated by National Marrow Donor Program. All Rights Reserved.
Contents:
py-gfe¶
Python Boilerplate contains all the boilerplate you need to create a Python package.
- Free software: LGPL 3.0
- Documentation: https://pygfe.readthedocs.io.
Docker¶
docker pull nmdpbioinformatics/py-gfe
Example¶
>>> from Bio import SeqIO
>>> from BioSQL import BioSeqDatabase
>>> from seqann.sequence_annotation import BioSeqAnn
>>> import pygfe
>>> seq_file = 'test_dq.fasta'
>>> gfe = pygfe.pyGFE()
>>> server = BioSeqDatabase.open_database(driver="pymysql", user="root",
... passwd="", host="localhost",
... db="bioseqdb")
>>> seqann = BioSeqAnn(server=server)
>>> seq_rec = list(SeqIO.parse(seq_file, 'fasta'))[0]
>>> annotation = seqann.annotate(seq_rec, "HLA-DQB1")
>>> gfe = gfe.get_gfe(annotation, "HLA-DQB1")
>>> print(gfe)
HLA-DQB1w0-4-0-141-0-12-0-4-0-0-0-0-0
Credits¶
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Installation¶
Stable release¶
To install pyGFE, run this command in your terminal:
$ pip install pygfe
This is the preferred method to install pyGFE, as it will always install the most recent stable release.
If you don’t have pip installed, this Python installation guide can guide you through the process.
From sources¶
The sources for pyGFE can be downloaded from the Github repo.
You can either clone the public repository:
$ git clone git://github.com/mhalagan-nmdp/pygfe
Or download the tarball:
$ curl -OL https://github.com/mhalagan-nmdp/pygfe/tarball/master
Once you have a copy of the source, you can install it with:
$ python setup.py install
pygfe package¶
pygfe¶
Created on Feb 8, 2017
@author: mhalagan
-
pygfe.pygfe.
flatten
(l)¶
-
pygfe.pygfe.
is_classI
(x)¶
-
pygfe.pygfe.
is_gfe
(x)¶
-
pygfe.pygfe.
lc
(x)¶
-
class
pygfe.pygfe.
pyGFE
(url='http://feature.nmdp-bioinformatics.org', loci=['HLA-A', 'HLA-B', 'HLA-C', 'HLA-DRB1', 'HLA-DQB1', 'HLA-DRB4', 'HLA-DRB5', 'HLA-DPB1', 'HLA-DPA1', 'HLA-DQA1', 'HLA-DRB3'], graph: py2neo.database.Graph = None, seqann: Any = {}, features: Dict[KT, VT] = None, verbose: bool = False, kir: bool = False, pid: str = 'NA', gfe2hla: Dict[KT, VT] = None, gfe_feats: pandas.core.frame.DataFrame = None, seq2hla: pandas.core.frame.DataFrame = None, load_gfe2hla: bool = False, load_seq2hla: bool = False, load_gfe2feat: bool = False, verbosity=1)[source]¶ Bases:
object
classdocs
-
breakup_gfe
(gfe)[source]¶ creates GFE from HLA sequence and locus
Parameters: - locus – string containing HLA locus.
- sequence – string containing sequence data.
Returns: GFEobject.
-
calcDiff
(gfe1, gfe2)[source]¶ creates GFE from HLA sequence and locus
Parameters: - locus – string containing HLA locus.
- sequence – string containing sequence data.
Returns: GFEobject.
-
calcSim
(gfe1, gfe2)[source]¶ creates GFE from HLA sequence and locus
Parameters: - locus – string containing HLA locus.
- sequence – string containing sequence data.
Returns: GFEobject.
-
create_typing
(similar_data, gfe, features)[source]¶ creates GFE from HLA sequence and locus
Parameters: - locus – string containing HLA locus.
- sequence – string containing sequence data.
Returns: GFEobject.
-
find_gfe_kir
(gfe, features)[source]¶ creates GFE from HLA sequence and locus
Parameters: - locus – string containing HLA locus.
- sequence – string containing sequence data.
Returns: GFEobject.
-
find_similar
(gfe, features, imgtdb_version)[source]¶ creates GFE from HLA sequence and locus
Parameters: - locus – string containing HLA locus.
- sequence – string containing sequence data.
Returns: GFEobject.
-
gfe_create
(locus, sequence, imgtdb_version)[source]¶ creates GFE from HLA sequence and locus
Parameters: - locus – string containing HLA locus.
- sequence – string containing sequence data.
Returns: Dict.
-
map_structures
(gfe_structs)[source]¶ creates GFE from HLA sequence and locus
Parameters: - locus – string containing HLA locus.
- sequence – string containing sequence data.
Returns: GFEobject.
-
matching_features
(gfe1, gfe2, structures)[source]¶ creates GFE from HLA sequence and locus
Parameters: - locus – string containing HLA locus.
- sequence – string containing sequence data.
Returns: GFEobject.
-
sequence_lookup
(locus, sequence, imgtdb_version)[source]¶ Looks up sequence from
Parameters: - locus – string containing HLA locus.
- sequence – string containing sequence data.
Returns: GFEobject.
-
type_from_seq
(locus: str = None, sequence: str = None, imgtdb_version: str = '3.31.0', nseqs: int = 20, alignseqs: int = 10, skip: List[T] = [])[source]¶ creates GFE from HLA sequence and locus
Parameters: - locus – string containing HLA locus.
- sequence – string containing sequence data.
Returns: GFEobject.
-
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/mhalagan-nmdp/pygfe/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” and “help wanted” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “enhancement” and “help wanted” is open to whoever wants to implement it.
Write Documentation¶
pyGFE could always use more documentation, whether as part of the official pyGFE docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/mhalagan-nmdp/pygfe/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up pygfe for local development.
Fork the pygfe repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/pygfe.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv pygfe $ cd pygfe/ $ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:
$ flake8 pygfe tests $ python setup.py test or py.test $ tox
To get flake8 and tox, just pip install them into your virtualenv.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
- The pull request should work for Python 2.6, 2.7, 3.3, 3.4 and 3.5, and for PyPy. Check https://travis-ci.org/mhalagan-nmdp/pygfe/pull_requests and make sure that the tests pass for all supported Python versions.