The Python Oracle

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

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Secret Catacombs

--

Chapters
00:00 Can Biopython Perform Seq.Find() Accounting For Ambiguity Codes
01:10 Accepted Answer Score 4
01:40 Thank you

--

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

--

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