Bio.Restriction.PrintFormat module

Print the results of restriction enzyme analysis.

PrintFormat prints the results from restriction analysis in 3 different format: list, column or map.

The easiest way to use it is:

>>> from Bio.Restriction.PrintFormat import PrintFormat
>>> from Bio.Restriction.Restriction import RestrictionBatch
>>> from Bio.Seq import Seq
>>> pBs_mcs = Seq('GGTACCGGGCCCCCCCTCGAGGTCGACGGTATCGATAAGCTTGATATCGAATTC')
>>> restriction_batch = RestrictionBatch(['EcoRI', 'BamHI', 'ApaI'])
>>> result = restriction_batch.search(pBs_mcs)
>>> my_map = PrintFormat()
>>> my_map.print_that(result, 'My pBluescript mcs analysis:\n',
...               'No site:\n')
My pBluescript mcs analysis:
ApaI       :  12.
EcoRI      :  50.
No site:
BamHI     

>>> my_map.sequence = pBs_mcs
>>> my_map.print_as("map")
>>> my_map.print_that(result)
           12 ApaI
           |                                                
           |                                     50 EcoRI
           |                                     |          
GGTACCGGGCCCCCCCTCGAGGTCGACGGTATCGATAAGCTTGATATCGAATTC
||||||||||||||||||||||||||||||||||||||||||||||||||||||
CCATGGCCCGGGGGGGAGCTCCAGCTGCCATAGCTATTCGAACTATAGCTTAAG
1                                                   54


   Enzymes which do not cut the sequence.

BamHI     

>>>

Some of the methods of PrintFormat are meant to be overridden by derived class.

Use the following parameters to control the appearance:

  • ConsoleWidthwidth of the console used default to 80.

    should never be less than 60.

  • NameWidth : space attributed to the name in PrintList method.

  • Indent : Indent of the second line.

  • MaxSizeMaximal size of the sequence (default=6:

    -> 99 999 bp + 1 trailing ‘,’ people are unlikely to ask for restriction map of sequences bigger than 100.000 bp. This is needed to determine the space to be reserved for sites location.

    • MaxSize = 5 => 9.999 bp

    • MaxSize = 6 => 99.999 bp

    • MaxSize = 7 => 999.999 bp

Example output:

<------------ ConsoleWidth --------------->
<- NameWidth ->
EcoRI         :   1, 45, 50, 300, 400, 650,
                      700, 1200, 2500.
                  <-->
                    Indent
class Bio.Restriction.PrintFormat.PrintFormat

Bases: object

PrintFormat allow the printing of results of restriction analysis.

ConsoleWidth = 80
NameWidth = 10
MaxSize = 6
Cmodulo = 0
PrefWidth = 80
Indent = 4
linesize = 70
__init__(self)

Initialise.

print_as(self, what='list')

Print the results as specified.

Valid format are:

‘list’ -> alphabetical order ‘number’ -> number of sites in the sequence ‘map’ -> a map representation of the sequence with the sites.

If you want more flexibility over-ride the virtual method make_format.

format_output(self, dct, title='', s1='')

Summarise results as a nicely formatted string.

Arguments:
  • dct is a dictionary as returned by a RestrictionBatch.search()

  • title is the title of the map. It must be a formatted string, i.e. you must include the line break.

  • s1 is the title separating the list of enzymes that have sites from those without sites.

  • s1 must be a formatted string as well.

The format of print_that is a list.

print_that(self, dct, title='', s1='')

Print the output of the format_output method (OBSOLETE).

Arguments:
  • dct is a dictionary as returned by a RestrictionBatch.search()

  • title is the title of the map. It must be a formatted string, i.e. you must include the line break.

  • s1 is the title separating the list of enzymes that have sites from those without sites.

  • s1 must be a formatted string as well.

This method prints the output of A.format_output() and it is here for backwards compatibility.

make_format(self, cut=(), title='', nc=(), s1='')

Virtual method used for formatting results.

Virtual method. Here to be pointed to one of the _make_* methods. You can as well create a new method and point make_format to it.