Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What happened to DNAMer? #222

Closed
JokingHero opened this issue Mar 18, 2022 · 1 comment
Closed

What happened to DNAMer? #222

JokingHero opened this issue Mar 18, 2022 · 1 comment

Comments

@JokingHero
Copy link

I have been using DNAMer for trick like this:

function Base.convert(::Type{UInt64}, x::LongDNASeq)
    return BioSequences.encoded_data(DNAMer(x))
end

@inline function BioSequences.LongDNASeq(x::UInt64, len::Int)
    return LongDNASeq(DNAMer{len}(x))
end

I think with update to v3 it got removed. And I am not so sure how to achieve the same with the v3...
I was thinking the code below should work, but something is changed and I am unable to pinpoint the problem.

function Base.convert(::Type{UInt64}, x::LongDNA{4})
    x = LongDNA{2}(x)
    if (length(x.data) > 1) 
        throw("Sequence too long to save as UInt64.")
    end
    return UInt64(x.data[1])
end

@inline function BioSequences.LongDNA{4}(x::UInt64, len::Int)
    return LongDNA{4}(LongDNA{2}([x], UInt64(len)))
end

Can someone give advice?

@TransGirlCodes
Copy link
Member

Kmers are being revamped and redone in a new package - Kmers.jl, they will be based on NTuples and so allow for larger values of K than were previously possible. Your code in the second block looks sensible to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants