This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Read and write FASTA format.

Project Description

oldowan.fasta is a small bioinformatic utility to read and write sequence data in the FASTA format. FASTA is the most commonly used simple file format for storing multiple DNA, RNA, or protein sequences in a single file. It is a text-based, human-readable format.

Installation Instructions

This package is pure Python and has no dependencies outside of the standard library. The easist way to install is using easy_install from the setuptools package. This usually goes something like this:

$ easy_install oldowan.fasta

or on a unix-like system, assuming you are installing to the main Python site-packages directory as a non-privileged user, this:

$ sudo easy_install oldowan.fasta

You may also use the standard python distutils setup method. Download the current source archive from the file list towards the bottom of this page, unarchive it, and install. On Mac OS X and many other unix-like systems, having downloaded the archive and changed to the directory containing this archive in your shell, this might go something like:

$ tar xvzf oldowan.fasta*
$ cd oldowan.fasta*
$ python setup.py install

Quick Start

oldowan.fasta has an interface based on the standard Python file. Import oldowan.fasta:

>>> from oldowan.fasta import fasta

Read a FASTA format file:

>>> for entry in fasta('sequences.fasta', 'r'):
...     print entry['name'], len(entry['sequence'])

A more cumbersome, but equivalent way of doing the above:

>>> fasta_file = fasta('sequences.fasta', 'r')
>>> for entry in fasta_file:
...     print entry['name'], len(entry['sequence'])
>>> fasta_file.close()

Even more cumbersome, and if the FASTA file is large, potentially memory-draining version (the previous two methods only read one entry at a time from the file, this reads the whole file into memory at once):

>>> fasta_file = fasta('sequence.fasta', 'r')
>>> entries = fasta_file.readentries()
>>> fasta_file.close()
>>> for entry in entries:
...     print entry['name'], len(entry['sequence'])

Read a string of FASTA format sequences:

>>> fasta_string = open('sequences.fasta', 'r').read()
>>> for entry in fasta(fasta_string, 's'):
...     print entry['name'], len(entry['sequence'])

Read a file object:

>>> fasta_file = open('sequences.fasta', 'r')
>>> for entry in fasta(fasta_file, 'f'):
...     print entry['name'], len(entry['sequence'])

Write to a file:

>>> fasta_file = open('sequences.fasta', 'w')
>>> fasta_file.write({'name':'Sequence1', 'sequence':'AGCTAGCT'})
>>> fasta_file.close()

Release History

1.0.0 (August 16, 2008)
initial release of module.
1.0.1 (March 25, 2009)
bug fix updates
1.0.2 (March 26, 2009)
update VERSION info
1.0.4 (August 4, 2015)
actually fix version loading problem this time
Release History

Release History

This version
History Node

1.0.4

History Node

1.0.3a

History Node

1.0.2

History Node

1.0.1

History Node

1.0.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
oldowan.fasta-1.0.4.tar.gz (5.2 kB) Copy SHA256 Checksum SHA256 Source Aug 4, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting