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]
new PrintFormat Instance
__init__()
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
print the results as specified
print_as(PF, what='list')
'list' -> alphabetical order 'number' -> number of sites in the sequence 'map' -> a map representation of the sequence with the sites.
source code
 
print_that(self, dct, title='', s1='')
PF.print_that(dct, [title[, s1]]) -> Print dct nicely formatted.
source code
string
make_format(PF, cut, nc=[], title='', s=[])
Virtual method.
source code
string
_make_list(PF, ls, title, nc, s1)
return a string of form:
source code
string
_make_map(PF, ls, title, nc, s1)
return a string of form:
source code
string
_make_number(PF, ls, title, nc, s1)
Returns a string in the form:
source code
string
_make_nocut(PF, ls, title, nc, s1)
return a formatted string of the non cutting enzymes.
source code
string
_make_nocut_only(PF, nc, s1)
return a formatted string of the non cutting enzymes.
source code
string
_make_list_only(PF, ls, title)
return a string of form:
source code
string
_make_number_only(PF, ls, title)
return a string of form:
source code
string
_make_map_only(PF, ls, title)
return a string of form:
source code
string
__next_section(FP, ls, into)
ls is a list of tuple (string, [int, int]).
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__()
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Returns: new PrintFormat Instance
Overrides: object.__init__

print_as(PF, what='list')

source code 
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.

Returns: print the results as specified

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

source code 

PF.print_that(dct, [title[, s1]]) -> Print dct nicely formatted.

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.

make_format(PF, cut, nc=[], title='', s=[])

source code 
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.
Returns: string

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

source code 

return a string of form:

title.

enzyme1     :   position1, position2.
enzyme2     :   position1, position2, position3.
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.
Returns: string

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

source code 

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.
Returns: string

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

source code 

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.
Returns: string

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

source code 

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.
Returns: string

_make_nocut_only(PF, nc, s1)

source code 

return a formatted string of the non cutting enzymes.

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

_make_list_only(PF, ls, title)

source code 

return a string of form:

title.

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

_make_number_only(PF, ls, title)

source code 

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.
Returns: string

_make_map_only(PF, ls, title)

source code 

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.
Returns: string

__next_section(FP, ls, into)

source code 
Arguments:
  • ls is a 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.

Returns: string