lczech / gappa

A toolkit for analyzing and visualizing phylogenetic (placement) data
GNU General Public License v3.0
56 stars 7 forks source link

Gappa graft ties #12

Closed andersgs closed 3 years ago

andersgs commented 4 years ago

Hi @lczech.

Thank you for gappa. Very very useful.

I have a query about grappa graft. In the docs, it says that it places according to the most likely position as encoded in the jplace file. But, what if there are ties? How are they resolved? Let us say the placement is equally likely (or nearly enough to be indistinguishable from the point of view of the precision of the placement encoded in the jplace file) at two or more locations. Would gappa just pick one position at random?

Thank you.

Anders.

lczech commented 4 years ago

Hi @andersgs,

that is a very good question! So, I just checked the code, and it seems that I implemented that in a way that in such cases, the first placement is used, as listed in the jplace file. That was just a quick check though. If you need that guaranteed, let me know and I'll check again. Is that relevant for you, or does random work as well, if you just know that it is random? If you tell me a bit more about your use case, maybe I can give you some more hints.

The jplace standard is basically just a json file, where the precision of floating point numbers can be cut of, after, say, 7 digits. So yes, your assessment is correct that is can happen. For example, imagine a reference tree with strains of a species (not recommended, but people seem to do that) that only differ in sites of the alignment that are not present in your query sequence at all (e.g., because the references span a wider region of the genome than your placed queries). Then, the likelihood weight ratio for the two branches of those strains would be exactly identical.

Cheers Lucas

lczech commented 3 years ago

Hi there, any news on this?

lczech commented 3 years ago

Hey @andersgs, this issue does not seem to be active any more. Closing it for now - feel free to re-open as needed!