Giter VIP home page Giter VIP logo

Comments (5)

dwinter avatar dwinter commented on September 25, 2024

Thanks for the bug report @bomeara, I'll leave it to @fmichonneau to work out what rncl should do. Just thought I'd let you know of a possible work-around, in case this is a rate-limiting step for you at the moment.

You can use the 'internal' api-mapping functions to get a character representation of the tree, and ape to read that tree (note, for the example at least I had to remove the spaces from taxon names):

tr <- rotl:::.get_study_tree(study_id="pg_710", 
                             tree_id="tree1277", 
                             tip_label='ot:otttaxonname',  #triple 't', double ''n"
                             format="newick")
parsed_tr <- ape::read.tree(text=gsub(" ", "_", tr)
parsed_tr
Phylogenetic tree with 108 tips and 107 internal nodes.

Tip labels:
    'Helianthus_annuus', 'Canarina_canariensis', 'Jasione_montana', 'Legousia_hybrida', 'Campanula_asperuloides', 'Campanula_latifolia', ...

Rooted; includes branch lengths

Hope that's some help to you, and that we can find a less hack way for this to work in the long run :)

from rotl.

bomeara avatar bomeara commented on September 25, 2024

Beautiful, @dwinter, thank you. This will work nicely for now (datelife update to pull from OpenTree).

Minor note for those using the example: there's a missing right parens on this line
parsed_tr <- ape::read.tree(text=gsub(" ", "_", tr))

Relevant XKCD

from rotl.

fmichonneau avatar fmichonneau commented on September 25, 2024

Thanks for bringing this up.

The issue is that NCL follows the strict definition of the NEXUS file format that doesn't allow duplicated taxon names. I don't think there is an easy way to fix this in the C++ code.

I think the best option would be to add a suffix, I'll try to implement this in a couple of weeks when I'm back home.

from rotl.

fmichonneau avatar fmichonneau commented on September 25, 2024

Hi @bomeara,

I implemented a fix for this. With get_study_tree duplicated labels will be disambiguated by adding a suffix _1, _2, _3, etc. before being parsed by NCL.

If you have a chance to give it a try, please let me know how it works for you.

from rotl.

bomeara avatar bomeara commented on September 25, 2024

Yes, this seems to work. Thanks!

from rotl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.