Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/PisaniMRPPrune.R
Prunes an MRP matrix of any redundant (duplicate or autapomorphic) characters following Pisani et al. (2002).
1 | PisaniMRPPrune(MRPMatrix)
|
MRPMatrix |
An MRP matrix in the format imported by |
Matrix representations must be handled carefully when taxa (rows) or characters (columns) are being pruned or duplicated, as they are by the Metatree function. Specifically, as noted by Pisani et al. (2002; their Figure 1) if a row gets pruned it will often create duplicate characters that, if unchecked, will inadvertently upweight some relationships incorrectly.
To illustrate this, consider the following scenario as proposed by Pisani et al. (2002). A matrix representation for a tree with six tips (labelled A-F) is encoded with four characters (nodes or bipartitions, labelled 1-4):
1 2 3 4 5 6 7 |
Then, following removal of taxon D (e.g., because taxonomic reconciliation suggests it is a nomen dubium) the matrix will now look like this:
1 2 3 4 5 6 | 1 2 3 4
A 0 0 0 0
B 0 0 0 1
C 0 0 1 1
E 1 1 1 1
F 1 1 1 1
|
We now see that characters 1 and 2 are identical, effectively upweighting this relationship in the matrix representation.
This can be countered by removing the offending character (column), to give us the fairer representation:
1 2 3 4 5 6 | 1 3 4
A 0 0 0
B 0 0 1
C 0 1 1
E 1 1 1
F 1 1 1
|
This function performs a check and correction for such duplicate characters, but also removes those that become autapomorphic in a similar way. For example, if we also removed taxon F:
1 2 3 4 5 | 1 3 4
A 0 0 0
B 0 0 1
C 0 1 1
E 1 1 1
|
Character 1 is now redundant, not because it is duplicated but because it carries no parsimony-informative information. NB: in practical terms this wouldn't effect the results, but removing characters like this can dramatically reduce data set size and hence minimise memory issues downstream. In this case, collapsing the data to just two characters:
1 2 3 4 5 | 3 4
A 0 0
B 0 1
C 1 1
E 1 1
|
Note that primarily this function is intended for internal use by Metatree, but may have some value to a user as a stand alone function.
A modified MRP matrix with redundant (duplicate or autapomorphic) characters removed.
Graeme T. Lloyd graemetlloyd@gmail.com
Pisani, D., Yates, A. M., Langer, M. C. and Benton, M. J., 2002. A genus-level supertree of the Dinosauria. Proceedings of the Royal Society of London B, 269, 915-921.
For another means by which MRP matrices require collapsing see CollapseDuplicateTaxonMRP.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Build the Pisani et al. (2002) example matrix:
PisaniExample <- Claddis::build_cladistic_matrix(matrix(as.character(c(0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)),
nrow = 6, dimnames = list(LETTERS[1:6], c()), byrow = TRUE))
# Confirm it matches the Pisani example by inspection:
PisaniExample$matrix_1$matrix
# Remove taxon D
PisaniExample <- Claddis::prune_cladistic_matrix(PisaniExample, taxa2prune = c("D"))
# Confirm that first two characters are redundant by inspection:
PisaniExample$matrix_1$matrix
# Apply pruning alogirhtm to data:
PisaniExample <- PisaniMRPPrune(PisaniExample)
# Confirm that first two characters are now merged by inspection:
PisaniExample$matrix_1$matrix
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.