Normally, we do not allow implicit conversion of single argument constructors, but in this case we make an exception, because seqan3::rna5 and seqan3::dna5 are interchangeable as they behave nearly the same (e.g. same ranks, same char to rank conversion).
int main()
{
letter2 = 'C'_dna5;
}
The five letter RNA alphabet of A,C,G,U and the unknown character N..
Definition rna5.hpp:49
Provides seqan3::dna5, container aliases and string literals.
The SeqAn namespace for literals.
Provides seqan3::rna5, container aliases and string literals.
seqan3::sequence
s (e.g. seqan3::rna5_vector) in general are not implicitly convertible and must be explicitly copied to be converted:
int main()
{
seqan3::rna5_vector vector{'A'_dna5, 'C'_dna5, 'G'_dna5};
seqan3::dna5_vector dna5_vector = "ACGT"_dna5;
seqan3::rna5_vector rna5_vector{dna5_vector.begin(), dna5_vector.end()};
}
You can avoid this copy by using std::ranges::view
s:
int main()
{
seqan3::rna5_vector vector = "ACG"_rna5;
auto dna5_view = vector | seqan3::views::convert<seqan3::dna5>;
for (auto && chr: dna5_view)
{
static_assert(std::same_as<
decltype(chr),
seqan3::dna5 &&>);
}
}
The five letter DNA alphabet of A,C,G,T and the unknown character N..
Definition dna5.hpp:51
Provides seqan3::views::convert.
This conversion constructor only allows converting seqan3::dna5 to seqan3::rna5. Other alphabets that inherit from seqan3::dna5 will not be implicitly convertible to seqan3::rna5.