OneZoom / tree-build

Scripts for assembling the tree, metadata and downstream data products such as popularity and popular images
MIT License
1 stars 2 forks source link

Extinct tree: use "undeveloped" or "fake" leaves for tips that represent large clades #100

Open hyanwong opened 2 weeks ago

hyanwong commented 2 weeks ago

In previous versions of OneZoom we had the concept of a "fake" leaf that represented a number of species, e.g. see the comment at

https://github.com/OneZoom/OZtree/blob/e32b3a76a6959460cf31d809143a9526a2d8f259/OZprivate/rawJS/OZTreeModule/src/themes/natural_theme.js#L53C12-L53C25

It looks like this sort of leaf was drawn when the node.richness_val was > 1, see

https://github.com/OneZoom/OZtree/blob/118bfba9b122d812386e438fb6d6b29cb51aed7e/OZprivate/rawJS/OZTreeModule/src/projection/layout/AT/leaf_layout.js#L32

It would be nice to reinstate this for the extinct tree, e.g. where the birds are all represented by a single tip. However, I'm not sure how in the new codebase we set a richness_val on a leaf without asking it to expand into all its children. Perhaps @jrosindell knows? I can't see anything in the db definition of the ordered_leaves table that stores the number of species represented by a leaf, but this code probably dates back to before we stored the leaf info in a database.

It could be that we need to introduce a new database field in the ordered_leaves table, to specify the number of tips. Alternatively, we could create a huge tree file by grafting the OneZoom tree onto the "fake" leaves in the extinct tree, but then flag up some nodes as "do not develop when zooming".

I would also suggest that we could possibly change the size of the circle, such that tips like "extant birds" are relatively large, whereas a single extinct genus is quite small / normal size. Note that as the comment above points out, there is a separate sort of "undeveloped" leaf that is shown while we are waiting for the javascript to expand the fractal.

davidebbo commented 2 weeks ago

When we build the extinct tree and we stop at higher level taxa, I don't think we can know how many leaves it would include if it were expanded. But maybe I'm misunderstanding?

hyanwong commented 1 week ago

If we created a newick / database with all the extant species in too (grafted in from the standard OneZoom tree, or the OpenTree), then we know the number of descendant species by looking at the leaf_rgt-leaf_lft in the database. Alternatively we can look up the OTT in the main OneZoom tree and find out how many extant species each tip represents. But if we include extinct species, we might not want to counts all tips equally, especially if some tips represent multiple species. See #101

jrosindell commented 1 week ago

A 'fake' leaf is a visual trick that only applies at a scale of a few pixels across. Without fake leaves the tree looks bare and empty in places where there is in fact tonnes of life hidden. I don't think fake leaves are the solution here.

I think we need to know in the DB for leaves and nodes which taxonomic level they apply to. Then we can tweak the rendering code either now (or at some point) to visually make clear that something is not a species. We already know from the DB what's extinct so this is more about what to do if we stop at genus level (or way above if we just want a leaf for all birds in the extant species tree).

davidebbo commented 1 week ago

I view an important distinction between:

hyanwong commented 1 week ago

Sorry about the "fake leaf" confusion. Did we have another name for the leaves-that-represent-many-species in OneZoom v1.0?

I don't think that the DB needs to know "taxonomic level" (is it a genus or a family, or a subfamily, or whatever): all it needs is the number of species under each leaf (which for the main OneZoom tree is hopefully "1" throughout). This does need an extra DB field, unless we simply add all the extant species into the extinct tree, but omit to expand e.g. the "bird" node.

Re extinct genera, I think you may find that there are a few exceptions, where one extinct genus has several known species (with different reconstructions / fossils). The most obvious one is Australopithecus, but I'm sure I can find a number of others.

davidebbo commented 1 week ago

Re extinct genera, I think you may find that there are a few exceptions, where one extinct genus has several known species (with different reconstructions / fossils). The most obvious one is Australopithecus, but I'm sure I can find a number of others.

Australopithecus is a case where not only there are several known species, but there is enough knowledge about them that they each have their own wikipedia page. As a result, in this case, my extinct tree does automatically go down to leaf level (though it's an oddball as they have Homo nested within that genus...).

On the other hand, I see many extinct genera that are either monospecific, or have multiple species all pointing to the same info. My point was that in such case, the genus feels like a good leaf for us.