Skip to content

fitdiscrete error with new String7 from CSV #205

@crsl4

Description

@crsl4

If you read the trait data with CSV.read, it automatically makes the strings String7 type, which throws an error when running fitdiscrete:

julia> s1 = fitdiscrete(net1, :ERSM, species, df; optimizeQ=false)
ERROR: MethodError: no method matching fitdiscrete(::HybridNetwork, ::Symbol, ::Vector{String7}, ::DataFrame; optimizeQ::Bool)

Closest candidates are:
  fitdiscrete(::HybridNetwork, ::Symbol, ::Array{String}, ::DataFrame) got unsupported keyword argument "optimizeQ"
   @ PhyloNetworks ~/.julia/packages/PhyloNetworks/Upx5A/src/traitsLikDiscrete.jl:467
  fitdiscrete(::HybridNetwork, ::Symbol, ::Array{String}, ::DataFrame, ::Any; kwargs...)
   @ PhyloNetworks ~/.julia/packages/PhyloNetworks/Upx5A/src/traitsLikDiscrete.jl:467
  fitdiscrete(::HybridNetwork, ::PhyloNetworks.SubstitutionModel, ::RateVariationAcrossSites, ::DataFrame; kwargs...)
   @ PhyloNetworks ~/.julia/packages/PhyloNetworks/Upx5A/src/traitsLikDiscrete.jl:433
  ...

Stacktrace:
 [1] top-level scope
   @ REPL[69]:1

julia> typeof(species)
Vector{String7} (alias for Array{String7, 1})

In here, they provide a solution when reading the data frame (use stringtype=String), but they also suggest using AbstractString rather than String in the definition of the function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions