matsen / pplacer

Phylogenetic placement and downstream analysis
http://matsen.fredhutch.org/pplacer/
GNU General Public License v3.0
72 stars 17 forks source link

Uncaught exception: Simple_json.Undefined_key("n_cats") #376

Open yifeng-evo opened 1 year ago

yifeng-evo commented 1 year ago

Hello,

I built a refpkg with taxtastic, but when I run with pplacer -c refpkg alignments.sto, I saw an error message

Uncaught exception: Simple_json.Undefined_key("n_cats")
Fatal error: exception Simple_json.Undefined_key("n_cats")

Could you please let me know how I can solve this? Thank you!

maherrl commented 6 months ago

I also had this error. Any idea what is causing it?

hwells-biotia commented 2 weeks ago

Hi, I had the same error and just figured it out so I wanted to share in case more people find this issue. I think phyml made a slight change to their stats output which is not recognized by taxit when it parses your tree stats file. In your tree stats file from phyml, find this section:

. Discrete gamma model:         Yes
  - Number of classes:          4
  - Gamma shape parameter:      0.686

The problem is that "Number of classes" used to say "Number of categories". Change the word "classes" to "categories" in your stats file, re-run taxit, and try pplacer again. It should work.

Alternatively, if you don't wish to rerun taxit, you could also just manually edit the phylo_model{some_hash}.json file in the refpkg folder. In the section for the gamma parameter, add the n_cats variable manually (the default for phyml is 4):

    "gamma": {
        "n_cats": 4,
        "alpha": 0.686
    },

Hope this helps, Heather