-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrestriction_site.py
26 lines (24 loc) · 1.21 KB
/
restriction_site.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
def dna_revc(dna):
return dna.replace('A', 't').replace('T', 'a').replace('C', 'g').replace('G', 'c').upper()[::-1]
dna = '''ATATGTCTTTGTATCCACGACATACTCACACGCGCGAAACCGAATAGCAACCCTGTGAAG
GGCCCTACAGTAGAGGTGCAAAGTGTCTGGCTTCAATGTCGAGCCAACGCAGCCTTACCT
GACTGGTTACCATCTAGTCTGCCCGGGCTACAAGGGGAAGCATTCCATTTGAAAGTCACC
ATGGTGAGCTTCTTTTGCTGTGTGCTTACATCGAGACGGGTGAGAGGGCTTTCGCAGAGT
TGCCCTGACCAAGTCAGCCTGCCTTCGTCCGCAAAGGCAACGACGAAACGGATGGATTTC
ATTCTCCCTTGCCCGAATCTAACGGTACCAGGGGTGTGGCGGGAACCTTCAATAACCTGT
GCCTACAAGTGGTCTGATTTGCCAAAAAGGGTGGTACTCCTGGTCGGTCTCAGACCGGTC
TGCACGCGGTAAATGAGGGTAGGCAGTAAATTAAATATTCAATTAAAGTCGCGTGCTTCT
TCTCCTCGCACCATTTAGACCCACGACCGGTTGTCGTTTGCGTATATGTTTGCTTCCTGT
GGTCAGGGTGAAGCATCCATGCTTCGCGGATAAGGACACGATACGATGCCGAGATCGAAC
AGTCGTTGAATCAACGATCGTAAGACGGATCAAGCGGGTTCTGGAGGAAAATGTATTGAG
ACTTGTTTCCAGCTTTATGTCTTGTTACATTCGTTTCGGTAATTTGTACGCGTAGCTCAA
CGGACCCGTCCTCTATGATAGCAGAATGAGAGTCCTTACGTAGCCCTACTTATGCATAAG
TTAACGCAGGTGCAACGCGGGAGGCTCCCAGTGATAGTTTTCCCAGGCGCGC'''.split()
dna = ''.join(dna)
for n in range(0, len(dna)):
for i in range(2, 7):
if n + 2*i <= len(dna):
if dna_revc(dna[n:n+i]) == dna[n+i:n+2*i]:
print(n+1, 2*i)
else:
break