I calculate the pangenome for a set of bacterial genomes I am working with. I have a classical pangenome matrix that looks like this:
speciesA speciesB ... speciesZ gene1 1 2 0 gene2 0 1 0 gene3 1 1 1 gene4 1 1 2
Now I would like to map the gen gain and loss in a phylogenetic tree. Something like this:
I guess I could just record all families of genes shared among the different species in each branch of the tree, but I believe there is a more elegant way of doing that.