Download and Installation
See our downloads page for details including the prerequisites. For Windows we provide click-and-run installers. Most Linux distributions will include an optional Biopython package. Otherwise you typically install from source by downloading and uncompressing the archive, then running the command:
sudo python setup.py install
You can check your installation has worked at the python prompt:
>>> import Bio
If that gives no error, you should be done. If you get something like "ImportError: No module named Bio" something has gone wrong.
from Bio.Seq import Seq,translate #create a sequence object of some DNA my_seq = Seq('CATGTAGATAG') #print out some details about it print 'seq is %i bases long' % len(my_seq) print 'reverse complement is %s' % my_seq.reverse_complement().tostring() #or see the whole record print 'sequence record:', my_seq #translate the sequence into a protein my_protein = translate(my_seq) print 'protein translation is %s' % my_protein.tostring() print 'protein record:', my_protein
seq is 11 bases long reverse complement is CTATCTACATG sequence record: Seq('CATGTAGATAG', Alphabet()) protein translation is HVD protein record: Seq('HVD', HasStopCodon(IUPACProtein(), '*'))
Reading and writing Sequence Files
If you are using Biopython 1.43 or later, try out the new SeqIO module.
- Learn how to program in Python
- Browse the Biopython Tutorial
- Examine the Class Diagram if you'd like to know more about the relationships between the modules.
- Use the Wiki Search tools to find more information on specific topics.