Back to index

python-biopython  1.60
Public Member Functions | Public Attributes | Private Member Functions
Bio.Restriction.Restriction.Palindromic Class Reference
Inheritance diagram for Bio.Restriction.Restriction.Palindromic:
Inheritance graph
[legend]
Collaboration diagram for Bio.Restriction.Restriction.Palindromic:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def is_palindromic
def search
def all_suppliers
def is_equischizomer
def is_neoschizomer
def is_isoschizomer
def equischizomers
def neoschizomers
def isoschizomers
def frequency
def __add__
def __div__
def __rdiv__
def __truediv__
def __rtruediv__
def __floordiv__
def __rfloordiv__
def __str__
def __repr__
def __len__
def __hash__
def __eq__
def __ne__
def __rshift__
def __mod__
def __ge__
def __gt__
def __le__
def __lt__

Public Attributes

 results

Private Member Functions

def _search

Detailed Description

Implement the methods specific to the enzymes which are palindromic

palindromic means : the recognition site and its reverse complement are
                    identical.
Remarks     : an enzyme with a site CGNNCG is palindromic even if some
              of the sites that it will recognise are not.
              for example here : CGAACG

Internal use only. Not meant to be instantiated.

Definition at line 810 of file Restriction.py.


Member Function Documentation

def Bio.Restriction.Restriction.RestrictionType.__add__ (   cls,
  other 
) [inherited]
RE.__add__(other) -> RestrictionBatch().

if other is an enzyme returns a batch of the two enzymes.
if other is already a RestrictionBatch add enzyme to it.

Definition at line 250 of file Restriction.py.

00250 
00251     def __add__(cls, other):
00252         """RE.__add__(other) -> RestrictionBatch().
00253 
00254         if other is an enzyme returns a batch of the two enzymes.
00255         if other is already a RestrictionBatch add enzyme to it."""
00256         if isinstance(other, RestrictionType):
00257             return RestrictionBatch([cls, other])    
00258         elif isinstance(other, RestrictionBatch):
00259             return other.add_nocheck(cls)
00260         else:
00261             raise TypeError
        
def Bio.Restriction.Restriction.RestrictionType.__div__ (   cls,
  other 
) [inherited]
RE.__div__(other) -> list.

RE/other
returns RE.search(other).

Definition at line 262 of file Restriction.py.

00262 
00263     def __div__(cls, other):
00264         """RE.__div__(other) -> list.
00265 
00266         RE/other
00267         returns RE.search(other)."""
00268         return cls.search(other)
    
def Bio.Restriction.Restriction.RestrictionType.__eq__ (   cls,
  other 
) [inherited]
RE == other -> bool

True if RE and other are the same enzyme.

Specifically this checks they are the same Python object.

Definition at line 327 of file Restriction.py.

00327 
00328     def __eq__(cls, other):
00329         """RE == other -> bool
00330 
00331         True if RE and other are the same enzyme.
00332         
00333         Specifically this checks they are the same Python object.
00334         """
00335         #assert (id(cls)==id(other)) == (other is cls) == (cls is other)
00336         return id(cls)==id(other)

def Bio.Restriction.Restriction.RestrictionType.__floordiv__ (   cls,
  other 
) [inherited]
RE.__floordiv__(other) -> list.

RE//other
returns RE.catalyse(other).

Definition at line 290 of file Restriction.py.

00290 
00291     def __floordiv__(cls, other):
00292         """RE.__floordiv__(other) -> list.
00293 
00294         RE//other
00295         returns RE.catalyse(other)."""
00296         return cls.catalyse(other)
    
def Bio.Restriction.Restriction.RestrictionType.__ge__ (   cls,
  other 
) [inherited]
a >= b -> bool.

a is greater or equal than b if the a site is longer than b site.
if their site have the same length sort by alphabetical order of their
names.

Definition at line 373 of file Restriction.py.

00373 
00374     def __ge__(cls, other):
00375         """a >= b -> bool.
00376 
00377         a is greater or equal than b if the a site is longer than b site.
00378         if their site have the same length sort by alphabetical order of their
00379         names."""
00380         if not isinstance(other, RestrictionType):
00381             raise NotImplementedError
00382         if len(cls) > len(other):
00383             return True
00384         elif cls.size == len(other) and cls.__name__ >= other.__name__:
00385             return True
00386         else:
00387             return False

def Bio.Restriction.Restriction.RestrictionType.__gt__ (   cls,
  other 
) [inherited]
a > b -> bool.

sorting order:
    1. size of the recognition site.
    2. if equal size, alphabetical order of the names.

Definition at line 388 of file Restriction.py.

