# வார்ப்புரு:Clade/doc/common

<includeonly>==Basic features==  

### Usage

<pre>  

</pre>  

produces  

<pre>  

</pre>  

produces  

<pre>  

</pre>  

produces  

Note that the order of the parameters does not matter. Exactly the same output is produced by  
<pre>  

</pre>  

<pre>  

</pre>  

produces  

To replace a solid line leading to the *N*th child with a dashed line, use <code>|stateN=dashed</code>.  
<pre>  

</pre>  

produces  

### Tips

An easy way of creating larger cladograms is to use the Newick format and proceed to edit it using a suitable text editor to produce the markup.  

1. Start with Newick format ((a,b),(c,d))
1. Replace "(" with
1. Replace ")" with
1. Edit to replace commas with pipes and numbers
1. Edit clade labels if needed

Alternatively, one can easily generate required clade code by downloading the free Windows utility, 'Claded', via link at http://code.google.com/p/claded, 'Claded' allowing editing of Cladograms using a tree control.  

<pre>  

</pre>  

Example Perl script to automate the conversion:  
<source lang="perl">  
use constant N=>"\n";  
use constant T=>"\t";  

my $tree='((a,b),(c,d));'; # get sequence  
$tree=~s/[\n\r]//g; # loose those spaces  
$tree=~ s/\:[\.\d]+//g; # loose those lengths  
while ($tree=~ m/\(/) {  
foreach my $clade ($tree=~ m/\(([^\(\)]+)\)/g) {  
my @branches=split /\,/,$clade;  
s/(\t+)/$1\t/g for @branches;  
die 'ERROR: degenerate/empty node!'.N if $#branches<1;  
$tree=~ s/\(\Q$clade\E\)/${\join(*,*)}/; # substitute  
}  
pos($tree)=0;  
}  
$tree=~s/(\t*)\t\}\}/$1\}\}/g; # lazy fix  

print $tree;  
</source>  

## Using a box

You can nest the templates and use links around the text. You may use non-breaking spaces (&amp;nbsp;) to obtain spaces or to have labels that have spaces.  

The entire cladogram can be placed in a box so that text flows nicely around it. You can use to produce the box.  

<pre>  

</pre>  

## Controlling the layout of sisters

When one sister is represented as a leaf node and the other as a labelled subclade, they do not appear to be at the same level. Consider this cladogram:  

Although *Banksia*&nbsp;subser.&nbsp;*Sphaerocarpae* and *Banksia*&nbsp;subser.&nbsp;*Leptophyllae* are sisters, their names are not aligned in the cladogram. If this is considered undesirable, one solution is to use a label in both cases, as shown hereafter, which now shows the sisters at the same level.  

Another 'trick' is to introduce a dummy clade. The dotted line hereafter shows where an extra clade has been inserted:  

To achieve this, instead of  
<pre>  

</pre>  
which displays as:  

use  
<pre>  

</pre>  
which displays as:  

## Limitations

### Label length
Labels produced by <code>|labelN=</code>, where <code>N</code> is 1, 2, ..., can lead to poor layout of the resulting cladogram. (This does not apply to the text of leaves, i.e. text produced by <code>|N=</code>.) To avoid problems:  
- Labels should be kept as short as possible, ideally a single word
- Any necessary spaces in labels should be represented as &amp;nbsp; not as actual spaces.
- Line breaks (i.e. ) should not be used.

### Browser differences

Cladograms are drawn by generating hidden tables. The horizontal and vertical lines making up the tree are actually the edges of table cells. The tables are then drawn by the browser or user agent using its internal algorithms. As these differ from browser to browser, the trees produced will not look the same on all browsers.  

In particular, , there are two algorithms for laying out tables with empty cells, used by two groups of browsers. Most browsers now use the algorithm that produces cladograms like the two on the in the diagram. Safari (under both MacOS and iOS) uses another algorithm, producing cladograms like the two on the in the diagram.  

No automated "fix" for these differences exists at present.  

If there is a choice over the ordering of the terminal nodes (leaves) of the tree, cladograms look best in a Safari-like browser if as much branching as possible is at the bottom of the cladogram. Typically this is produced by arranging the terminal nodes *downwards* on the page in order of their evolutionary divergence. Compare the bottom row of the diagram to the top row.  

### Large cladograms
There are limitations on the size and complexity of the cladograms which can be drawn:  
- A maximum of 17 children is allowed per node. It may seem that this could easily be increased by editing the template, but see the next point.
- Cladograms can only be expanded up to a certain level of complexity because the MediaWiki software limits the resources available for template expansion. The cladogram at APG III system#Phylogeny has had to be broken into three parts, because the entire cladogram exhausts the allowed resources (in this case the allowed expansion depth). *Any change to the template could result in large cladograms failing to display correctly.* In general, don't exceed a depth of 19, i.e. don't nest one template inside another more than 19 times.

### Inclusion in books
There are many known bugs in rendering tables in the software which produces ; see the [//meta.wikimedia.org/wiki/Book_tool/Feedback book tool feedback page]. these result in the lines in cladograms not displaying in books.</includeonly><noinclude>  

</noinclude>