BioJulia/BioSequences.jl

findnext, findprev broken ... possible to add findall?

fpmenninger opened this issue ยท 4 comments

This template is rather extensive. Fill out all that you can, if are a new contributor or you're unsure about any section, leave it unchanged and a reviewer will help you ๐Ÿ˜„. This template is simply a tool to help everyone remember the BioJulia guidelines, if you feel anything in this template is not relevant, simply delete it.

Expected Behavior

julia> seq = dna"AGAGAGAGA"
9nt DNA Sequence:
AGAGAGAGA

julia> query = ExactSearchQuery(dna"AGA")
ExactSearchQuery{LongDNASeq}(AGA, 0x00000005, 2, 2)

julia> findnext(query, seq, 2)
3:5

julia> findprev(query, seq, 7)
5:7

julia> findall(query, seq)
2-element Vector{UnitRange{Int64}}:
1:3
5:7

julia> findall(query, seq, overlap=true)
4-element Vector{UnitRange{Int64}}:
1:3
3:5
5:7
7:9

Current Behavior

julia> findnext(query, seq, 1)
ERROR: MethodError: Cannot convert an object of type ExactSearchQuery{LongDNASeq} to an object of type DNA
Closest candidates are:
convert(::Type{T}, ::UInt8) where T<:NucleicAcid at E:\ProgramFiles\Julia.julia\packages\BioSymbols\O70zi\src\nucleicacid.jl:50
convert(::Type{S}, ::T) where {T<:Number, S<:NucleicAcid} at E:\ProgramFiles\Julia.julia\packages\BioSymbols\O70zi\src\nucleicacid.jl:53
convert(::Type{DNA}, ::Char) at E:\ProgramFiles\Julia.julia\packages\BioSymbols\O70zi\src\nucleicacid.jl:66
...
Stacktrace:
[1] findnext(val::ExactSearchQuery{LongDNASeq}, seq::LongDNASeq, start::Int64)
@ BioSequences E:\ProgramFiles\Julia.julia\packages\BioSequences\k4j4J\src\biosequence\find.jl:12
[2] top-level scope
@ REPL[20]:1

julia> findprev(query, seq, 8)
ERROR: MethodError: Cannot convert an object of type ExactSearchQuery{LongDNASeq} to an object of type DNA
Closest candidates are:
convert(::Type{T}, ::UInt8) where T<:NucleicAcid at E:\ProgramFiles\Julia.julia\packages\BioSymbols\O70zi\src\nucleicacid.jl:50
convert(::Type{S}, ::T) where {T<:Number, S<:NucleicAcid} at E:\ProgramFiles\Julia.julia\packages\BioSymbols\O70zi\src\nucleicacid.jl:53
convert(::Type{DNA}, ::Char) at E:\ProgramFiles\Julia.julia\packages\BioSymbols\O70zi\src\nucleicacid.jl:66
...
Stacktrace:
[1] findprev(val::ExactSearchQuery{LongDNASeq}, seq::LongDNASeq, start::Int64)
@ BioSequences E:\ProgramFiles\Julia.julia\packages\BioSequences\k4j4J\src\biosequence\find.jl:36
[2] top-level scope
@ REPL[21]:1

julia> findall(query, seq)
ERROR: MethodError: no method matching findall(::ExactSearchQuery{LongDNASeq}, ::LongDNASeq)
Closest candidates are:
findall(::Function, ::Any) at E:\ProgramFiles\Julia\Julia\share\julia\base\array.jl:2253
findall(::Any) at E:\ProgramFiles\Julia\Julia\share\julia\base\array.jl:2299
Stacktrace:
[1] top-level scope
@ REPL[42]:1

julia> findall(query, seq, overlap=true)
ERROR: MethodError: no method matching findall(::ExactSearchQuery{LongDNASeq}, ::LongDNASeq; overlap=true)
Closest candidates are:
findall(::Function, ::Any) at E:\ProgramFiles\Julia\Julia\share\julia\base\array.jl:2253 got unsupported keyword argument "overlap"
findall(::Any) at E:\ProgramFiles\Julia\Julia\share\julia\base\array.jl:2299 got unsupported keyword argument "overlap"
Stacktrace:
[1] top-level scope
@ REPL[22]:1

Possible Solution / Implementation

Steps to Reproduce (for bugs)

Context

Your Environment

  • Package Version used:

  • Julia Version used:
    -julia> versioninfo()
    Julia Version 1.7.1
    Commit ac5cc99908 (2021-12-22 19:35 UTC)

  • Operating System and version (desktop or mobile):

  • Platform Info:
    OS: Windows (x86_64-w64-mingw32)
    CPU: Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz
    WORD_SIZE: 64

  • Link to your project:

I have a feeling you are on a pre v3 version of BioSequences. This line ExactSearchQuery{LongDNASeq} in particular is odd, because LongDNASeq is not an alias used in the actual v3 release. Can you show us Pkg.status().

Julia v 1.7.1
add BioSequences
status: (@v1.7) pkg> status
[7e6ae17a] BioSequences v2.0.5

after a package update the status remains the same.

(@v1.7) pkg> st
      Status `~/.julia/environments/v1.7/Project.toml`
  [7e6ae17a] BioSequences v3.0.0

On a 1.7 install on my machine I can pkg add v3, is it possible you're working in a project or setup where the BioSequences version is being kept 2.x for some compatibility or dependency reason?

Thank you for the help.
I see the issue isn't with BioSequences.
Instead, I have to figure out why the package won't upgrade...
Ah. Found (and deleted) a folder in .julia/registries: BioJuliaRegistry
which had a readme stating
The BioJulia Registry has been depreceated and merged into the JuliaRegistries/General registry.
... later edit ...
a more likely cause
had PhyloPlots and PhyloNetworks installed - both required BioSequences 2.0.5 as of 09Jan2022