diff --git a/src/aminoacid.jl b/src/aminoacid.jl index 6781c42..c1d8c13 100644 --- a/src/aminoacid.jl +++ b/src/aminoacid.jl @@ -198,6 +198,11 @@ gap(::Type{AminoAcid}) = AA_Gap compatbits(aa::AminoAcid) Return the compatibility bits of `aa` as `UInt32`. +The resulting `UInt32` has one bit set per amino acid +it is compatible with. + +For example, `J` is compatible with `I` (bit 10) and `L` (bit 11), +and so is `0x00000600`. Examples -------- @@ -206,9 +211,17 @@ Examples julia> compatbits(AA_A) 0x00000001 +julia> compatbits(AA_E) +0x00000040 + julia> compatbits(AA_J) 0x00000600 +julia> compatbits(AA_X) +0x003fffff + +julia> compatbits(AA_Gap) +0x00000000 ``` """ compatbits(aa::AminoAcid) = @inbounds compatbits_aa[encoded_data(aa) + 1] diff --git a/src/nucleicacid.jl b/src/nucleicacid.jl index 7e2e423..c0b8cba 100644 --- a/src/nucleicacid.jl +++ b/src/nucleicacid.jl @@ -460,6 +460,11 @@ end compatbits(nt::NucleicAcid) Return the compatibility bits of `nt` as `UInt8`. +The resulting `UInt8` has the lower four bits set +if `nt` is compatible with `A`, `C`, `G` and `T/U`, respectively. + +Hence, `RNA_Gap` is `0x00` (not compatible with any nucleotide), +and `DNA_W` is `0x09` (compatible with `A` and `T`) Examples -------- @@ -474,6 +479,11 @@ julia> compatbits(DNA_C) julia> compatbits(DNA_N) 0x0f +julia> compatbits(DNA_W) +0x09 + +julia> compatbits(RNA_Gap) +0x00 ``` """ @inline function compatbits(nt::NucleicAcid)