Skip to content

Repository files navigation

pantrop

Supplement to the manuscript:

Clément G, Lotfi N, Ong L, Campos-Arceiz A, Bretagnolle F, McConkey KR, Thomachot R, Mello MAR & Forget P-M. Biogeographic history and megafauna shape frugivory interaction networks across equatorial forests. In prep.

This work is derived from the M.Sc. dissertations of Guillaume Clément and Romain Thomachot, Master Biodiversité Écologie Évolution, Muséum National d’Histoire Naturelle, Paris, France. Both were supervised by Prof. Pierre-Michel Forget and co-supervised by Prof. Marco A. R. Mello.

MECADEV/ECOTROP & SintECO.

Contact: pierre-michel.forget@mnhn.fr{.email}, marmello@usp.br{.email} or nas.naslot@gmail.com{.email}.

Originally published on July 27th, 2026.

DOI

Run in R version 4.6.0 (2026-04-24) -- "Because it was There".

Disclaimer

Purpose

This is a code-only repository for the analyses presented in the aforementioned manuscript. It documents the complete computational workflow used to construct and analyse plant-frugivore interaction networks from the Guianas, Central Africa, and Malaysia.

The repository is intended to provide methodological transparency, enable code inspection and reuse, and support computational reproducibility for authorised users who have access to the original data.

Data and materials availability

The source data, M.Sc. dissertations, intermediate analytical results, and generated figures are not distributed in this public repository. They must not be inferred to be covered by the repository licence.

Consequently, this repository alone does not permit numerical reproduction of the study. Researchers with authorised access to the original data may reproduce the workflow by placing the required input files in a local Data/ directory, as described below.

Usage and modifications

The code is shared under the licence provided in LICENSE. Users may inspect, use, modify, and distribute the code according to that licence. Users are responsible for obtaining any necessary permissions to access and use the underlying data.

Support and maintenance

This repository is provided "as is," without a commitment to ongoing maintenance or support. Questions, corrections, and suggestions may be submitted through the GitHub issues tab or directed to the contacts above.

Third-party dependencies

The workflow relies on R and third-party packages. Users are responsible for installing compatible versions of these dependencies and for independently validating their results.

Ethical use

Users are expected to comply with all applicable ethical, legal, and data-use requirements, especially when handling non-public or proprietary data.

Citation

If you use or adapt this code in a software package, paper, book, chapter, monograph, dissertation, thesis, report, poster, talk, keynote, lecture, or similar work, please cite the original paper and the DOI of the archived repository release.

By using this repository, you acknowledge and accept the terms of this disclaimer.

Project workflow map

The diagram below summarises the relationships among the local input data, scripts, intermediate results, and figures. Directories shown as local are intentionally not distributed with the public code release.

flowchart LR
  D["Data/ private input data"] --> F["Code/functions.R"]
  F --> T["topology.R"]
  F --> DV["diversity.R"]
  T --> R["Results/ local objects and tables"]
  T --> PT["plots_topology.R"]
  PT --> G["Figures/ local plots and maps"]
  PT --> C["centrality.R"]
  D --> C
  C --> R
  C --> PC["plots_centrality.R"]
  PC --> G
  PC --> R
  R --> S["summary.R"]
  R --> RL["reload.R"]
Loading

Scope and reproducibility

The scripts implement the data processing and analyses used in the study, including network construction, diversity, modularity, nestedness, null-model tests, centrality, and figure generation. The code can be inspected without access to the data.

Exact numerical reproduction requires all of the following:

  1. authorised access to the original input data;

  2. the R version stated in the header of this file and compatible package versions;

  3. the same random seed and number of permutations used for the final analyses; and

  4. execution of the scripts in the order described below.

The null-model analyses are stochastic. Before running an inferential analysis, users should set and record a random seed and verify that the permutations value in topology.R matches the analysis to be reproduced. The current low value is suitable only for testing the workflow, not for final inference.

Computational requirements and expected run time

The three networks analysed in this study are unusually large for the ecological network literature. Their size, combined with the number of null-model analyses, can make a full reproduction of the results computationally demanding. Depending on the processor, available working memory (RAM), and free storage space, one or more analyses may take several days to complete.

Users should plan a full reproduction before starting. We recommend using a computer with sufficient processing capacity, RAM, and disk space; ensuring stable electrical power; and allowing a sufficiently long uninterrupted run. A stable internet connection is also advisable when packages or spatial resources still need to be installed or downloaded. Running a short test with a reduced number of permutations before launching the full analyses can help confirm that the local setup is working as expected. Finally, if institutional high-performance computing resources are available, consider adapting the workflow to use them.

Repository contents

Versioned files

Path Purpose
Code/functions.R User-defined functions for network construction, mapping, topology, centrality, and network visualisation.
topology.R Constructs the three networks and estimates modularity, nestedness, and their null models.
plots_topology.R Produces maps, topology plots, sorted interaction matrices, and network graphs. It also creates objects required by the centrality workflow.
diversity.R Calculates species richness and Whittaker beta diversity.
centrality.R Integrates traits with network metrics and produces centrality summaries.
plots_centrality.R Calculates C-Z functional roles and produces the centrality figure.
summary.R Produces tabular summaries of modularity and nestedness results.
reload.R Convenience script to reload locally generated .RData files.
pantrop.Rproj RStudio project file.
LICENSE Licence for the code.

Local directories not distributed with the code

Directory Purpose
Data/ Private input data. It must be supplied locally by authorised users.
Results/ Intermediate objects and numerical outputs generated locally by the scripts.
Figures/ Figures generated locally by the plotting scripts.
Theses/ Private background material that is not part of the public release.

Required local data

The scripts expect the following files in a local Data/ directory:

  • Africa.csv
  • guianas.txt
  • Guiana_frug.csv
  • Guiana_plant.csv
  • Malaysia_frug.csv
  • Malaysia_plant.csv

The file names, expected fields, and transformations are documented directly in topology.R, centrality.R, diversity.R, and Code/functions.R. Do not add these data files to a public clone of the repository.

Computational environment

The workflow was developed with R 4.6.0. The scripts load or install their required packages when run. The main dependencies include bipartite, igraph, tidyverse, here, sf, rnaturalearth, rnaturalearthdata, ggplot2, ggrepel, ggspatial, magick, cowplot, reshape2, purrr, and broom.

For long-term reproducibility, we recommend recording exact package versions with renv and distributing the resulting renv.lock file with future releases.

Workflow

Run the scripts from the project root, preferably in a fresh R session. Once authorised data are available locally, use the following order:

  1. Run topology.R to construct the Guianas, Central Africa, and Malaysia networks; calculate modularity and nestedness; and generate null-model results.

  2. Run plots_topology.R to generate topological figures, sorted matrices, and network graph objects.

  3. Run centrality.R to calculate plant and frugivore centrality metrics and associated summaries.

  4. Run plots_centrality.R to generate the functional-role plot.

  5. Run summary.R to create tabular summaries of the topology results.

  6. Run diversity.R to calculate richness and Whittaker beta diversity. This script independently reconstructs the three networks from the private input data and may be run separately.

reload.R is intended only for a local workflow in which the corresponding .RData files have already been generated. It is not required for a clean sequential execution of the scripts above.

Outputs

When input data are available, the scripts create local Results/ and Figures/ directories as needed. These outputs are intentionally excluded from the public code release. They should be retained locally, together with the exact R and package versions, seed, permutation settings, and run date, when producing a reproducible analytical record.

Feedback

If you have any questions, corrections, or suggestions, please feel free to open an issue or make a pull request.

Acknowledgments

We are deeply grateful to all colleagues who carried out field work in many tropical localities, making our synthesis possible.

Funding

CG was supported with a master's internship allowance during the Master program of the Sorbonne Université and the CNRS Research Unit MECADEV at the Muséum National d'Histoire Naturelle. MARM was supported by grants, fellowships, and scholarships given to him and his team by the Alexander von Humboldt Foundation (AvH, 1134644), São Paulo Research Foundation (FAPESP, 2023/03083-6, 2023/02881-6, and 2023/17728-9), National Council for Scientific and Technological Development (CNPq, 305204/2024-6), and Consulate General of France in São Paulo. We are also grateful to FAPESP, CNPq, Coordination for the Improvement of Higher Education Personnel (CAPES), and German Academic Exchange Service (DAAD) for the scholarships and fellowships granted to our students and postdocs. NL is grateful for an NIH grant (R01AG074226). ACA and LO thank the National Natural Science Foundation of China (W2433084), the Southeast Asia Biodiversity Research Institute, Chinese Academy of Sciences (SEABRI, CAS; Y4ZK111B01), the National Foreign Expert Projects (LO: Y20240050 and ACA: H20250434), the Yunnan Provincial Foreign Expert Project (ACA: 202505AO120035), the 14th Five-Year Plan of the Xishuangbanna Tropical Botanical Garden, Chinese Academy of Sciences (E3ZKFF7B), and Yayasan Sime Darby (grant M0005.54.04) for supporting this research in different stages. Permits to conduct the research were kindly granted by Perak’s State Forest Corporation. PMF was supported by the CNRS Research Unit MECADEV at the Muséum National d'Histoire Naturelle. This study is dedicated to the memory of Eugene (Geno) W. Schupp (1952-2026) who was a friend and a tireless supporter and colleagues of our studies on frugivores, seed dispersal, and animal-plant interaction network in the tropics.

Disclaimer of AI-use

ChatGPT Codex (OpenAI; Codex CLI version 0.146.0-alpha.3.1; AI model gpt-5.6-terra) was used to help standardise, optimise, clean, and improve the analytical workflows and associated code. Its assistance included code inspection, refactoring suggestions, workflow organisation, documentation, and implementation of human-directed revisions. ChatGPT Codex was not an author and did not make independent scientific, methodological, analytical, or publication decisions. All AI-assisted changes and outputs were inspected, validated, and, where appropriate, revised by human researchers. Human authors retained full responsibility for the study design, data governance, analytical choices, code, results, interpretations, citations, and final released materials.

About

Supplement to the manuscript Clement et al. (in prep.) designed to serve as a code-only repository for the analyses presented.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages