read.mtg: Read a MTG (Multiscale Tree Graph) file

View source: R/read.mtg.R

read.mtgR Documentation

Read a MTG (Multiscale Tree Graph) file

Description

Reads an MTG (Multiscale Tree Graph) file and returns an object of class foldermtg, that is a list of data frames (see Details).

Usage

read.mtg(file, ...)

Arguments

file

character. Path of the MTG file.

...

optional arguments to print methods.

Details

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.

Value

read.mtg returns an object, say x, of class fodermtg, that is a list of at least 6 data frames:

classes

the table CLASSES: in the MTG file.

description

the table DESCRIPTION: in the MTG file.

features

the table FEATURES: in the MTG file.

topology

data frame containing the first columns of the "MTG:" table of the MTG file. If the maximum branching order of the elements of the MTG is p, then x$topology has p columns.

If the i-th vertex appears on the j-th column, it means that its branching order is j, that is it belongs to a vertex of the j-th order.

coordinates

data frame of the spatial coordinates of the entities. It has six columns: XX, YY, ZZ (cartesian coordinates), AA, BB, CC (angle coordinates). If there are no coordinates in the MTG file, this data frame has 0 row.

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.

Author(s)

Rachid Boumaza, Pierre Santagostini, Smail Yousfi, Gilles Hunault, Sabine Demotes-Mainard

References

Pradal, C., Godin, C. and Cokelaer, T. (2023). MTG user guide

See Also

print.foldermtg

mtgorder

Examples

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)

dad documentation built on Aug. 30, 2023, 5:06 p.m.