Skip to content

Commit

Permalink
change behavior of default_alphabet(q::Int)
Browse files Browse the repository at this point in the history
- if 2, binary
- if 3 or 4, nt without gaps
- if 5 nt with gaps
- if between 5 and 21, amino acids
- if > 21, errors
  • Loading branch information
PierreBarrat committed Oct 9, 2024
1 parent 22768ca commit 9a72641
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/alphabet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -245,18 +245,17 @@ end
"""
default_alphabet(q::Int, T::Type)
- if `q==21`, amino acids
- if `q==5`, nucleotides
- if `q==4`, nucleotides without gaps
- if `q==2`, binary (0, 1)
- else, if `q<21`, return the restriction of amino acids to the first q sites
- if `3 <= q <= 4`, nucleotides without gaps
- if `q==5`, nucleotides
- if `5 < q <= 21`, amino acids
- if `q>21`, fails
"""
function default_alphabet(q::Integer, ::Type{T}=Int) where T <: Integer
@assert q > 0 "`q` must be strictly positive - got $q"
return if q == 2
Alphabet(:binary, T)
elseif q == 4
elseif 3 <= q <= 4
Alphabet(_DEFAULT_NT_ALPHABET_STRING_NOGAP, T)
elseif q == 5
Alphabet(:dna, T)
Expand Down

0 comments on commit 9a72641

Please sign in to comment.