Count number of monophyletic groups within pylogeny
1
0
Entering edit mode
5.0 years ago
Chvatil ▴ 130

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 :)

phylogeny monophyletic • 1.5k views
ADD COMMENT
3
Entering edit mode
5.0 years ago
Joe 21k

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 COMMENT
1
Entering edit mode

Thank you ! it works like a charme :)

ADD REPLY

Login before adding your answer.

Traffic: 1852 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6