Package Bio :: Package Restriction :: Module PrintFormat :: Class PrintFormat
[hide private]
[frames] | no frames]

Class PrintFormat

source code

object --+
         |
        PrintFormat
Known Subclasses:

PrintFormat allow the printing of results of restriction analysis.
Instance Methods [hide private]
 
__init__(self)
Initialise.
source code
 
print_as(self, what='list')
Print the results as specified.
source code
 
format_output(self, dct, title='', s1='')
Summarise results as a nicely formatted string.
source code
 
print_that(self, dct, title='', s1='')
Print the output of the format_output method (OBSOLETE).
source code
 
make_format(self, cut=(), title='', nc=(), s1='')
Virtual method used for formatting results.
source code
 
_make_list(self, ls, title, nc, s1)
Summarise a list of positions by enzyme (PRIVATE).
source code
 
_make_map(self, ls, title, nc, s1)
Summarise mapping information as a string (PRIVATE).
source code
 
_make_number(self, ls, title, nc, s1)
Format cutting position information as a string (PRIVATE).
source code
 
_make_nocut(self, ls, title, nc, s1)
Summarise non-cutting enzymes (PRIVATE).
source code
 
_make_nocut_only(self, nc, s1, ls=(), title='')
Summarise non-cutting enzymes (PRIVATE).
source code
 
_make_list_only(self, ls, title, nc=(), s1='')
Summarise list of positions per enzyme (PRIVATE).
source code
 
_make_number_only(self, ls, title, nc=(), s1='')
Summarise number of cuts as a string (PRIVATE).
source code
 
_make_map_only(self, ls, title, nc=(), s1='')
Make string describing cutting map (PRIVATE).
source code
 
__next_section(self, ls, into)
Next section (PRIVATE).
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  ConsoleWidth = 80
  NameWidth = 10
  MaxSize = 6
  Cmodulo = 0
  PrefWidth = 80
  Indent = 4
  linesize = 70
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 
Initialise.
Overrides: object.__init__

print_as(self, what='list')

source code 

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='')

source code 

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='')

source code 

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='')

source code 

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.

_make_list(self, ls, title, nc, s1)

source code 

Summarise a list of positions by enzyme (PRIVATE).

Return a string of form:

title.

enzyme1     :   position1, position2.
enzyme2     :   position1, position2, position3.
Arguments:
  • ls is a tuple or list of cutting enzymes.
  • title is the title.
  • nc is a tuple or list of non cutting enzymes.
  • s1 is the sentence before the non cutting enzymes.

_make_map(self, ls, title, nc, s1)

source code 

Summarise mapping information as a string (PRIVATE).

Return a string of form:

| title.
|
|     enzyme1, position
|     |
| AAAAAAAAAAAAAAAAAAAAA...
| |||||||||||||||||||||
| TTTTTTTTTTTTTTTTTTTTT...
Arguments:
  • ls is a list of cutting enzymes.
  • title is the title.
  • nc is a list of non cutting enzymes.
  • s1 is the sentence before the non cutting enzymes.

_make_number(self, ls, title, nc, s1)

source code 

Format cutting position information as a string (PRIVATE).

Returns a string in the form:

title.

enzyme which cut 1 time:

enzyme1     :   position1.

enzyme which cut 2 times:

enzyme2     :   position1, position2.
...
Arguments:
  • ls is a list of cutting enzymes.
  • title is the title.
  • nc is a list of non cutting enzymes.
  • s1 is the sentence before the non cutting enzymes.

_make_nocut(self, ls, title, nc, s1)

source code 

Summarise non-cutting enzymes (PRIVATE).

Return a formatted string of the non cutting enzymes.

ls is a list of cutting enzymes -> will not be used. Here for compatibility with make_format.

Arguments:
  • title is the title.
  • nc is a list of non cutting enzymes.
  • s1 is the sentence before the non cutting enzymes.

_make_nocut_only(self, nc, s1, ls=(), title='')

source code 

Summarise non-cutting enzymes (PRIVATE).

Return a formatted string of the non cutting enzymes.

Arguments:
  • nc is a tuple or list of non cutting enzymes.
  • s1 is the sentence before the non cutting enzymes.

_make_list_only(self, ls, title, nc=(), s1='')

source code 

Summarise list of positions per enzyme (PRIVATE).

Return a string of form:

title.

enzyme1     :   position1, position2.
enzyme2     :   position1, position2, position3.
...
Arguments:
  • ls is a tuple or list of results.
  • title is a string.
  • Non cutting enzymes are not included.

_make_number_only(self, ls, title, nc=(), s1='')

source code 

Summarise number of cuts as a string (PRIVATE).

Return a string of form:

title.

enzyme which cut 1 time:

enzyme1     :   position1.

enzyme which cut 2 times:

enzyme2     :   position1, position2.
...
Arguments:
  • ls is a list of results.
  • title is a string.
  • Non cutting enzymes are not included.

_make_map_only(self, ls, title, nc=(), s1='')

source code 

Make string describing cutting map (PRIVATE).

Return a string of form:

| title.
|
|     enzyme1, position
|     |
| AAAAAAAAAAAAAAAAAAAAA...
| |||||||||||||||||||||
| TTTTTTTTTTTTTTTTTTTTT...
Arguments:
  • ls is a list of results.
  • title is a string.
  • Non cutting enzymes are not included.

__next_section(self, ls, into)

source code 

Next section (PRIVATE).

Arguments:
  • ls is a tuple/list of tuple (string, [int, int]).
  • into is a string to which the formatted ls will be added.

Format ls as a string of lines: The form is:

enzyme1     :   position1.
enzyme2     :   position2, position3.

then add the formatted ls to tot return tot.