read.mtg | R Documentation |
Reads an MTG (Multiscale Tree Graph) file and returns an object of class foldermtg
, that is a list of data frames (see Details).
read.mtg(file, ...)
file |
character. Path of the MTG file. |
... |
optional arguments to |
Recalling that a MTG file is a text file that can be opened with a spreadsheet (Excel, LibreOffice-Calc...). Its 4 tables are:
CLASSES: In this table the first column, named SYMBOL
, contains the symbolic character denoting each botanical entity (or vertex class, plant component...) used in the MTG (for example, P for plant, A for axis...). The second column, named SCALE
, represents the scale at which each entity appears in the MTG (for example 1 for P, 2 for axis...).
DESCRIPTION: This table displays the relations between the vertices: +
(branching relationship) or <
(successor relationship).
FEATURES: This table contains the features that can be attached to the vertices and their types: INT
(integer), REAL
(real numbers), STRING
(character)...
MTG: This table describes the plant topology, that is the vertices (one vertex per row) and their relations, the spatial coordinates of each vertex and the values taken by each vertex on the above listed features.
Each vertex is labelled by its class, designating its botanical entity, and its index, designating its position among its immediate neighbours having the same scale. Each vertex label is preceded by +
or <
, seen above, or by the symbol /
(decomposition relationship) that means that the corresponding vertex is the first vertex of the decomposition of the vertex which precedes /
.
Notice that the column number of a vertex matches with its branching order. The vertices of scale k
resulting from the decomposition of a vertex of scale k-1
, named parent vertex, have the same order as that of the parent vertex.
See the example below.
read.mtg
returns an object, say x
, of class fodermtg
, that is a list of at least 6 data frames:
classes |
the table |
description |
the table |
features |
the table |
topology |
data frame containing the first columns of the If the |
coordinates |
data frame of the spatial coordinates of the entities. It has six columns: |
The sixth and following elements are nclass
data frames, nclass
being the number of classes in the MTG file. Each data frame matches with a vertex class, such as "P"
(plant), "A"
(axes), "M"
(metamers or phytomers), and contains the features on the corresponing vertices.
Rachid Boumaza, Pierre Santagostini, Smail Yousfi, Gilles Hunault, Sabine Demotes-Mainard
Pradal, C., Godin, C. and Cokelaer, T. (2023). MTG user guide
print.foldermtg
mtgorder
mtgfile1 <- system.file("extdata/plant1.mtg", package = "dad")
x1 <- read.mtg(mtgfile1)
print(x1)
mtgfile2 <- system.file("extdata/plant2.mtg", package = "dad")
x2 <- read.mtg(mtgfile2)
print(x2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.