Learn R Programming

SEMgraph

Overview

SEMgraph Estimate causal relations in network or in complex systems with Structural Equation Modeling (SEM) using as input a directed graph that encodes the hypothesized or data-driven causal relationships among variables, a data matrix with n samples and p variables, and (optional) a binary group vector of experimental conditions for the n samples. SEMgraph comes with the following functionalities:

  • Interchangeable model representation as either an igraph object or the corresponding SEM in lavaan syntax. Model management functions include graph-to-SEM conversion, automated covariance matrix regularization, graph conversion to DAG (Directed Acyclic Graph), and tree (arborescence) from correlation matrices.
  • Heuristic filtering, node and edge weighting, resampling and parallelization settings for fast fitting in case of very large models.
  • Automated data-driven model building and improvement, through causal structure learning and bow-free interaction search and latent variable confounding adjustment.
  • Perturbed paths finding, community searching and sample scoring, together with graph plotting utilities, tracing model architecture modifications and perturbation (i.e., activation or repression) routes.

Installation

The latest stable version can be installed from CRAN:

install.packages("SEMgraph")

The latest development version can be installed from GitHub:

devtools::install_github("fernandoPalluzzi/SEMgraph")

Getting Started

The full list of SEMgraph functions with examples and a tutorial is available HERE.  

References

Grassi M, Palluzzi F, Tarantino B. SEMgraph: an R package for causal network inference of high-throughput data with structural equation models. Bioinformatics, 2022 Aug 30; 38(20):btac567. https://doi.org/10.1093/bioinformatics/btac567

Grassi M, Tarantino B. SEMgsa: topology-based pathway enrichment analysis with structural equation models. BMC Bioinformatics, 2022 Aug 17; 23(1):344. https://doi.org/10.1186/s12859-022-04884-8

Grassi M, Tarantino B. SEMtree: tree-based structure learning methods with structural equation models. Bioinformatics, 2023 June 09; 39(6):btad377. https://doi.org/10.1093/bioinformatics/btad377

Grassi M, Tarantino B. SEMbap: Bow-free covariance search and data de-correlation. PLoS Comput Biol, 2024 Sep 11; 20(9):e1012448. https://doi.org/10.1371/journal.pcbi.1012448

Grassi M, Tarantino B. SEMdag: Fast learning of Directed Acyclic Graphs via node or layer ordering. PLoS ONE. 2025 Jan 08; 20(1): e0317283. https://doi.org/10.1371/journal.pone.0317283

Copy Link

Version

Install

install.packages('SEMgraph')

Monthly Downloads

424

Version

1.2.4

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Barbara Tarantino

Last Published

December 17th, 2025

Functions in SEMgraph (1.2.4)

gplot

Graph plotting with renderGraph
ancestry

Node ancestry utilities
graph2dag

Convert directed graphs to directed acyclic graphs (DAGs)
cplot

Subgraph mapping
dagitty2graph

Graph conversion from dagitty to igraph
clusterGraph

Topological graph clustering
factor.analysis

Factor analysis for high dimensional data
lavaan2graph

lavaan model to graph
extractClusters

Cluster extraction utility
loadPathways

Import pathways and generate a reference network
localCI.test

Conditional Independence (CI) local tests of an acyclic graph
kegg

KEGG interactome
colorGraph

Vertex and edge graph coloring on the base of fitting
pairwiseMatrix

Pairwise plotting of multivariate data
kegg.pathways

KEGG pathways
clusterScore

Module scoring
mergeNodes

Graph nodes merging by a membership attribute
graph2dagitty

Graph conversion from igraph to dagitty
summary.RICF

RICF model summary
graph2lavaan

Graph to lavaan model
summary.GGM

GGM model summary
parameterEstimates

Parameter Estimates of a fitted SEM
pathFinder

Perturbed path search utility
properties

Graph properties summary and graph decomposition
weightGraph

Graph weighting methods
transformData

Transform data methods
sachs

Sachs multiparameter flow cytometry data and consensus model
modelSearch

Optimal model search strategies
orientEdges

Assign edge orientation of an undirected graph
resizeGraph

Interactome-assisted graph re-seizing
SEMdci

SEM-based differential network analysis
SEMpath

Search for directed or shortest paths between pairs of source-sink nodes
SEMace

Compute the Average Causal Effect (ACE) for a given source-sink pair
Shipley.test

Missing edge testing implied by a DAG with Shipley's basis-set
SEMtree

Tree-based structure learning methods
SEMrun

Fit a graph as a Structural Equation Model (SEM)
SEMdag

Estimate a DAG from an input (or empty) graph
SEMbap

Bow-free covariance search and data de-correlation
SEMgsa

SEM-based gene set analysis
alsData

Amyotrophic Lateral Sclerosis (ALS) dataset