Created
August 24, 2013 21:10
-
-
Save brantfaircloth/6330439 to your computer and use it in GitHub Desktop.
Restriction batches and BioPython
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# subset record # | |
test=seq[0:10000] | |
# take a look at the common restriction enzymes | |
Restriction.CommOnly | |
# do a restriction batch analysis on our test sequence with ALL common | |
# enzymes | |
Ana = Restriction.Analysis(Restriction.CommOnly, test.seq, linear=True) | |
# look that the enzymes that cut (BLUNT) the test sequence in more than # | |
# 10 spots | |
results = [] | |
for r in Ana.blunt(): | |
if len(Ana.blunt()[r]) > 10: | |
results.append([r, len(Ana.blunt()[r])]) | |
# sort by the 2nd element of the list | |
for r in sorted(results, key=lambda record: record[1]): | |
print r[0], r[1] | |
# or you can do this: | |
from operator import itemgetter | |
for r in sorted(results, key=itemgetter(1)): | |
print r[0], r[1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment