The Python Oracle

Can Biopython perform Seq.find() accounting for ambiguity codes

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Dreaming in Puzzles

--

Chapters
00:00 Question
01:34 Accepted answer (Score 4)
02:14 Thank you

--

Full question
https://stackoverflow.com/questions/3219...

Accepted answer links:
http://biopython.org/DIST/docs/api/Bio.S...
[Search for motifs with degenerate positions]: https://stackoverflow.com/questions/1852...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #bioinformatics #biopython

#avk47



ACCEPTED ANSWER

Score 4


From what I can read from the documentation for Seq.find here:

http://biopython.org/DIST/docs/api/Bio.Seq.Seq-class.html#find

It appears that this method works similar to the str.find method in that it looks for exact match. So, while the dna sequence can contain ambiguity codes, the Seq.find() method will only return a match when the exact subsequence matches.

To do what you want maybe the ntsearch function will work:

Search for motifs with degenerate positions