<p>The <em>segregating sites</em> in parsimony are formally called <em>steps</em>. Any number of programs will do this but I don't really use R, particularly for phylogeny, You can of course simply look at the raw treefile, all the data is there (described in the last paragraph). If look at the options for <em>genetic distance</em>, in parsimony this will be an integer and again the technical name is <em>steps</em> and is the <em>segreating sites</em> you want.</p>
<p>Python's <code>ETE3</code> package will work (but you'd need to pipe it through Biopython), as well as specific standalone packages <code>Figtree</code>, the steps or 'genetic distance' on the branches on the branches option is in the check box. The heavy weight program for tracking step associated phylogeny using parsimony is <code>Mesquite</code> and its famous grandparent is called <code>MacClade</code>.</p>
<p>I suspect its a nomenclature thing, the options probably talk about <em>genetic distance</em> because few people do parsimony phylogeny now. Thats the option you want  and you will know because it will be &gt;&gt;1, whilst distance and model-based methods will be between 0 to 1. From a tree viewing it doesn't matter if the genetic distance is 0 to 1 or 1 and beyond because its all proportional. Its just an option thing you are missing. Thus if there is an option, e.g. to include <em>bootstrap support</em> on the tree, there'll be an option for <em>genetic distance</em>.</p>
<p>Just make sure you don't confuse the number of steps per branch with a consensus statistic, because there're completely different but might give similar looking outputs. Again its easily checked against the raw treefile because the &quot;steps&quot; will be immediately adajacent to the taxa name for the &quot;twigs&quot; (terminal branches) in the tree.</p>

CC BY-SA 4.0
2020-09-28T00:05:57.647Z
I went away for some days. You may be right, but now I'm having problems using both ETE and Mesquite. I will try some more and hopefully figure something out. Manuals and cookbooks look promising though.
AWE
CC BY-SA 4.0
2020-09-28T01:05:49.353Z
It is really easy to do what you want to do. ETE3 needs Biopython to import the tree. I could post code but you should be able to do this via R easily. As a last resort simply export your R tree and open it in Figtree and just click the option to 'view branch lengths'. I presume you want to automate the process so at a guess 'ape' will have the option. Mesquite is for identifying each individual alignment position that contributes to a given branch, my understanding is you just want number of sites not alignment positions.
M__
CC BY-SA 4.0
2020-09-29T10:06:00.557Z
Great. ETE had bugs, Mesquite did not like my xml format. Figtree smiled, patted me on my back, took my nexus file from R and showed me the branch length.
AWE
CC BY-SA 4.0
2020-09-29T15:27:17.337Z
Great! I am very happy for you! Congratulations to FigTree. ETE3 is just complicated, I like it because I'm use to it (as a Python coder I'm a bit protective). I do use ETE3 to print bootstraps, so it should just another option therein, but admittedly unless your performing a ''big data' operation its not worth it.
M__
CC BY-SA 4.0
2020-09-22T19:22:13.520Z
2020-09-23T18:14:12.397Z
2020-09-23T18:14:12.397Z
M__
<p>I'm trying to figure out how I would plot a tree with number of segregating sites on display on the branches</p>
<p>I'm using acctran from phangorn to plot a parsimony tree (using phydat object from fasta files)</p>
<p>I have been trying to use seg.sites from the ape package to somehow merge these objects together but there has to be some easy way to plot a tree with the information that it was made from</p>

CC BY-SA 4.0
2020-09-22T14:23:33.590Z
The question is fine. Are you fixed on using R or would you use external packages to do this analysis? Do you use Macs?
M__
CC BY-SA 4.0
2020-09-22T14:29:38.473Z
Fixed on Linux, checked out Beast but had problems installing. Semifixed on using R but open for suggestions (maybe py(thon)curious)
AWE
CC BY-SA 4.0
2020-09-22T14:32:40.423Z
Okay thanks ... really this is an R coding issue. Biopython is a whole new script.
M__
CC BY-SA 4.0
2020-09-22T14:38:15.130Z
In the end I will say "whatever works", but I feel like I'm looking for my glasses that are on my nose
AWE
<r><fasta><phylogenetics><linux>
Add segregating sites to branches of a tree
# Add segregating sites to branches of a tree

(Asked by: username_0 on 2020-09-22)

I'm trying to figure out how I would plot a tree with number of segregating sites on display on the branches

I'm using acctran from phangorn to plot a parsimony tree (using phydat object from fasta files)

I have been trying to use seg.sites from the ape package to somehow merge these objects together but there has to be some easy way to plot a tree with the information that it was made from

**Tags:** r, fasta, phylogenetics, linux
> **Comments:**
> **username_1**: The question is fine. Are you fixed on using R or would you use external packages to do this analysis? Do you use Macs?  
> **username_0**: Fixed on Linux, checked out Beast but had problems installing. Semifixed on using R but open for suggestions (maybe py(thon)curious)  
> **username_1**: Okay thanks ... really this is an R coding issue. Biopython is a whole new script.  
> **username_0**: In the end I will say "whatever works", but I feel like I'm looking for my glasses that are on my nose  

---

## 1 answers

### Answer by username_1 on 2020-09-22. Score: 1 | Accepted answer

The *segregating sites* in parsimony are formally called *steps*. Any number of programs will do this but I don't really use R, particularly for phylogeny, You can of course simply look at the raw treefile, all the data is there (described in the last paragraph). If look at the options for *genetic distance*, in parsimony this will be an integer and again the technical name is *steps* and is the *segreating sites* you want.

Python's `ETE3` package will work (but you'd need to pipe it through Biopython), as well as specific standalone packages `Figtree`, the steps or 'genetic distance' on the branches on the branches option is in the check box. The heavy weight program for tracking step associated phylogeny using parsimony is `Mesquite` and its famous grandparent is called `MacClade`.

I suspect its a nomenclature thing, the options probably talk about *genetic distance* because few people do parsimony phylogeny now. Thats the option you want and you will know because it will be >>1, whilst distance and model-based methods will be between 0 to 1. From a tree viewing it doesn't matter if the genetic distance is 0 to 1 or 1 and beyond because its all proportional. Its just an option thing you are missing. Thus if there is an option, e.g. to include *bootstrap support* on the tree, there'll be an option for *genetic distance*.

Just make sure you don't confuse the number of steps per branch with a consensus statistic, because there're completely different but might give similar looking outputs. Again its easily checked against the raw treefile because the "steps" will be immediately adajacent to the taxa name for the "twigs" (terminal branches) in the tree.

> **Comments:**
> **username_0**: I went away for some days. You may be right, but now I'm having problems using both ETE and Mesquite. I will try some more and hopefully figure something out. Manuals and cookbooks look promising though.  
> **username_1**: It is really easy to do what you want to do. ETE3 needs Biopython to import the tree. I could post code but you should be able to do this via R easily. As a last resort simply export your R tree and open it in Figtree and just click the option to 'view branch lengths'. I presume you want to automate the process so at a guess 'ape' will have the option. Mesquite is for identifying each individual alignment position that contributes to a given branch, my understanding is you just want number of sites not alignment positions.  
> **username_0**: Great. ETE had bugs, Mesquite did not like my xml format. Figtree smiled, patted me on my back, took my nexus file from R and showed me the branch length.  
> **username_1**: Great! I am very happy for you! Congratulations to FigTree. ETE3 is just complicated, I like it because I'm use to it (as a Python coder I'm a bit protective). I do use ETE3 to print bootstraps, so it should just another option therein, but admittedly unless your performing a ''big data' operation its not worth it.  

---