00388 
00389     def __gt__(cls, other):
00390         """a > b -> bool.
00391 
00392         sorting order:
00393                     1. size of the recognition site.
00394                     2. if equal size, alphabetical order of the names."""
00395         if not isinstance(other, RestrictionType):
00396             raise NotImplementedError
00397         if len(cls) > len(other):
00398             return True
00399         elif cls.size == len(other) and cls.__name__ > other.__name__:
00400             return True
00401         else:
00402             return False

Definition at line 322 of file Restriction.py.

00322 
00323     def __hash__(cls):
00324         #Python default is to use id(...)
00325         #This is consistent with the __eq__ implementation
00326         return id(cls)
    
def Bio.Restriction.Restriction.RestrictionType.__le__ (   cls,
  other 
) [inherited]
a <= b -> bool.

sorting order:
    1. size of the recognition site.
    2. if equal size, alphabetical order of the names.

Definition at line 403 of file Restriction.py.

00403 
00404     def __le__(cls, other):
00405         """a <= b -> bool.
00406 
00407         sorting order:
00408                     1. size of the recognition site.
00409                     2. if equal size, alphabetical order of the names."""
00410         if not isinstance(other, RestrictionType):
00411             raise NotImplementedError
00412         elif len(cls) < len(other):
00413             return True
00414         elif len(cls) == len(other) and cls.__name__ <= other.__name__:
00415             return True
00416         else:
00417             return False

RE.__len__() -> int.

length of the recognition site.

Definition at line 316 of file Restriction.py.

00316 
00317     def __len__(cls):
00318         """RE.__len__() -> int.
00319 
00320         length of the recognition site."""
00321         return cls.size
    
def Bio.Restriction.Restriction.RestrictionType.__lt__ (   cls,
  other 
) [inherited]
a < b -> bool.

sorting order:
    1. size of the recognition site.
    2. if equal size, alphabetical order of the names.

Definition at line 418 of file Restriction.py.

00418 
00419     def __lt__(cls, other):
00420         """a < b -> bool.
00421 
00422         sorting order:
00423                     1. size of the recognition site.
00424                     2. if equal size, alphabetical order of the names."""
00425         if not isinstance(other, RestrictionType):
00426             raise NotImplementedError
00427         elif len(cls) < len(other):
00428             return True
00429         elif len(cls) == len(other) and cls.__name__ < other.__name__:
00430             return True
00431         else:
00432             return False
    
def Bio.Restriction.Restriction.RestrictionType.__mod__ (   cls,
  other 
) [inherited]
a % b -> bool.

Test compatibility of the overhang of a and b.
True if a and b have compatible overhang.

Definition at line 363 of file Restriction.py.

00363 
00364     def __mod__(cls, other):
00365         """a % b -> bool.
00366 
00367         Test compatibility of the overhang of a and b.
00368         True if a and b have compatible overhang."""
00369         if not isinstance(other, RestrictionType):
00370             raise TypeError( \
00371                   'expected RestrictionType, got %s instead' % type(other))
00372         return cls._mod1(other)
        
def Bio.Restriction.Restriction.RestrictionType.__ne__ (   cls,
  other 
) [inherited]
RE != other -> bool.
isoschizomer strict, same recognition site, same restriction -> False
all the other-> True

WARNING - This is not the inverse of the __eq__ method.

Definition at line 337 of file Restriction.py.

00337 
00338     def __ne__(cls, other):
00339         """RE != other -> bool.
00340         isoschizomer strict, same recognition site, same restriction -> False
00341         all the other-> True
00342         
00343         WARNING - This is not the inverse of the __eq__ method.
00344         """
00345         if not isinstance(other, RestrictionType):
00346             return True
00347         elif cls.charac == other.charac:
00348             return False
00349         else:
00350             return True

def Bio.Restriction.Restriction.RestrictionType.__rdiv__ (   cls,
  other 
) [inherited]
RE.__rdiv__(other) -> list.

other/RE
returns RE.search(other).

Definition at line 269 of file Restriction.py.

00269 
00270     def __rdiv__(cls, other):
00271         """RE.__rdiv__(other) -> list.
00272 
00273         other/RE
00274         returns RE.search(other)."""
00275         return cls.search(other)
    
RE.__repr__() -> str.

used with eval or exec will instantiate the enzyme.

Definition at line 310 of file Restriction.py.

00310 
00311     def __repr__(cls):
00312         """RE.__repr__() -> str.
00313 
00314         used with eval or exec will instantiate the enzyme."""
00315         return "%s" % cls.__name__
    
def Bio.Restriction.Restriction.RestrictionType.__rfloordiv__ (   cls,
  other 
) [inherited]
RE.__rfloordiv__(other) -> list.

other//RE
returns RE.catalyse(other).

Definition at line 297 of file Restriction.py.

00297 
00298     def __rfloordiv__(cls, other):
00299         """RE.__rfloordiv__(other) -> list.
00300 
00301         other//RE
00302         returns RE.catalyse(other)."""
00303         return cls.catalyse(other)
    
def Bio.Restriction.Restriction.RestrictionType.__rshift__ (   cls,
  other 
) [inherited]
RE >> other -> bool.

neoschizomer : same recognition site, different restriction. -> True
all the others :                                             -> False

Definition at line 351 of file Restriction.py.

00351 
00352     def __rshift__(cls, other):
00353         """RE >> other -> bool.
00354         
00355         neoschizomer : same recognition site, different restriction. -> True
00356         all the others :                                             -> False"""
00357         if not isinstance(other, RestrictionType):
00358             return False
00359         elif cls.site == other.site and cls.charac != other.charac:
00360             return True
00361         else:
00362             return False

def Bio.Restriction.Restriction.RestrictionType.__rtruediv__ (   cls,
  other 
) [inherited]
RE.__rtruediv__(other) -> list.

other/RE
returns RE.search(other).

Definition at line 283 of file Restriction.py.

00283 
00284     def __rtruediv__(cls, other):
00285         """RE.__rtruediv__(other) -> list.
00286 
00287         other/RE
00288         returns RE.search(other)."""
00289         return cls.search(other)
    
RE.__str__() -> str.

return the name of the enzyme.

Definition at line 304 of file Restriction.py.

00304 
00305     def __str__(cls):
00306         """RE.__str__() -> str.
00307 
00308         return the name of the enzyme."""
00309         return cls.__name__
    
def Bio.Restriction.Restriction.RestrictionType.__truediv__ (   cls,
  other 
) [inherited]
RE.__truediv__(other) -> list.

RE/other
returns RE.search(other).

Definition at line 276 of file Restriction.py.

00276 
00277     def __truediv__(cls, other):
00278         """RE.__truediv__(other) -> list.
00279 
00280         RE/other
00281         returns RE.search(other)."""
00282         return cls.search(other)
    
RE._search() -> list.

for internal use only.

implement the search method for palindromic and non palindromic enzyme.

Definition at line 822 of file Restriction.py.

00822 
00823     def _search(self):
00824         """RE._search() -> list.
00825 
00826         for internal use only.
00827 
00828         implement the search method for palindromic and non palindromic enzyme.
00829         """
00830         siteloc = self.dna.finditer(self.compsite,self.size)
00831         self.results = [r for s,g in siteloc for r in self._modify(s)]
00832         if self.results : self._drop()
00833         return self.results

Here is the call graph for this function:

RE.all_suppliers -> print all the suppliers of R

Definition at line 470 of file Restriction.py.

00470 
00471     def all_suppliers(self):
00472         """RE.all_suppliers -> print all the suppliers of R"""
00473         supply = [x[0] for x in suppliers_dict.itervalues()]
00474         supply.sort()
00475         print ",\n".join(supply)
00476         return

def Bio.Restriction.Restriction.AbstractCut.equischizomers (   self,
  batch = None 
) [inherited]
RE.equischizomers([batch]) -> list.

return a tuple of all the isoschizomers of RE.
if batch is supplied it is used instead of the default AllEnzymes.

equischizomer <=> same site, same position of restriction.

Definition at line 508 of file Restriction.py.

00508 
00509     def equischizomers(self, batch=None):
00510         """RE.equischizomers([batch]) -> list.
00511 
00512         return a tuple of all the isoschizomers of RE.
00513         if batch is supplied it is used instead of the default AllEnzymes.
00514 
00515         equischizomer <=> same site, same position of restriction."""
00516         if not batch : batch = AllEnzymes
00517         r = [x for x in batch if not self != x]
00518         i = r.index(self)
00519         del r[i]
00520         r.sort()
00521         return r

RE.frequency() -> int.

frequency of the site.

Definition at line 549 of file Restriction.py.

00549 
00550     def frequency(self):
00551         """RE.frequency() -> int.
00552 
00553         frequency of the site."""
00554         return self.freq
00555 

def Bio.Restriction.Restriction.AbstractCut.is_equischizomer (   self,
  other 
) [inherited]
RE.is_equischizomers(other) -> bool.

True if other is an isoschizomer of RE.
False else.

equischizomer <=> same site, same position of restriction.

Definition at line 478 of file Restriction.py.

00478 
00479     def is_equischizomer(self, other):
00480         """RE.is_equischizomers(other) -> bool.
00481 
00482         True if other is an isoschizomer of RE.
00483         False else.
00484 
00485         equischizomer <=> same site, same position of restriction."""
00486         return not self != other

def Bio.Restriction.Restriction.AbstractCut.is_isoschizomer (   self,
  other 
) [inherited]
RE.is_isoschizomers(other) -> bool.

