Add PatternCount function
This commit is contained in:
		
							parent
							
								
									d9b3d1f772
								
							
						
					
					
						commit
						51b9d935f4
					
				
							
								
								
									
										6
									
								
								Code/Replication.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Code/Replication.py
									
									
									
									
									
										Normal 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
 | 
			
		||||
							
								
								
									
										13
									
								
								Notebook.org
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								Notebook.org
									
									
									
									
									
								
							@ -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 
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user