An open API service indexing awesome lists of open source software.

https://github.com/vezy/xplorer

A package to manage MTG files (read, analyze...)
https://github.com/vezy/xplorer

fspm mtg plant structure

Last synced: 7 months ago
JSON representation

A package to manage MTG files (read, analyze...)

Awesome Lists containing this project

README

          

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# XploRer

[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![R build status](https://github.com/VEZY/XploRer/workflows/R-CMD-check/badge.svg)](https://github.com/VEZY/XploRer/actions)

The goal of XploRer is to read, write, analyze and plot MTG (Multi-scale Tree Graph) files. These files describe the plant topology (i.e. structure) along with some attributes for each node (e.g. geometry, colors, state...).

> The package is under intensive development and is in a very early version. The functions may heavily change from one version to another until a more stable version is released.

## Table of Contents

* [1. Installation](#1-installation)
* [2. Brief introduction](#2-brief-introduction)
* [2.1 Read a file](#21-read-a-file)
* [2.2 Mutate](#22-mutate)
* [2.3 Plot](#23-plot)
* [3. Help](#3-help)
* [4. Contribute](#4-contribute)
* [5. Code of Conduct](#5-code-of-conduct)
* [6. Roadmap](#6-roadmap)

## 1. Installation

You can install the release version of XploRer from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("VEZY/XploRer")
```
## 2. Brief introduction

A more in-depth introduction is available in the introductory vignette from the [getting started tab](https://vezy.github.io/XploRer/articles/XploRer.html).

Specialized articles from the Articles tab describe the functionality in details.

### 2.1 Read a file

Read a simple MTG file:

```{r}
library(XploRer)

MTG = read_mtg("https://raw.githubusercontent.com/VEZY/XploRer/master/inst/extdata/simple_plant.mtg")
```

### 2.2 Mutate

Mutate the MTG to add/recompute node attributes:

```{r}
MTG%>%
mutate_mtg(section_surface = pi * ((node$Width / 2)^2), .symbol = "Internode")%>%
mutate_mtg(s_surf_child_sum = sum(children(node$section_surface),na.rm=TRUE),
.symbol = "Internode")

print(MTG, ".symbol", "Width","section_surface", "s_surf_child_sum")
```

### 2.3 Plot

#### 2.3.1 Static plot

The plant topology can be plotted using the `autoplot()` function. This function is implemented by `ggplot2` so you'll need to load this package before-hand:

```{r}
library(ggplot2)
autoplot(MTG)
```

#### 2.3.2 Interactive plot

The same plot can be rendered as an interactive plot using:

```{r eval=FALSE}
plotly_mtg(MTG)
```

![Interactive plot](https://raw.githubusercontent.com/VEZY/XploRer/master/www/plotly_MTG.gif)

## 3. Help

Please see the [OpenAlea documentation](http://openalea.gforge.inria.fr/doc/vplants/newmtg/doc/_build/html/contents.html) (especially chapter 8) for more details on the MTG files.

If you have any other problem related to the package, please feel free to [fill an issue](https://github.com/VEZY/XploRer/issues) on Github.

## 4. Contribute

Contributions are more than welcome! Whatever your programming level really. If you need help on your first contribution, fill an issue about it.

If you find any issue, want to make a suggestion, or need a new functionality, please [fill an issue](https://github.com/VEZY/XploRer/issues). This is not more complicated than writing an email (but really simpler for us), just follow the steps one by one. Look into [this article](https://guides.github.com/features/issues/) for more info.

If you want to contribute, please read our [contribution guidelines](https://vezy.github.io/XploRer/CONTRIBUTING.html) first. It's a few minutes read only and guides you through the whole process of contributing (along with many useful tools).

## 5. Code of Conduct

Please note that the XploRer project is released with a [Contributor Code of Conduct](https://vezy.github.io/XploRer/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.

## 6. Roadmap

To do before v1:

- [x] Make mtg helpers (`parent()`, `children()` and `ancestors()`) use NSE format to homogenize with `mutate_mtg()`

- [x] Add a "Get started" vignette (add the basic info on what we can do with the package)

- [x] Update the readme to display only very basic information about the package, and about contributions (very welcome)

- [ ] Add a vignette about mutating the mtg

- [ ] Add a vignette about plotting the mtg (e.g. add attributes on hover)

- [ ] Check the mtg validity:

- [ ] add all checks on the mtg in `read_mtg()` using the sections
- [ ] Add a new argument to remove the checks
- [ ] Print the problems nicely using [cli](https://cli.r-lib.org/) and/or [waldo](https://waldo.r-lib.org/)

- [x] Return the mtg with class data.tree + mtg and remove the sections (not a list anymore). This will make the mtg more usable

- [ ] Read mtg from XLSX

- [x] Replace node name by .symbol name:

- [x] Use scale on actual scale, and add a new filter for symbol.

- [x] Put back the scene node

In a more distant future (v2):

- [ ] Add a vignette about the mtg format, and on the basics (navigate, get value...)

- [ ] Add 3d plotting when geometry attributes are available. Make it compatible with XPlo and OpenAlea.

- [ ] Add an opf (open plant format) parser -> opf to mtg

- [ ] Add an opf writer when the geometry is available (using reference meshes)