Skip to content

Commit

Permalink
Fix bug in taxon that screws up with non Strings
Browse files Browse the repository at this point in the history
  • Loading branch information
kescobo committed Aug 18, 2023
1 parent 41e1c58 commit 3776dec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/features.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Taxon("Prevotella_copri", :species)
```
"""
function taxon(n::AbstractString)
n = String(n)
m = match(r"^([dkpcofgstu])__(.+)", n)
isnothing(m) && return Taxon(n)
return Taxon(string(m.captures[2]), _shortranks[Symbol(m.captures[1])])
Expand Down Expand Up @@ -249,4 +250,4 @@ retentiontime(m::Metabolite) = m.rt
@test ismissing(masscharge(m2))
@test ismissing(masscharge(m2))

end
end

0 comments on commit 3776dec

Please sign in to comment.