Skip to content

Instantly share code, notes, and snippets.

@mdshw5
Last active August 29, 2015 13:58
Show Gist options
  • Save mdshw5/10392986 to your computer and use it in GitHub Desktop.
Save mdshw5/10392986 to your computer and use it in GitHub Desktop.
biostars 97452
from json import dumps
fh = open("restriction_enzymes.txt", "r")
enzyme_sites = dict()
for line in fh:
seq, name = line.rstrip().split()
enzyme_sites[seq] = name
# here is a nice way to print our dictionary
print(dumps(enzyme_sites, indent=4))
DNA = random_DNA(6)
print(DNA)
print(enzyme_sites[DNA])
print(enzyme_sites['AACGTT'])
fh.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment