https://github.com/biosustain/genomediff-python
GenomeDiff (*.gd) file parser for Python
https://github.com/biosustain/genomediff-python
breseq genomediff genomics parser
Last synced: about 1 year ago
JSON representation
GenomeDiff (*.gd) file parser for Python
- Host: GitHub
- URL: https://github.com/biosustain/genomediff-python
- Owner: biosustain
- License: mit
- Created: 2014-05-13T14:03:59.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2019-10-11T20:51:06.000Z (over 6 years ago)
- Last Synced: 2025-04-06T10:44:49.529Z (about 1 year ago)
- Topics: breseq, genomediff, genomics, parser
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 2
- Watchers: 6
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
genomediff-python
=================
**genomediff-python** parses files in the
`GenomeDiff format `_
generated by the `breseq `_
variant caller for haploid microbial organisms.
Installation
------------
::
pip3 install genomediff
Only Python 3.x is tested.
Usage
-----
GenomeDiff files are read using ``GenomeDiff.read(file)``. The ``GenomeDiff`` object contains a ``metadata`` dict with
the meta data, as well as ``mutations``, ``evidence`` and ``validation`` lists—each containing records of that type.
Records can be accessed through this list or by id. ``GenomeDiff`` is iterable and iterating will return all records of all types.
::
>>> from genomediff import *
>>> document = GenomeDiff.read(open('MyDiff.gd', 'r', encoding='utf-8'))
>>> document.metadata
{'GENOME_DIFF': '1.0', 'AUTHOR': ''}
>>> document.mutations[0]
Record('SNP', 1, [191], new_seq='A', seq_id='NC_000913', snp_type='intergenic', position=12346)
>>> document.mutations[0].parent_ids
[191]
>>> document[191]
Record('RA', 191, None, tot_cov='46/42', new_base='A', insert_position=0, ref_base='G', seq_id='NC_000913', quality=252.9, position=12345)
>>> document.mutations[0].parents
[Record('RA', 191, None, tot_cov='46/42', new_base='A', insert_position=0, ref_base='G', seq_id='NC_000913', quality=252.9, position=12345)]
Contribution
------------
Contribution to this project is welcomed. Wishlist:
- Writing GD files
- Python 2.x support