True if other is an isoschizomer of RE.
False else.

isoschizomer <=> same site.

Definition at line 498 of file Restriction.py.

00498 
00499     def is_isoschizomer(self, other):
00500         """RE.is_isoschizomers(other) -> bool.
00501 
00502         True if other is an isoschizomer of RE.
00503         False else.
00504 
00505         isoschizomer <=> same site."""
00506         return (not self != other) or self >> other

def Bio.Restriction.Restriction.AbstractCut.is_neoschizomer (   self,
  other 
) [inherited]
RE.is_neoschizomers(other) -> bool.

True if other is an isoschizomer of RE.
False else.

neoschizomer <=> same site, different position of restriction.

Definition at line 488 of file Restriction.py.

00488 
00489     def is_neoschizomer(self, other):
00490         """RE.is_neoschizomers(other) -> bool.
00491 
00492         True if other is an isoschizomer of RE.
00493         False else.
00494 
00495         neoschizomer <=> same site, different position of restriction."""
00496         return self >> other

RE.is_palindromic() -> bool.

True if the recognition site is a palindrom.

Definition at line 835 of file Restriction.py.

00835 
00836     def is_palindromic(self):
00837         """RE.is_palindromic() -> bool.
00838 
00839         True if the recognition site is a palindrom."""
00840         return True
00841 

def Bio.Restriction.Restriction.AbstractCut.isoschizomers (   self,
  batch = None 
) [inherited]
RE.isoschizomers([batch]) -> list.

return a tuple of all the equischizomers and neoschizomers of RE.
if batch is supplied it is used instead of the default AllEnzymes.

Definition at line 536 of file Restriction.py.

00536 
00537     def isoschizomers(self, batch=None):
00538         """RE.isoschizomers([batch]) -> list.
00539 
00540         return a tuple of all the equischizomers and neoschizomers of RE.
00541         if batch is supplied it is used instead of the default AllEnzymes."""
00542         if not batch : batch = AllEnzymes 
00543         r = [x for x in batch if (self >> x) or (not self != x)]
00544         i = r.index(self)
00545         del r[i]
00546         r.sort()
00547         return r

def Bio.Restriction.Restriction.AbstractCut.neoschizomers (   self,
  batch = None 
) [inherited]
RE.neoschizomers([batch]) -> list.

return a tuple of all the neoschizomers of RE.
if batch is supplied it is used instead of the default AllEnzymes.

neoschizomer <=> same site, different position of restriction.

Definition at line 523 of file Restriction.py.

00523 
00524     def neoschizomers(self, batch=None):
00525         """RE.neoschizomers([batch]) -> list.
00526 
00527         return a tuple of all the neoschizomers of RE.
00528         if batch is supplied it is used instead of the default AllEnzymes.
00529 
00530         neoschizomer <=> same site, different position of restriction."""
00531         if not batch : batch = AllEnzymes              
00532         r = [x for x in batch if self >> x]
00533         r.sort()
00534         return r

def Bio.Restriction.Restriction.AbstractCut.search (   cls,
  dna,
  linear = True 
) [inherited]
RE.search(dna, linear=True) -> list.

return a list of all the site of RE in dna. Compensate for circular
sequences and so on.

dna must be a Bio.Seq.Seq instance or a Bio.Seq.MutableSeq instance.

if linear is False, the restriction sites than span over the boundaries
will be included.

The positions are the first base of the 3' fragment,
i.e. the first base after the position the enzyme will cut. 

Definition at line 442 of file Restriction.py.

00442 
00443     def search(cls, dna, linear=True):
00444         """RE.search(dna, linear=True) -> list.
00445 
00446         return a list of all the site of RE in dna. Compensate for circular
00447         sequences and so on.
00448 
00449         dna must be a Bio.Seq.Seq instance or a Bio.Seq.MutableSeq instance.
00450         
00451         if linear is False, the restriction sites than span over the boundaries
00452         will be included.
00453 
00454         The positions are the first base of the 3' fragment,
00455         i.e. the first base after the position the enzyme will cut. """
00456         #
00457         #   Separating search from _search allow a (very limited) optimisation
00458         #   of the search when using a batch of restriction enzymes.
00459         #   in this case the DNA is tested once by the class which implements
00460         #   the batch instead of being tested by each enzyme single.
00461         #   see RestrictionBatch.search() for example.
00462         #
00463         if isinstance(dna, FormattedSeq):
00464             cls.dna = dna
00465             return cls._search()
00466         else :  
00467             cls.dna = FormattedSeq(dna, linear)
00468             return cls._search()

Here is the caller graph for this function:


Member Data Documentation

Definition at line 830 of file Restriction.py.


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