Make an alignment

You need Clustalw installed to run this code. The input file '3seqs.fas' is generated by the last script in page 5.
from Bio.Clustalw import MultipleAlignCL
from Bio.Clustalw import do_alignment

cl = MultipleAlignCL('3seqs.fas')
print cl
align = do_alignment(cl)
# Show align.
print align

Retrieve and Parse a PDB file

PDB files (are expected to) follow a SMCRA model:


(Graph taken from Biopython Tutorial and Cookbook).

This program walks over a PDB record (4hhb) and extract selected data. The file '4hhb.pdb.gz' is included in the data package.

import urllib
import gzip

from Bio.PDB.PDBParser import PDBParser 

def disorder(structure):
    for chain in structure[0].get_list():
        for residue in chain.get_list():
           for atom in residue.get_list():
               if atom.is_disordered():
                   print residue, atom
    return None

# Uncomment lines with ## to retrieve the file from the net:               
##pdburl = ''
##handle = urllib.urlopen(pdburl)
##fh = open('4hhb.pdb.gz','w')
# Uncompress
handle ='4hhb.pdb.gz')
# Parse the pdb file
parser = PDBParser(PERMISSIVE=1)
structure = parser.get_structure("test", handle)

model = structure[0]
print model.child_list
chain = model['B']
print chain.child_list[:5]
residue = chain[4]
print residue.child_list
atom = residue['CB']
print atom.bfactor
print atom.coord

More information



Thanks to people who makes Biopython (list)