Back to index

python-biopython  1.60
Classes | Functions | Variables
Bio.Wise.psw Namespace Reference

Classes

class  AlignmentColumnFullException
class  Alignment
class  AlignmentColumn
class  ColumnUnit

Functions

def parse_line
def parse
def align
def main
def _test

Variables

string __version__ = "$Revision: 1.5 $"
list _CMDLINE_PSW = ["psw", "-l", "-F"]
string _OPTION_GAP_START = "-g"
string _OPTION_GAP_EXTENSION = "-e"
string _OPTION_SCORES = "-m"
tuple _re_unit = re.compile(r"^Unit +([01])- \[ *(-?\d+)- *(-?\d+)\] \[(\w+)\]$")

Class Documentation

class Bio::Wise::psw::AlignmentColumnFullException

Definition at line 27 of file psw.py.


Function Documentation

def Bio.Wise.psw._test (   args,
  keywds 
) [private]

Definition at line 133 of file psw.py.

00133 
00134 def _test(*args, **keywds):
00135     import doctest, sys
00136     doctest.testmod(sys.modules[__name__], *args, **keywds)

Here is the call graph for this function:

def Bio.Wise.psw.align (   pair,
  scores = None,
  gap_start = None,
  gap_extension = None,
  args,
  keywds 
)

Definition at line 118 of file psw.py.

00118 
00119           *args, **keywds):
00120     
00121     cmdline = _CMDLINE_PSW[:]
00122     if scores:
00123         cmdline.extend((_OPTION_SCORES, scores))
00124     if gap_start:
00125         cmdline.extend((_OPTION_GAP_START, str(gap_start)))
00126     if gap_extension:
00127         cmdline.extend((_OPTION_GAP_EXTENSION, str(gap_extension)))
00128     temp_file = Wise.align(cmdline, pair, *args, **keywds)
00129     return parse(temp_file)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 130 of file psw.py.

00130 
00131 def main():
00132     print align(sys.argv[1:3])

Here is the call graph for this function:

Here is the caller graph for this function:

def Bio.Wise.psw.parse (   iterable)
format

Column 0:
Unit  0- [  -1-   0] [SEQUENCE]
Unit  1- [  85-  86] [SEQUENCE]

means that seq1[0] == seq2[86] (0-based)

Definition at line 89 of file psw.py.

00089 
00090 def parse(iterable):
00091     """
00092     format
00093 
00094     Column 0:
00095     Unit  0- [  -1-   0] [SEQUENCE]
00096     Unit  1- [  85-  86] [SEQUENCE]
00097 
00098     means that seq1[0] == seq2[86] (0-based)
00099     """
00100 
00101     alignment = Alignment()
00102     for line in iterable:
00103         try:
00104             if os.environ["WISE_PY_DEBUG"]:
00105                 print line,
00106         except KeyError:
00107             pass
00108             
00109         column_unit = parse_line(line)
00110         if column_unit:
00111             alignment.append(column_unit)
00112 
00113     return alignment

Here is the call graph for this function:

Here is the caller graph for this function:

def Bio.Wise.psw.parse_line (   line)
>>> print parse_line("Column 0:")
None
>>> parse_line("Unit  0- [  -1-   0] [SEQUENCE]")
ColumnUnit(unit=0, column=0, SEQUENCE)
>>> parse_line("Unit  1- [  85-  86] [SEQUENCE]")
ColumnUnit(unit=1, column=86, SEQUENCE)

Definition at line 73 of file psw.py.

00073 
00074 def parse_line(line):
00075     """
00076     >>> print parse_line("Column 0:")
00077     None
00078     >>> parse_line("Unit  0- [  -1-   0] [SEQUENCE]")
00079     ColumnUnit(unit=0, column=0, SEQUENCE)
00080     >>> parse_line("Unit  1- [  85-  86] [SEQUENCE]")
00081     ColumnUnit(unit=1, column=86, SEQUENCE)
00082     """
00083     match = _re_unit.match(line.rstrip())
00084 
00085     if not match:
00086         return
00087 
00088     return ColumnUnit(int(match.group(1)), int(match.group(3)), match.group(4))
    

Here is the caller graph for this function:


Variable Documentation

string Bio.Wise.psw.__version__ = "$Revision: 1.5 $"

Definition at line 14 of file psw.py.

list Bio.Wise.psw._CMDLINE_PSW = ["psw", "-l", "-F"]

Definition at line 22 of file psw.py.

Definition at line 24 of file psw.py.

Definition at line 23 of file psw.py.

Definition at line 25 of file psw.py.

tuple Bio.Wise.psw._re_unit = re.compile(r"^Unit +([01])- \[ *(-?\d+)- *(-?\d+)\] \[(\w+)\]$")

Definition at line 72 of file psw.py.