Add PatternCount function

This commit is contained in:
coolneng 2019-10-21 02:14:59 +02:00
parent d9b3d1f772
commit 51b9d935f4
2 changed files with 19 additions and 0 deletions

6
Code/Replication.py Normal file
View File

@ -0,0 +1,6 @@
def PatternCount(Text, Pattern):
count = 0
for i in range(len(Text)-len(Pattern)+1):
if Text[i:i+len(Pattern)] == Pattern:
count = count+1
return count

View File

@ -9,3 +9,16 @@
Locating an ori is key for gene therapy (e.g. viral vectors), to introduce a theraupetic gene.
**** Exercise: computational approach to find ori in bacteria
We'll look for the *DnaA box* sequence, using a sliding window, in that case our code would be the following:
#+begin_src python
count = 0
for i in range(len(Text)-len(Pattern)+1):
if Text[i:i+len(Pattern)] == Pattern:
count = count+1
print(Pattern + ": " + count)
#+end_src
*** Vocabulary
- k-mer: subsquences of length /k/ in a biological sequence