Skip to content

Conversation

@Bano733-code
Copy link
Contributor

This PR removes convert(::T, x) for mutable BioSequence types to prevent unintended implicit conversions that break object identity (===).
Users should now use explicit constructors, e.g., DNASequence(x).

Changes
Removed convert methods for mutable sequences
Updated tests to stop relying on implicit conversion
All tests pass (Pkg.test())

Checklist
Documentation updated (not required unless maintainers prefer)
Tests updated and passing
Added CHANGELOG entry (maintainers can do this)

Fixes #321

@codecov
Copy link

codecov bot commented Dec 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.67%. Comparing base (95d9218) to head (8a11ee7).
⚠️ Report is 26 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #344      +/-   ##
==========================================
+ Coverage   90.87%   91.67%   +0.80%     
==========================================
  Files          31       29       -2     
  Lines        2400     2823     +423     
==========================================
+ Hits         2181     2588     +407     
- Misses        219      235      +16     
Flag Coverage Δ
unittests 91.67% <ø> (+0.80%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Bano733-code
Copy link
Contributor Author

Hi maintainers,

The failing tests are expected because this PR removes convert(::T, x) for mutable BioSequence types.
Some downstream packages and older Julia versions rely on convert, so these tests fail.

All other tests pass, and coverage is not affected.
This PR should be reviewed with these downstream implications in mind.

Thanks!

@kescobo kescobo added v4 Scheduled for v3.X.X to v4. breaking labels Dec 5, 2025
Comment on lines 22 to 28
#Base.convert(::Type{T}, seq::T) where {T <: LongSequence} = seq
#Base.convert(::Type{T}, seq::T) where {T <: LongSequence{<:NucleicAcidAlphabet}} = seq

function Base.convert(::Type{T}, seq::LongSequence{<:NucleicAcidAlphabet}) where
{T<:LongSequence{<:NucleicAcidAlphabet}}
return T(seq)
end
#function Base.convert(::Type{T}, seq::LongSequence{<:NucleicAcidAlphabet}) where
# {T<:LongSequence{<:NucleicAcidAlphabet}}
# return T(seq)
#end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think things need to be commented out, they can just be removed. The diff shows what was there/

Comment on lines 278 to 283
@testset "Object identity" begin
x = dna"TAG"
y = LongDNA{4}[]
push!(y, x)
@test y[1] === x
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure we actually need this?

@Bano733-code
Copy link
Contributor Author

Bano733-code commented Dec 5, 2025 via email

@Bano733-code
Copy link
Contributor Author

Hi @kescobo

Thanks for the feedback!
I’ve pushed an update that:
removes the commented-out convert methods completely
removes the “Object identity” test, as suggested
Let me know if you'd like any additional cleanup or documentation updates!

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking v4 Scheduled for v3.X.X to v4.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove convert for biosequences

4 participants