Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
Bio.Blast.Record.MultipleAlignment Class Reference

List of all members.

Public Member Functions

def __init__
def to_generic

Public Attributes

 alignment

Detailed Description

Holds information about a multiple alignment.

Members:
alignment  A list of tuples (name, start residue, sequence, end residue).

The start residue is 1-based.  It may be blank, if that sequence is
not aligned in the multiple alignment.

Definition at line 192 of file Record.py.


Constructor & Destructor Documentation

Definition at line 202 of file Record.py.

00202 
00203     def __init__(self):
00204         self.alignment = []

Here is the caller graph for this function:


Member Function Documentation

def Bio.Blast.Record.MultipleAlignment.to_generic (   self,
  alphabet 
)
Retrieve generic alignment object for the given alignment.

Instead of the tuples, this returns an Alignment object from
Bio.Align.Generic, through which you can manipulate and query
the object.

alphabet is the specified alphabet for the sequences in the code (for
example IUPAC.IUPACProtein.

Thanks to James Casbon for the code.

Definition at line 205 of file Record.py.

00205 
00206     def to_generic(self, alphabet):
00207         """Retrieve generic alignment object for the given alignment.
00208 
00209         Instead of the tuples, this returns an Alignment object from
00210         Bio.Align.Generic, through which you can manipulate and query
00211         the object.
00212 
00213         alphabet is the specified alphabet for the sequences in the code (for
00214         example IUPAC.IUPACProtein.
00215 
00216         Thanks to James Casbon for the code.
00217         """
00218         #TODO - Switch to new Bio.Align.MultipleSeqAlignment class?
00219         seq_parts = []
00220         seq_names = []
00221         parse_number = 0
00222         n = 0
00223         for name, start, seq, end in self.alignment:
00224             if name == 'QUERY': #QUERY is the first in each alignment block
00225                 parse_number += 1
00226                 n = 0
00227 
00228             if parse_number == 1: # create on first_parse, append on all others
00229                 seq_parts.append(seq)
00230                 seq_names.append(name)
00231             else:
00232                 seq_parts[n] += seq
00233                 n += 1
00234 
00235         generic = Generic.Alignment(alphabet)
00236         for (name,seq) in zip(seq_names,seq_parts):
00237             generic.add_sequence(name, seq)
00238 
00239         return generic


Member Data Documentation

Definition at line 203 of file Record.py.


The documentation for this class was generated from the following file: