Skip to content

Instantly share code, notes, and snippets.

@brantfaircloth
Created February 2, 2011 00:17
Show Gist options
  • Save brantfaircloth/807005 to your computer and use it in GitHub Desktop.
Save brantfaircloth/807005 to your computer and use it in GitHub Desktop.
Iterate over restriction enzymes, finding those with 3' overhang and no ambiguous cut sites
import pdb
from Bio import SeqIO
from Bio import Restriction
seq = SeqIO.read(open('araTha9/chr5.fas','rU'),'fasta')
for attr,value in Restriction.__dict__.iteritems():
if not attr.startswith('_'):
if attr not in ['Restriction', 'RestrictionBatch',
'Restriction_Dictionary', 'AllEnzymes', 'Analysis', 'CommOnly',
'NonComm','FormattedSeq', 'RanaConfig', 'PrintFormat']:
#pdb.set_trace()
# find out if it gives overhang
if value.is_3overhang():
if value.ovhg >= 3:
# find out how long it is
l = len(value.site)
# ensure seq. is only A,C,G,T - no monkey business
if set(value.site).issubset(set(['A','C','G','T'])):
sites = value.search(seq.seq)
print attr, l, len(sites), len(sites)/float(len(seq))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment