Skip to content

Remove convert for biosequences #321

Open

Description

@jakobnissen

IMO, convert should not exist for mutable types (i.e. types with object identity), because it can be called implicitly, which can lead to very weird stuff:

julia> x = dna"TAG";

julia> y = [bioseq("TAG")];

julia> push!(y, x);

julia> y[2] === x
false

Activity

  1. kescobo commented on Oct 23, 2024

    @kescobo
    Member

    I saw the slack gripe on this. Doesn't feel like a huge loss, especially if we put in constructors that can do the conversion for us (eg it would be nice to be able to "convert" RNA to DNA, but it could just be with a dna sequence constructor)

  2. jakobnissen commented on Oct 23, 2024

    @jakobnissen
    MemberAuthor

    Yep, the idea is to use the constructor instead. For immutable types (say, biosymbols) we can keep the conversion.

  3. Bano733-code commented on Nov 28, 2025

    @Bano733-code
    Contributor

    Instead of using the implicit convert method for mutable types like BioSequence, we could remove it to avoid confusion with object identity.
    A recommended approach is to use explicit constructors for conversion, e.g., DNASequence(rna_seq) or RNASequence(dna_seq).
    For immutable types like BioSymbols, keeping convert is fine since identity is not an issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions