Skip to content
Takes SeqRecordExpanded objects and creates datasets for phylogenetic software.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dataset_creator
docs
media
requirements
tests
.bumpversion.cfg
.coveragerc
.gitignore
.travis.yml
AUTHORS.rst
CHANGELOG.rst
CONTRIBUTING.rst
LICENSE
MANIFEST.in
Makefile
README.rst
setup.cfg
setup.py
tox.ini

README.rst

Dataset-creator

Dataset creator for phylogenetic software

tests
package PyPI Package latest release PyPI Wheel Supported versions Supported implementations

Dataset-Creator - easy way to creat phylogenetic datasets in many formats

Documentation: dataset-creator.readthedocs.org

Takes SeqRecordExpanded objects and creates datasets for phylogenetic software such as MrBayes, TNT, BEAST, RAxML, MEGA, etc.

Features

  • Creates datasets in the following formats: FASTA, GenBankFASTA, NEXUS, TNT, MEGA and Phylip.
  • Can generate datasets of DNA and aminoacid sequences.
  • Can generate datasets of degenerated sequences.
  • It can partition datasets by codon positions or by gene.

Quick start

First:

pip install dataset_creator

Then the list of SeqRecordExpanded objects should be sorted by gene_code first then by voucher_code.

>>> from seqrecord_expanded import SeqRecord
>>> from dataset_creator import Dataset
>>>
>>> # `table` is the Translation Table code based on NCBI
>>> seq_record1 = SeqRecord('ACTACCTA', reading_frame=2, gene_code='RpS5',
...                         table=1, voucher_code='CP100-10',
...                         taxonomy={'genus': 'Aus', 'species': 'bus'})
>>>
>>> seq_record2 = SeqRecord('ACTACCTA', reading_frame=2, gene_code='RpS5',
...                         table=1, voucher_code='CP100-10',
...                         taxonomy={'genus': 'Aus', 'species': 'bus'})
>>>
>>> seq_record3 = SeqRecord('ACTACCTA', reading_frame=2, gene_code='wingless',
...                         table=1, voucher_code='CP100-10',
...                         taxonomy={'genus': 'Aus', 'species': 'bus'})
>>>
>>> seq_record4 = SeqRecord('ACTACCTA', reading_frame=2, gene_code='winglesss',
...                         table=1, voucher_code='CP100-10',
...                         taxonomy={'genus': 'Aus', 'species': 'bus'})
>>>
>>> seq_records = [
...    seq_record1, seq_record2, seq_record3, seq_record4,
... ]

>>> # codon positions can be 1st, 2nd, 3rd, 1st-2nd, ALL (default)
>>> dataset = Dataset(seq_records, format='TNT', partitioning='by codon position',
...                   codon_positions='ALL')

>>> dataset = Dataset(seq_records, format='PHYLIP', partitioning='1st-2nd, 3rd',
...                   codon_positions='ALL')

>>> dataset = Dataset(seq_records, format='NEXUS', partitioning='by gene',
...                   codon_positions='1st')

>>> dataset = Dataset(seq_records, format='NEXUS', partitioning='by gene',
...                   codon_positions='ALL', aminoacids=True)

>>> # Produce a dataset of degenerated sequences using the 'S' method:
>>> dataset = Dataset(seq_records, format='NEXUS', partitioning='by gene',
...                   codon_positions='ALL', degenerate='S')

>>> print(dataset.dataset_str)
#NEXUS
blah blah ...

Further documentation can be found at dataset-creator.readthedocs.org

Development

To run the all tests run:

tox
You can’t perform that action at this time.