Biostar Beta. Not for public use.
Question: Count number of monophyletic groups within pylogeny
0
Entering edit mode

Hello, I wondered if it whas possible within a newick tree to count the number of monophyletic groups even if intruders are splitting this group.

Here is an exemple

Let say you have the following three :

((A,A),((B,B),((A,A),A)))); here in that case A are species belonging to the Genus A for instance and B species from the Genus B.

And here if I use your package I should have a result that shows a monophyletic group for species B but not for species A because there is the two B species between them. But what I wanted to know if there were a way to count the number of groups where species A are grouped together, here a such result should be:

Number of groupes shared by A species = 2 Number of groupes shared by B species= 1 Is there any option in order to do that?

Thank you for your help :)

ADD COMMENTlink 10 months ago Darill • 30 • updated 10 months ago Joe 12k
3
Entering edit mode

Here's a fairly simple 'brute force' approach inspired by my previous answer here: Detect trees (newick) with specific topology

#!/bin/bash

for g in A B ; do
   count=$(grep -o "(\($g[,\)$g]*$g\))" $1 | tee /dev/tty | wc -l)
   echo "${g} monophyletic groups = $count"
done

Change A B in the loop declaration to suit.

This seems to work on your input data, as I get:

$ bash monophyly.sh monophyly.tree
(A,A)
(A,A),A)
A monophyletic groups = 2
(B,B)
B monophyletic groups = 1

If you dont want to see the matches themselves, but just the count, delete the tee /dev/tty/ | part.

I haven't tested it on anything more complicated (and this won't work (in it's current form) if you have node support values or branch lengths, but could be made to).

ADD COMMENTlink 10 months ago Joe 12k
Entering edit mode
1

Thank you ! it works like a charme :)

ADD REPLYlink 10 months ago
Darill
• 30

Login before adding your answer.

Similar Posts
Loading Similar Posts
Powered by the version 2.0