Let $tipfile
be a text file containing one or several leaf name(s) to discard from the phylogenetic tree contained in the NEWICK-formatted file $treefile
(with or without branch lengths and/or supports). The program gotree could be used to discard the specified leaf name(s) and write the resulting subtree into the NEWICK file $outtree
with the following command line:
Alternatively, a similar command line could be used to discard leaves that are absent from an other phylogenetic tree contained in the NEWICK-formatted file $alttree
:
The following command lines allow collapsing branch(es) of length lower than a specified value $cutoff
within the tree contained in the NEWICK-formatted file $treefile
and writes the resulting tree into the NEWICK file $outtree
.
The program gotree could be used to collapse short branch(es) with the following command line:
The following awk one-liner allows collapsing short branch(es):
The program gotree could be used to collapse the branch(es) with support lower than a specified value $cutoff
. The following command line allows collapsing such branch(es) within the tree contained in the NEWICK-formatted file $treefile
and writes the resulting tree into the NEWICK file $outtree
:
The following command lines allows discarding every branch length from the NEWICK-formatted tree file $treefile
. The resulting tree is written into the NEWICK file $outtree
.
The program gotree could be used with the following command line:
The following sed one-liner discards every branch length from the input tree file:
The following command lines allows discarding every branch support from the NEWICK-formatted tree file $treefile
. The resulting tree is written into the NEWICK file $outtree
.
The program gotree could be used with the following command line:
The following sed one-liner discards every branch support from the input tree file:
The following command lines allows discarding every branch length and support from the NEWICK-formatted tree file $treefile
. The resulting tree is written into the NEWICK file $outtree
.
The program gotree could be used with the following command line:
The following command line based on sed discards branch lengths and supports from the input tree file:
Let $mapfile
be a text file containing, for each line, a taxon name to be renamed by a new taxon name, both being separated by at least one blank space. The following command lines allows performing this renaming within the tree contained in the NEWICK-formatted file $treefile
. The resulting tree is written into the NEWICK file $outtree
.
The program gotree could be used with the following command line:
The following awk one-liner leads to the same result:
awk 'NR==FNR{m[$1]=$2;next} {t=t$0}
END{for(s in m){sub("\\("s",","(;"m[s]";,",t);sub(","s",",",;"m[s]";,",t);
sub("\\("s":","(;"m[s]";:",t);sub(","s":",",;"m[s]";:",t);
sub(","s")",",;"m[s]";)",t)} gsub(";","",t); print t";"}' $mapfile $treefile > $outtree
The following command lines allows multiplying by the factor $scale
every branch length of the tree contained in the NEWICK-formatted file $treefile
. The resulting tree is written into the NEWICK file $outtree
.
The program gotree could be used with the following command line:
The following awk one-liner rescales the branch lengths of a phylogenetic tree ($prec
is the number of decimal places):