I am trying to find a match of certain length (range 4 to 12) in a DNA sequence
Below is the code:
import re
positions =[]
for i in range(4,12):
for j in range(len(dna)- i+1):
positions.append(re.search(dna[j:j+i],comp_dna))
#Remove the 'None' from the search
position_hits = [x for x in positions if x is not None]
I get this:
[<_sre.SRE_Match object; span=(0, 4), match='ATGC'>,.........]
How do I extract the value from span and match? I have tried .group() but it throws out an error
AttributeError: 'list' object has no attribute 'group'