phylo_data {opm} | R Documentation |
Create entire character matrix (include header and footer) in a file format suitable for exporting phylogenetic data. Return it or write it to a file. This function can also produce HTML tables and text paragraphs suitable for displaying PM data in taxonomic journals such as IJSEM.
## S4 method for signature 'OPMD_Listing' phylo_data(object, html.args = html_args(), run.tidy = FALSE) ## S4 method for signature 'OPMS_Listing' phylo_data(object, html.args = html_args(), run.tidy = FALSE) ## S4 method for signature 'XOPMX' phylo_data(object, as.labels, subset = param_names("disc.name"), sep = " ", extract.args = list(), join = TRUE, discrete.args = list(range = TRUE, gap = TRUE), ...) ## S4 method for signature 'data.frame' phylo_data(object, as.labels = NULL, subset = "numeric", sep = " ", ...) ## S4 method for signature 'matrix' phylo_data(object, format = opm_opt("phylo.fmt"), outfile = "", enclose = TRUE, indent = 3L, paup.block = FALSE, delete = c("none", "uninf", "constant", "ambig"), join = FALSE, cutoff = 0, digits = opm_opt("digits"), comments = comment(object), html.args = html_args(), prefer.char = format == "html", run.tidy = FALSE, ...)
object |
Data frame, numeric matrix or
|
format |
Character scalar determining the output format, either epf (Extended PHYLIP Format), nexus, phylip, hennig or html. If NEXUS or ‘Hennig’ format is chosen, a
non-empty EPF or ‘extended PHYLIP’ is
sometimes called ‘relaxed PHYLIP’. The
main difference between EPF and
PHYLIP is that the former can use labels with
more than ten characters, but its labels must not contain
whitespace. (These adaptations are done automatically
with |
outfile |
Character scalar. If a non-empty character scalar, resulting lines are directly written to this file. Otherwise, they are returned. |
enclose |
Logical scalar. Shall labels be enclosed
in single quotes? Ignored unless |
indent |
Integer scalar. Indentation of commands in
NEXUS format. Ignored unless |
paup.block |
Logical scalar. Append a PAUP* block with selected (recommended) default values? Has no effect unless ‘nexus’ is selected as ‘format’. |
delete |
Character scalar with one of the following values:
|
join |
Logical scalar, vector or factor. Unless
|
cutoff |
Numeric scalar. If joining results in multiple-state characters, they can be filtered by removing all entries with a relative frequency less than ‘cutoff’. Makes not much sense for non-integer numeric data. |
digits |
Numeric scalar. Used for rounding, and thus
ignored unless |
comments |
Character vector. Comments to be added to the output (as title if HTML is chosen). Ignored if the output format does not allow for comments. If empty, a default comment is chosen. |
html.args |
List of arguments used to modify the
generated HTML. See |
prefer.char |
Logical scalar indicating whether or
not to use |
run.tidy |
Logical scalar. Filter the resulting
HTML through the Tidy program? Ignored unless
|
as.labels |
Vector of data-frame indexes or
|
sep |
Character scalar. See |
subset |
Character scalar. For the
|
extract.args |
Optional list of arguments passed to that method. |
discrete.args |
Optional list of arguments passed
from the |
... |
Optional arguments passed between the methods
(i.e., from the other methods to the matrix method) or to
|
Exporting PM data in such formats allows one to either infer trees from the data under the maximum-likelihood and/or the maximum-parsimony criterion, or to reconstruct the evolution of PM characters on given phylogenetic trees, or to nicely display the data in HTML format.
For exporting NEXUS format, the matrix should normally be
converted beforehand by applying discrete
.
Exporting HTML is optimised for data
discretised with gap
set to TRUE
. For other
data, the character.states
argument should be
modified, see html_args
. The hennig
(Hennig86) format is the one used by TNT; it
allows continuous characters to be analysed as such.
Regarding the meaning of ‘character’ as used here,
see the ‘Details’ section of
discrete
.
The generated HTML is guaranteed to produce
neither errors nor warnings if checked using the Tidy
program. It deliberately contains no formatting
instructions but a rich annotation with ‘class’
attributes which allows for CSS-based
formatting. This annotation includes the naming of all
sections and all kinds of textual content. Whether the
characters show differences between at least one organism
and the others is also indicated. For the CSS
files that come with the package, see the examples below
and opm_files
.
Character vector, each element representing a line in a
potential output file, returned invisibly if
outfile
is given.
Berger, S. A., Stamatakis, A. 2010 Accuracy of morphology-based phylogenetic fossil placement under maximum likelihood. 8th ACS/IEEE International Conference on Computer Systems and Applications (AICCSA-10). Hammamet, Tunisia [analysis of phenotypic data with RAxML].
Felsenstein, J. 2005 PHYLIP (Phylogeny Inference Package) version 3.6. Distributed by the author. Seattle: University of Washington, Department of Genome Sciences [the PHYLIP program].
Goloboff, P.A., Farris, J.S., Nixon, K.C. 2008 TNT, a free program for phylogenetic analysis. Cladistics 24, 774–786 [the TNT program].
Goloboff, P.A., Mattoni, C., Quinteros, S. 2005 Continuous characters analysed as such. Cladistics 22, 589–601.
Maddison, D. R., Swofford, D. L., Maddison, W. P. 1997 Nexus: An extensible file format for systematic information. Syst Biol 46, 590–621 [the NEXUS format].
Stamatakis, A. 2006 RAxML-VI-HPC: Maximum likelihood-based phylogenetic analyses with thousands of taxa and mixed models Bioinformatics 22, 2688–2690. [the RAxML program].
Swofford, D. L. 2002 PAUP*: Phylogenetic Analysis Using Parsimony (*and Other Methods), Version 4.0 b10. Sunderland, Mass.: Sinauer Associates [the PAUP* program].
http://ijs.sgmjournals.org/ [IJSEM journal]
http://tidy.sourceforge.net/ [HTML Tidy]
base::comment base::write hwriter::hwrite
Other phylogeny-functions: html_args
,
safe_labels
# simple helper functions
echo <- function(x) write(substr(x, 1, 250), file = "")
is_html <- function(x) is.character(x) &&
c("<html>", "<head>", "<body>", "</html>", "</head>", "</body>") %in% x
longer <- function(x, y) any(nchar(x) > nchar(y)) &&
!any(nchar(x) < nchar(y))
## examples with a dummy data set
x <- matrix(c(0:9, letters[1:22]), nrow = 2)
colnames(x) <- LETTERS[1:16]
rownames(x) <- c("Ahoernchen", "Behoernchen") # Chip and Dale in German
# EPF is a comparatively restricted format
echo(y.epf <- phylo_data(x, format = "epf"))
## 2 16
## Ahoernchen 02468ACEGIKMOQSU
## Behoernchen 13579BDFHJLNPRTV
stopifnot(is.character(y.epf), length(y.epf) == 3)
stopifnot(identical(y.epf, phylo_data(as.data.frame(x), subset = "factor",
format = "epf")))
# PHYLIP is even more restricted (shorter labels!)
echo(y.phylip <- phylo_data(x, format = "phylip"))
## 2 16
## Ahoernchen 02468ACEGIKMOQSU
## Behoernche 13579BDFHJLNPRTV
stopifnot((y.epf == y.phylip) == c(TRUE, FALSE, FALSE))
# NEXUS allows for more content; note the comment and the character labels
echo(y.nexus <- phylo_data(x, format = "nexus"))
## #NEXUS
##
## [
## Characters exported by opm version 1.3.63
## ]
##
## begin data;
## dimensions ntax = 2 nchar = 16;
## format datatype = standard missing = ?;
## format symbols = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
## charlabels 'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' 'P';
## matrix
## 'Ahoernchen' 02468ACEGIKMOQSU
## 'Behoernchen' 13579BDFHJLNPRTV
## ;
## end;
##
## begin assumptions;
## typeset * default = ord : all;
## end;
nexus.len.1 <- length(y.nexus)
stopifnot(is.character(y.nexus), nexus.len.1 > 10)
# adding a PAUP* block with (hopefully useful) default settings
echo(y.nexus <- phylo_data(x, format = "nexus", paup.block = TRUE))
## #NEXUS
##
## [
## Characters exported by opm version 1.3.63
## ]
##
## begin data;
## dimensions ntax = 2 nchar = 16;
## format datatype = standard missing = ?;
## format symbols = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
## charlabels 'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' 'P';
## matrix
## 'Ahoernchen' 02468ACEGIKMOQSU
## 'Behoernchen' 13579BDFHJLNPRTV
## ;
## end;
##
## begin assumptions;
## typeset * default = ord : all;
## end;
##
## begin paup;
## set torder=left tcompress taxlabels=full outroot=monophyl autoclose;
## set maxtrees=1000 increase=auto autoinc=1000 storetreewts storebrlens;
## set rootmethod=midpoint warnroot=no;
## defaults nj bionj breakties=random;
## defaults upgma bionj breakties=random;
## defaults hsearch start=stepwise addseq=random randomize=addseq swap=tbr;
## default hsearch multrees steepest=no;
## defaults bootstrap grpfreq=no;
## defaults contree grpfreq=no;
## defaults savedist triangle=both;
## defaults describetrees labelnode=no;
## dset negbrlen=setzero dcollapse missdist=ignore;
## pset opt=minf collapse=minbrlen mstaxa=uncertain;
## end;
stopifnot(is.character(y.nexus), length(y.nexus) > nexus.len.1)
# adding our own comment
comment(x) <- c("This is", "a test") # yields two lines
echo(y.nexus <- phylo_data(x, format = "nexus"))
## #NEXUS
##
## [
## This is
## a test
## ]
##
## begin data;
## dimensions ntax = 2 nchar = 16;
## format datatype = standard missing = ?;
## format symbols = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
## charlabels 'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' 'P';
## matrix
## 'Ahoernchen' 02468ACEGIKMOQSU
## 'Behoernchen' 13579BDFHJLNPRTV
## ;
## end;
##
## begin assumptions;
## typeset * default = ord : all;
## end;
stopifnot(identical(length(y.nexus), nexus.len.1 + 1L))
# Hennig86/TNT also includes the comment
echo(y.hennig <- phylo_data(x, format = "hennig"))
## Warning: TNT will not accept less than 4 organisms
## nstates 32;
## xread
## '
## This is
## a test
## '
## 16 2
## &[numeric]
## Ahoernchen 02468ACEGIKMOQSU
## Behoernchen 13579BDFHJLNPRTV
## ;
## ccode - .;
## procedure /;
hennig.len.1 <- length(y.hennig)
stopifnot(is.character(y.hennig), hennig.len.1 > 10)
# without an explicit comment, the default one will be used
comment(x) <- NULL
echo(y.hennig <- phylo_data(x, format = "hennig"))
## Warning: TNT will not accept less than 4 organisms
## nstates 32;
## xread
## '
## Characters exported by opm version 1.3.63
## '
## 16 2
## &[numeric]
## Ahoernchen 02468ACEGIKMOQSU
## Behoernchen 13579BDFHJLNPRTV
## ;
## ccode - .;
## procedure /;
stopifnot(identical(length(y.hennig), hennig.len.1 - 1L))
## examples with real data and HTML
# setting the CSS file that comes with opm as default
opm_opt(css.file = opm_files("css")[[1]])
# see discrete() for the conversion and note the OPMS example below: one
# could also get the results directly from OPMS objects
x <- extract(vaas_4[, , 1:10], as.labels = list("Species", "Strain"),
in.parens = FALSE)
x <- discrete(x, range = TRUE, gap = TRUE)
echo(y <- phylo_data(x, format = "html",
html.args = html_args(organisms.start = "Strains: ")))
## <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
## <html>
## <head>
## <title>Characters exported by opm version 1.3.63</title>
## <meta name="generator" content="opm version 1.3.63">
## <meta name="date" content="2016-04-14T14:04:37+0100">
## <!-- user-defined CSS file(s) -->
## <link rel="stylesheet" type="text/css" href="file:///usr/local/lib/R/library/opm/auxiliary/styles_1.css">
## </head>
## <body>
## <div class="headline" title="headline">Characters exported by opm version 1.3.63</div>
## <div class="table-legend" title="table-legend"><span class="organism-list-head" title="organism-list-head">Strains: </span> <span class="organism-index" title="organism-index">1</span>, <span class="organism-name" title="organism-name">Escherichia co
## <div class="table-legend" title="table-legend"><span class="character-state-list-head" title="character-state-list-head">Symbols: </span> <span class="state-1" title="state-1">-</span>, <span class="character-state-name" title="character-state-name">
## <div class="main-table">
## <table summary="character matrix" border="1">
## <tr>
## <td></td><td><span class="organism-index" title="organism-index">1</span></td><td><span class="organism-index" title="organism-index">2</span></td><td><span class="organism-index" title="organism-ind
## </div>
## </body>
## </html>
# this yields HTML with the usual tags, a table legend, and the table itself
# in a single line; the default 'organisms.start' could also be used
stopifnot(is_html(y))
# now with joining of the results per species (and changing the organism
# description accordingly)
x <- extract(vaas_4[, , 1:10], as.labels = list("Species"),
in.parens = FALSE)
## Warning in .local(object, ...): duplicated label: Escherichia coli
x <- discrete(x, range = TRUE, gap = TRUE)
echo(y <- phylo_data(x, format = "html", join = TRUE,
html.args = html_args(organisms.start = "Species: ")))
## <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
## <html>
## <head>
## <title>Characters exported by opm version 1.3.63</title>
## <meta name="generator" content="opm version 1.3.63">
## <meta name="date" content="2016-04-14T14:04:37+0100">
## <!-- user-defined CSS file(s) -->
## <link rel="stylesheet" type="text/css" href="file:///usr/local/lib/R/library/opm/auxiliary/styles_1.css">
## </head>
## <body>
## <div class="headline" title="headline">Characters exported by opm version 1.3.63</div>
## <div class="table-legend" title="table-legend"><span class="organism-list-head" title="organism-list-head">Species: </span> <span class="organism-index" title="organism-index">1</span>, <span class="organism-name" title="organism-name">Escherichia co
## <div class="table-legend" title="table-legend"><span class="character-state-list-head" title="character-state-list-head">Symbols: </span> <span class="state-1" title="state-1">-</span>, <span class="character-state-name" title="character-state-name">
## <div class="main-table">
## <table summary="character matrix" border="1">
## <tr>
## <td></td><td><span class="organism-index" title="organism-index">1</span></td><td><span class="organism-index" title="organism-index">2</span></td></tr>
## <tr>
## <td><div class="character-name" title="ch
## </div>
## </body>
## </html>
stopifnot(is_html(y))
# Here and in the following examples note the highlighting of the variable
# (uninformative or informative) characters. The uninformative ones are those
# that are not constant but show overlap regarding the sets of character
# states between all organisms. The informative ones are those that are fully
# distinct between all organisms.
# 'OPMS' method, yielding the same results than above but directly
echo(yy <- phylo_data(vaas_4[, , 1:10], as.labels = "Species",
format = "html", join = TRUE, extract.args = list(in.parens = FALSE),
html.args = html_args(organisms.start = "Species: ")))
## <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
## <html>
## <head>
## <title>Characters exported by opm version 1.3.63</title>
## <meta name="generator" content="opm version 1.3.63">
## <meta name="date" content="2016-04-14T14:04:37+0100">
## <!-- user-defined CSS file(s) -->
## <link rel="stylesheet" type="text/css" href="file:///usr/local/lib/R/library/opm/auxiliary/styles_1.css">
## </head>
## <body>
## <div class="headline" title="headline">Characters exported by opm version 1.3.63</div>
## <div class="table-legend" title="table-legend"><span class="organism-list-head" title="organism-list-head">Species: </span> <span class="organism-index" title="organism-index">1</span>, <span class="organism-name" title="organism-name">Escherichia co
## <div class="table-legend" title="table-legend"><span class="character-state-list-head" title="character-state-list-head">Symbols: </span> <span class="state-1" title="state-1">-</span>, <span class="character-state-name" title="character-state-name">
## <div class="main-table">
## <table summary="character matrix" border="1">
## <tr>
## <td></td><td><span class="organism-index" title="organism-index">1</span></td><td><span class="organism-index" title="organism-index">2</span></td></tr>
## <tr>
## <td><div class="character-name" title="ch
## </div>
## </body>
## </html>
# the timestamps might differ, but otherwise the result is as above
stopifnot(length(y) == length(yy) && length(which(y != yy)) < 2)
# appending user-defined sections
echo(yy <- phylo_data(vaas_4[, , 1:10], as.labels = "Species",
format = "html", join = TRUE, extract.args = list(in.parens = FALSE),
html.args = html_args(organisms.start = "Species: ",
append = list(section.1 = "additional text", section.2 = "more text"))))
## <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
## <html>
## <head>
## <title>Characters exported by opm version 1.3.63</title>
## <meta name="generator" content="opm version 1.3.63">
## <meta name="date" content="2016-04-14T14:04:37+0100">
## <!-- user-defined CSS file(s) -->
## <link rel="stylesheet" type="text/css" href="file:///usr/local/lib/R/library/opm/auxiliary/styles_1.css">
## </head>
## <body>
## <div class="headline" title="headline">Characters exported by opm version 1.3.63</div>
## <div class="table-legend" title="table-legend"><span class="organism-list-head" title="organism-list-head">Species: </span> <span class="organism-index" title="organism-index">1</span>, <span class="organism-name" title="organism-name">Escherichia co
## <div class="table-legend" title="table-legend"><span class="character-state-list-head" title="character-state-list-head">Symbols: </span> <span class="state-1" title="state-1">-</span>, <span class="character-state-name" title="character-state-name">
## <div class="main-table">
## <table summary="character matrix" border="1">
## <tr>
## <td></td><td><span class="organism-index" title="organism-index">1</span></td><td><span class="organism-index" title="organism-index">2</span></td></tr>
## <tr>
## <td><div class="character-name" title="ch
## </div>
## <!-- user-appended-sections -->
## <div class="user-appended-section" title="user-appended-section">
## <div class="section.1" title="section.1">
## additional text
## </div>
## <div class="section.2" title="section.2">
## more text
## </div>
## </div>
##
## </body>
## </html>
stopifnot(length(y) < length(yy), length(which(!y %in% yy)) < 2)
# note the position -- there are also 'prepend' and 'insert' arguments
# effect of deletion
echo(y <- phylo_data(x, "html", delete = "none", join = FALSE))
## <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
## <html>
## <head>
## <title>Characters exported by opm version 1.3.63</title>
## <meta name="generator" content="opm version 1.3.63">
## <meta name="date" content="2016-04-14T14:04:37+0100">
## <!-- user-defined CSS file(s) -->
## <link rel="stylesheet" type="text/css" href="file:///usr/local/lib/R/library/opm/auxiliary/styles_1.css">
## </head>
## <body>
## <div class="headline" title="headline">Characters exported by opm version 1.3.63</div>
## <div class="table-legend" title="table-legend"><span class="organism-list-head" title="organism-list-head">Organisms: </span> <span class="organism-index" title="organism-index">1</span>, <span class="organism-name" title="organism-name">Escherichia
## <div class="table-legend" title="table-legend"><span class="character-state-list-head" title="character-state-list-head">Symbols: </span> <span class="state-1" title="state-1">-</span>, <span class="character-state-name" title="character-state-name">
## <div class="main-table">
## <table summary="character matrix" border="1">
## <tr>
## <td></td><td><span class="organism-index" title="organism-index">1</span></td><td><span class="organism-index" title="organism-index">2</span></td><td><span class="organism-index" title="organism-ind
## </div>
## </body>
## </html>
echo(y.noambig <- phylo_data(x, "html", delete = "ambig", join = FALSE))
## <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
## <html>
## <head>
## <title>Characters exported by opm version 1.3.63</title>
## <meta name="generator" content="opm version 1.3.63">
## <meta name="date" content="2016-04-14T14:04:37+0100">
## <!-- user-defined CSS file(s) -->
## <link rel="stylesheet" type="text/css" href="file:///usr/local/lib/R/library/opm/auxiliary/styles_1.css">
## </head>
## <body>
## <div class="headline" title="headline">Characters exported by opm version 1.3.63</div>
## <div class="table-legend" title="table-legend"><span class="organism-list-head" title="organism-list-head">Organisms: </span> <span class="organism-index" title="organism-index">1</span>, <span class="organism-name" title="organism-name">Escherichia
## <div class="table-legend" title="table-legend"><span class="character-state-list-head" title="character-state-list-head">Symbols: </span> <span class="state-1" title="state-1">-</span>, <span class="character-state-name" title="character-state-name">
## <div class="main-table">
## <table summary="character matrix" border="1">
## <tr>
## <td></td><td><span class="organism-index" title="organism-index">1</span></td><td><span class="organism-index" title="organism-index">2</span></td><td><span class="organism-index" title="organism-ind
## </div>
## </body>
## </html>
stopifnot(length(which(y != y.noambig)) < 2) # timestamps might differ
# ambiguities are created only by joining
echo(y <- phylo_data(x, "html", delete = "none", join = TRUE))
## <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
## <html>
## <head>
## <title>Characters exported by opm version 1.3.63</title>
## <meta name="generator" content="opm version 1.3.63">
## <meta name="date" content="2016-04-14T14:04:37+0100">
## <!-- user-defined CSS file(s) -->
## <link rel="stylesheet" type="text/css" href="file:///usr/local/lib/R/library/opm/auxiliary/styles_1.css">
## </head>
## <body>
## <div class="headline" title="headline">Characters exported by opm version 1.3.63</div>
## <div class="table-legend" title="table-legend"><span class="organism-list-head" title="organism-list-head">Organisms: </span> <span class="organism-index" title="organism-index">1</span>, <span class="organism-name" title="organism-name">Escherichia
## <div class="table-legend" title="table-legend"><span class="character-state-list-head" title="character-state-list-head">Symbols: </span> <span class="state-1" title="state-1">-</span>, <span class="character-state-name" title="character-state-name">
## <div class="main-table">
## <table summary="character matrix" border="1">
## <tr>
## <td></td><td><span class="organism-index" title="organism-index">1</span></td><td><span class="organism-index" title="organism-index">2</span></td></tr>
## <tr>
## <td><div class="character-name" title="ch
## </div>
## </body>
## </html>
echo(y.noambig <- phylo_data(x, "html", delete = "ambig", join = TRUE))
## <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
## <html>
## <head>
## <title>Characters exported by opm version 1.3.63</title>
## <meta name="generator" content="opm version 1.3.63">
## <meta name="date" content="2016-04-14T14:04:37+0100">
## <!-- user-defined CSS file(s) -->
## <link rel="stylesheet" type="text/css" href="file:///usr/local/lib/R/library/opm/auxiliary/styles_1.css">
## </head>
## <body>
## <div class="headline" title="headline">Characters exported by opm version 1.3.63</div>
## <div class="table-legend" title="table-legend"><span class="organism-list-head" title="organism-list-head">Organisms: </span> <span class="organism-index" title="organism-index">1</span>, <span class="organism-name" title="organism-name">Escherichia
## <div class="table-legend" title="table-legend"><span class="character-state-list-head" title="character-state-list-head">Symbols: </span> <span class="state-1" title="state-1">-</span>, <span class="character-state-name" title="character-state-name">
## <div class="main-table">
## <table summary="character matrix" border="1">
## <tr>
## <td></td><td><span class="organism-index" title="organism-index">1</span></td><td><span class="organism-index" title="organism-index">2</span></td></tr>
## <tr>
## <td><div class="character-name" title="ch
## </div>
## </body>
## </html>
stopifnot(longer(y, y.noambig))
echo(y.nouninf <- phylo_data(x, "html", delete = "uninf", join = TRUE))
## <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
## <html>
## <head>
## <title>Characters exported by opm version 1.3.63</title>
## <meta name="generator" content="opm version 1.3.63">
## <meta name="date" content="2016-04-14T14:04:37+0100">
## <!-- user-defined CSS file(s) -->
## <link rel="stylesheet" type="text/css" href="file:///usr/local/lib/R/library/opm/auxiliary/styles_1.css">
## </head>
## <body>
## <div class="headline" title="headline">Characters exported by opm version 1.3.63</div>
## <div class="table-legend" title="table-legend"><span class="organism-list-head" title="organism-list-head">Organisms: </span> <span class="organism-index" title="organism-index">1</span>, <span class="organism-name" title="organism-name">Escherichia
## <div class="table-legend" title="table-legend"><span class="character-state-list-head" title="character-state-list-head">Symbols: </span> <span class="state-1" title="state-1">-</span>, <span class="character-state-name" title="character-state-name">
## <div class="main-table">
## <table summary="character matrix" border="1">
## <tr>
## <td></td><td><span class="organism-index" title="organism-index">1</span></td><td><span class="organism-index" title="organism-index">2</span></td></tr>
## <tr>
## <td><div class="character-name" title="ch
## </div>
## </body>
## </html>
stopifnot(longer(y, y.nouninf))
echo(y.noconst <- phylo_data(x, "html", delete = "const", join = TRUE))
## <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
## <html>
## <head>
## <title>Characters exported by opm version 1.3.63</title>
## <meta name="generator" content="opm version 1.3.63">
## <meta name="date" content="2016-04-14T14:04:37+0100">
## <!-- user-defined CSS file(s) -->
## <link rel="stylesheet" type="text/css" href="file:///usr/local/lib/R/library/opm/auxiliary/styles_1.css">
## </head>
## <body>
## <div class="headline" title="headline">Characters exported by opm version 1.3.63</div>
## <div class="table-legend" title="table-legend"><span class="organism-list-head" title="organism-list-head">Organisms: </span> <span class="organism-index" title="organism-index">1</span>, <span class="organism-name" title="organism-name">Escherichia
## <div class="table-legend" title="table-legend"><span class="character-state-list-head" title="character-state-list-head">Symbols: </span> <span class="state-1" title="state-1">-</span>, <span class="character-state-name" title="character-state-name">
## <div class="main-table">
## <table summary="character matrix" border="1">
## <tr>
## <td></td><td><span class="organism-index" title="organism-index">1</span></td><td><span class="organism-index" title="organism-index">2</span></td></tr>
## <tr>
## <td><div class="character-name" title="ch
## </div>
## </body>
## </html>
stopifnot(longer(y.noconst, y.nouninf))
# getting real numbers, not discretised ones
echo(yy <- phylo_data(vaas_4[, , 1:10], as.labels = "Species",
format = "html", join = TRUE, extract.args = list(in.parens = FALSE),
subset = "A", discrete.args = NULL,
html.args = html_args(organisms.start = "Species: ")))
## <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
## <html>
## <head>
## <title>Characters exported by opm version 1.3.63</title>
## <meta name="generator" content="opm version 1.3.63">
## <meta name="date" content="2016-04-14T14:04:37+0100">
## <!-- user-defined CSS file(s) -->
## <link rel="stylesheet" type="text/css" href="file:///usr/local/lib/R/library/opm/auxiliary/styles_1.css">
## </head>
## <body>
## <div class="headline" title="headline">Characters exported by opm version 1.3.63</div>
## <div class="table-legend" title="table-legend"><span class="organism-list-head" title="organism-list-head">Species: </span> <span class="organism-index" title="organism-index">1</span>, <span class="organism-name" title="organism-name">Escherichia co
## <div class="main-table">
## <table summary="character matrix" border="1">
## <tr>
## <td></td><td><span class="organism-index" title="organism-index">1</span></td><td><span class="organism-index" title="organism-index">2</span></td></tr>
## <tr>
## <td><div class="character-name" title="ch
## </div>
## </body>
## </html>
stopifnot(is_html(yy), length(yy) == length(y) - 1) # no symbols list
# the highlighting is also used here, based on the following heuristic:
# if mean+/-2*sd does not overlap, the character is informative; else
# if mean+/-sd does not overlap, the character is uninformative; otherwise
# it is constant
# this can also be used for formats other than HTML (but not all make sense)
echo(yy <- phylo_data(vaas_4[, , 1:10], as.labels = "Species",
format = "hennig", join = TRUE, extract.args = list(in.parens = FALSE),
subset = "A", discrete.args = NULL))
## Warning: TNT will not accept less than 4 organisms
## nstates cont;
## xread
## '
## Characters exported by opm version 1.3.63
## '
## 10 2
## &[continuous]
## Escherichia_coli 14.3184- 9.7684 35.1843-17.2980 29.5878-35.8790 28.9383-32.5378 17.0109-22.9759 27.9727-39.2608 17.3777-24.2689 14.2196-19.0965 14.9447-19.5719 64.3279- 0.9505
## Pseudomonas_aeruginosa 7.5970- 0.8327 10.1221- 1.3439 2.8619- 4.0473 6.8192- 0.3000 4.2421- 2.4183 3.8125- 4.3329 3.2008- 4.0699 3.4809- 3.1850 4.2189- 4.4522 60.8540- 0.0274
## ;
## ccode - .;
## procedure /;
stopifnot(is.character(yy), length(yy) > 10)
## 'OPMD_Listing' method
echo(x <- phylo_data(listing(vaas_1, NULL)))
## Positive for dextrin, D-maltose, D-trehalose, beta-gentiobiose, positive control, pH 6, pH 5, alpha-D-lactose, D-melibiose, beta-methyl-D-glucoside, N-acetyl-D-glucosamine, N-acetyl-beta-D-mannosamine, N-acetyl-D-galactosamine, N-acetyl-neuraminic ac
stopifnot(is.character(x), length(x) == 1)
echo(x <- phylo_data(listing(vaas_1, NULL, html = TRUE)))
## <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
## <html>
## <head>
## <title>Character listing exported by opm version 1.3.63</title>
## <meta name="generator" content="opm version 1.3.63">
## <meta name="date" content="2016-04-14T14:04:37+0100">
## <!-- user-defined CSS file(s) -->
## <link rel="stylesheet" type="text/css" href="file:///usr/local/lib/R/library/opm/auxiliary/styles_1.css">
## </head>
## <body>
## <div>Positive for dextrin, <small>D</small>-maltose, <small>D</small>-trehalose, β-gentiobiose, positive control, pH 6, pH 5, α-<small>D</small>-lactose, <small>D</small>-melibiose, β-methyl-<small>D</small>-glucoside, <i>N</i>-acetyl
## <div>Negative for negative control, <small>D</small>-arabitol, gelatin, <small>L</small>-histidine, <small>L</small>-pyroglutamic acid, pectin, glucuronamide, mucic acid, quinic acid, <small>D</small>-saccharic acid, <i>p</i>-hydroxy-phenylacetic aci
## <div>Ambiguous for <small>D</small>-cellobiose, sucrose, turanose, stachyose, <small>D</small>-raffinose, <small>D</small>-salicin, 3-<i>O</i>-methyl-<small>D</small>-glucose, <small>D</small>-fucose, myo-inositol, <small>D</small>-aspartic acid, <sm
## </body>
## </html>
stopifnot(is.character(x), length(x) > 1)
## 'OPMS_Listing' method
echo(x <- phylo_data(listing(vaas_4, as.groups = "Species")))
## Positive for positive control, pH 6, pH 5, 1% NaCl, 4% NaCl, 8% NaCl, 1% sodium lactate, fusidic acid, D-glucose-6-phosphate, D-fructose-6-phosphate, D-serine #1, troleandomycin, rifamycin SV, minocycline, gly-pro, L-alanine, L-aspartic acid, L-serin
## Positive for positive control, pH 6, pH 5, 1% NaCl, 4% NaCl, 8% NaCl, 1% sodium lactate, fusidic acid, troleandomycin, rifamycin SV, minocycline, gly-pro, L-alanine, L-arginine, L-aspartic acid, L-glutamic acid, L-histidine, L-pyroglutamic acid, linc
stopifnot(is.character(x), length(x) == 2, !is.null(names(x)))
echo(x <- phylo_data(listing(vaas_4, as.groups = "Species", html = TRUE)))
## <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
## <html>
## <head>
## <title>Character listings exported by opm version 1.3.63</title>
## <meta name="generator" content="opm version 1.3.63">
## <meta name="date" content="2016-04-14T14:04:37+0100">
## <!-- user-defined CSS file(s) -->
## <link rel="stylesheet" type="text/css" href="file:///usr/local/lib/R/library/opm/auxiliary/styles_1.css">
## </head>
## <body>
## <div class="headline" title="headline"><span class="organism-name" title="organism-name">Escherichia coli</span></div>
## <div>Positive for positive control, pH 6, pH 5, 1% NaCl, 4% NaCl, 8% NaCl, 1% sodium lactate, fusidic acid, <small>D</small>-glucose-6-phosphate, <small>D</small>-fructose-6-phosphate, <small>D</small>-serine #1, troleandomycin, rifamycin SV, minocyc
## <div class="headline" title="headline"><span class="organism-name" title="organism-name">Pseudomonas aeruginosa</span></div>
## <div>Positive for positive control, pH 6, pH 5, 1% NaCl, 4% NaCl, 8% NaCl, 1% sodium lactate, fusidic acid, troleandomycin, rifamycin SV, minocycline, gly-pro, <small>L</small>-alanine, <small>L</small>-arginine, <small>L</small>-aspartic acid, <smal
## </body>
## </html>
stopifnot(is.character(x), length(x) > 2, is.null(names(x)))