Conversation
|
Once the build has completed, you can preview your PR at this URL: https://biojulia.dev/BiojuliaDocs/previews/PR18/ |
| but since we want to find all matches, | ||
| we will use `findnext`. | ||
|
|
||
| Currently, there isn't a `findall` function that allows us to avoid a loop. |
There was a problem hiding this comment.
According to this documentation. https://biojulia.dev/BioSequences.jl/v2.0/sequence_search/#Exact-search-1
However, I'm eager to hear if I missed something!
There was a problem hiding this comment.
It's not documented there, but it works - you need to use ExactSearchQuery - https://github.com/BioJulia/BioSequences.jl/blob/b626dbcaad76217b248449e6aa2cc1650e95660c/src/BioSequences.jl#L261-L316
julia> findall(ExactSearchQuery(dna"ATCA"), dna"ATCATCA")
2-element Vector{UnitRange{Int64}}:
1:4
4:7
julia> findall(ExactSearchQuery(dna"ATCA"), dna"ATCATCA"; overlap=false)
1-element Vector{UnitRange{Int64}}:
1:4|
|
||
|
|
||
| ```julia | ||
| function haystack_findnext(substring, string) |
There was a problem hiding this comment.
This solution is very similar to the one above. However, I thought it was worth it to keep both solutions since it allows the reader to get introduced to the findnext function.
|
|
||
| ### Biojulia solution | ||
|
|
||
| Lastly, we can leverage some functions in the Kmers Biojulia package to help us! |
There was a problem hiding this comment.
Out of all the packages, I was wondering if the kmers package would potentially have a solution. However, I wasn't able to find a relevant function. Technically, the findnext function is part of BioSequences, so perhaps that is the "BioJulia solution." Please let me know if there's any other julia functions that could be helpful here!
BioJulia solution for the haystack problem https://rosalind.info/problems/subs/