bpy1. Biopython

If using Anaconda, you can install Biopython, from the terminal, using:

$ conda install biopython

Not every package is on conda. You might first search:

$ conda search biopython

or some other package. So for example, we can search Beautiful Soup, for HTML parsing, using:

$ conda search beautiful-soup

or a partial name such as

$ conda search beau

If it is not on conda, you can always use pip to install it:

$ <path to Anaconda folder>/bin/pip install package

You should get the exact package name from their website.

The most important data structure in Biopython is the sequence (Seq), and SeqRecord, to hold sequence with annotation. Here, we create a 4-sequence long DNA.


# bpy1.py
from __future__ import print_function
import Bio
from Bio.Seq import Seq
from Bio.Alphabet import IUPAC
print("version:",Bio.__version__)
four = Seq("AGTG",IUPAC.unambiguous_dna)
print("seq:",four)
print("seq alphabet:",four.alphabet)
print("complement:",four.complement())
#version: 1.65
#seq: AGTG
#seq alphabet: IUPACUnambiguousDNA()
#complement: TCAC

Leave a Reply

Your email address will not be published. Required fields are marked *