Beispiel #1
0
 def no_cutters(self, batch=CommOnly):
     """Returns the enzymes in a RestrictionBatch that do **not**
     cut the sequence."""
     ana = batch.search(self)
     ncut = {
         enz: sitelist
         for (enz, sitelist) in ana.items() if not sitelist
     }
     return _RestrictionBatch(ncut)
Beispiel #2
0
 def n_cutters(self, n=3, batch=CommOnly):
     """Returns the enzymes in a RestrictionBatch that cut the sequence
     n times."""
     ana = batch.search(self)
     ncut = {
         enz: sitelist
         for (enz, sitelist) in ana.items() if len(sitelist) == n
     }
     return _RestrictionBatch(ncut)
Beispiel #3
0
from Bio.Restriction import AllEnzymes as _AllEnzymes
from Bio.Restriction import RestrictionBatch as _RestrictionBatch
import logging   as _logging
import traceback as _traceback
_module_logger = _logging.getLogger("pydna."+__name__)


_text=""


try:
    with open( _os.environ["pydna_enzymes"], encoding="utf-8") as _f:
        _text = _f.read()
except FileNotFoundError:
    _module_logger.warning("%s not found.", _os.environ["pydna_enzymes"])
except IsADirectoryError:
    _module_logger.warning("%s is a directory.", _os.environ["pydna_enzymes"])
except IOError:
    _module_logger.warning("%s found, but could not be read.", _os.environ["pydna_enzymes"])
except Exception as e:
   _module_logger.warning(_traceback.format_exc())
    
myenzymes = _RestrictionBatch([e for e in _AllEnzymes if str(e).lower() in _text.lower()])

if __name__=="__main__":
    cache = _os.getenv("pydna_cache")
    _os.environ["pydna_cache"]="nocache"
    import doctest
    doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS)
    _os.environ["pydna_cache"]=cache