Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix default gamma value error in command line interface #39

Merged
merged 5 commits into from
Feb 22, 2024
Merged

fix default gamma value error in command line interface #39

merged 5 commits into from
Feb 22, 2024

Conversation

mmolari
Copy link
Contributor

@mmolari mmolari commented Feb 20, 2024

Hi Pierre!
I was testing the new version of treetime and I got the following error. When calling:

treeknit examples/tree_h3n2_ha.nwk examples/tree_h3n2_na.nwk 

on the example data I got:

ERROR: LoadError: MethodError: no method matching var"#treeknit#162"(::String, ::Int64, ::String, ::Int64, ::Int64, ::Int64, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::typeof(TreeKnit.treeknit), ::String, ::String)
Closest candidates are:
  var"#treeknit#162"(::AbstractString, ::Float64, ::AbstractString, ::Int64, ::Int64, ::Int64, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::typeof(TreeKnit.treeknit), ::AbstractString, ::AbstractString, ::AbstractString...) at ~/Documents/code/TreeKnit.jl/src/cli.jl:36
Stacktrace:
 [1] treeknit(::String, ::String)
   @ TreeKnit ~/Documents/code/TreeKnit.jl/src/cli.jl:59
 [2] command_main(ARGS::Vector{String})
   @ TreeKnit ~/.julia/packages/Comonicon/AXDxW/src/codegen/julia.jl:343
 [3] command_main()
   @ TreeKnit ~/.julia/packages/Comonicon/AXDxW/src/codegen/julia.jl:90
 [4] top-level scope
   @ ~/.julia/bin/treeknit:15
in expression starting at /home/marco/.julia/bin/treeknit:15

This does not happen if I explicitly set --gamma 2 when I call treeknit.

After some investigation I think this is due to the change introduced in #38, where gamma became a float, but not in the default arguments.

The minimal change that I can make to fix the error is just to change the line:

γ::Real = 2

to

γ::Real = 2.

With this change now

treeknit examples/tree_h3n2_ha.nwk examples/tree_h3n2_na.nwk 

works.

I also changed the type of gamma to Float64 in OptArgs and set_up_optargs, but feel free to revert this if there is a reason to keep it to Real.

Hope this is helpful!

Marco

@PierreBarrat
Copy link
Owner

Hi Marco!
Thanks for spotting this issue and solving it! The change from Real to Float64 in OptArgs is what needed to be done.
This all comes from the fact that keyword arguments in the treeknit function have to have concrete types because of the cli and the Comonicon package.

Can you merge the latest commit on TreeKnit's master branch and see if all checks are successful?
Pierre

@PierreBarrat
Copy link
Owner

yay! merging

@PierreBarrat PierreBarrat merged commit b55ffa6 into PierreBarrat:master Feb 22, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants