Getting Started

(Difference between revisions)
Jump to: navigation, search
(Initial page creation modeled off of equivalent page for bioperl)
 
m (Reverted edits by Jennifer M. Lintz (Talk) to last revision by Sbassi)
(21 intermediate revisions by 7 users not shown)
Line 1: Line 1:
--[[User:Jblucks|Jblucks]] 16:36, 19 January 2007 (EST): This page modeled after the one for bioperl
+
==Download and Installation==
  
==Download==
+
For Windows we provide click-and-run installers.  Most Linux distributions will include an optional Biopython package (although this may be out of date).  Otherwise you typically download and uncompress the archive, and install from source.  See our [[Download|downloads page]] for details including the prerequisites.
  
See [[Getting BioPerl]]
+
You can check your installation has worked at the python prompt:
  
==Installation==
+
<python>
 +
>>> import Bio
 +
</python>
 +
 
 +
If that gives no error, you should be done.  If you get something like "ImportError: No module named Bio" something has gone wrong.
 +
 
 +
==Tutorial==
  
See [[Installing BioPerl]]
+
The Biopython Tutorial and Cookbook ([http://biopython.org/DIST/docs/tutorial/Tutorial.html HTML], [http://biopython.org/DIST/docs/tutorial/Tutorial.pdf PDF]) contains the bulk of our documentation.  See [[Documentation]] for more links.
  
 
==Quick example==
 
==Quick example==
  
 +
Try executing this in python:
 
<python>
 
<python>
from Bio.Seq import Seq,translate
+
from Bio.Seq import Seq
import Bio.SeqIO
+
  
#create a sequence object of some DNA
+
#create a sequence object
my_seq = Seq('CATGTAGATAG')
+
my_seq = Seq('CATGTAGACTAG')
  
 
#print out some details about it
 
#print out some details about it
print 'seq is %i bases long' % len(my_seq)
+
print 'seq %s is %i bases long' % (my_seq, len(my_seq))
print 'reverse complement is %s' % my_seq.reverse_complement().tostring()
+
print 'reverse complement is %s' % my_seq.reverse_complement()
 +
print 'protein translation is %s' % my_seq.translate()
 +
</python>
  
#or see the whole record
+
You should get the following output:
print my_seq
+
<pre>
 +
seq CATGTAGACTAG is 12 bases long
 +
reverse complement is CTAGTCTACATG
 +
protein translation is HVD*
 +
</pre>
  
#translate the sequence into a protein
+
This was a very quick demonstration of Biopython's [[Seq]] (sequence) object and some of its methods.
my_protein = translate(my_seq)
+
  
print 'protein translation is %s' % my_protein.tostring()
+
==Reading and writing Sequence Files==
print my_protein
+
  
</python>
+
Use the [[SeqIO]] module for reading or writing sequences as [[SeqRecord]] objects.  For multiple sequence alignment files, you can alternatively use the [[AlignIO]] module.
  
 
==Beginners==
 
==Beginners==
  
* Learn how to program in [[Perl]], see several [[Tutorials]]
+
* Learn how to program in [http://www.python.org Python]
** [http://stein.cshl.org/genome_informatics/ Genome Informatics]
+
** [http://swaroopch.info/text/Byte_of_Python:Main_Page A Byte of Python]
** [http://www.perlmonks.org/index.pl?node=Tutorials PerlMonks Tutorials]
+
** [http://www.diveintopython.org/toc/index.html Dive Into Python]
** [http://www.perl.com/cs/user/query/q/6?id_topic=74 Perl.com tutorials]
+
** [http://rgruet.free.fr/PQR25/PQR2.5.html Python Quick Reference]
** [http://www.ebb.org/PickingUpPerl/ Picking up Perl]
+
* Browse the [http://biopython.org/DIST/docs/tutorial/Tutorial.html Biopython Tutorial]
** [http://learn.perl.org/ Learn Perl]
+
* Read this paper <biblio>Bassi2007 pmid=18052533</biblio>
* Read the {{HOWTO|Beginners}}
+
* Examine the [http://biopython.org/DIST/docs/api Class Diagram] if you'd like to know more about the relationships between the modules.
* Browse the [[Bptutorial|Bioperl Tutorial]]
+
* Examine the [[Class Diagram]] if you'd like to know more about the relationships between the modules.
+
  
 
==Further reading==
 
==Further reading==
  
* Read the other [[HOWTOs]]
 
 
* Use the Wiki Search tools to find more information on specific topics.
 
* Use the Wiki Search tools to find more information on specific topics.
 
[[Category:Documentation]]
 
[[Category:TODO]]
 

Revision as of 12:24, 2 July 2010

Contents

Download and Installation

For Windows we provide click-and-run installers. Most Linux distributions will include an optional Biopython package (although this may be out of date). Otherwise you typically download and uncompress the archive, and install from source. See our downloads page for details including the prerequisites.

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.

Tutorial

The Biopython Tutorial and Cookbook (HTML, PDF) contains the bulk of our documentation. See Documentation for more links.

Quick example

Try executing this in python:

from Bio.Seq import Seq
 
#create a sequence object
my_seq = Seq('CATGTAGACTAG')
 
#print out some details about it
print 'seq %s is %i bases long' % (my_seq, len(my_seq))
print 'reverse complement is %s' % my_seq.reverse_complement()
print 'protein translation is %s' % my_seq.translate()

You should get the following output:

seq CATGTAGACTAG is 12 bases long
reverse complement is CTAGTCTACATG
protein translation is HVD*

This was a very quick demonstration of Biopython's Seq (sequence) object and some of its methods.

Reading and writing Sequence Files

Use the SeqIO module for reading or writing sequences as SeqRecord objects. For multiple sequence alignment files, you can alternatively use the AlignIO module.

Beginners

  • Examine the Class Diagram if you'd like to know more about the relationships between the modules.

Further reading

  • Use the Wiki Search tools to find more information on specific topics.
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox