Learn R Programming

graph4lg

Overview

The goal of graph4lg is to make easier the construction and analysis of genetic and landscape graphs in landscape genetics studies (hence the name graph4lg). The package allows to weight the links and to prune the graphs by several ways. To our knowledge, it is the first software which enables to create genetic graphs with such a large variety of parameters. Besides, it allows to carry out preliminary analyses of the spatial pattern of genetic differentiation in order to choose the best genetic distance and pruning method in every context. Lastly, it makes possible the comparison of two spatial graphs sharing the same nodes.

Installation

You can install the released version of graph4lg from CRAN with:

install.packages("graph4lg")

Example

The package includes a tutorial with examples showing why and how to use each of the included functions. The package also includes data sets in order to test the functions.

More complete tutorials in English or French language are available for more details.

Copy Link

Version

Install

install.packages('graph4lg')

Monthly Downloads

516

Version

1.8.0

License

GPL-2

Maintainer

Paul Savary

Last Published

January 30th, 2023

Functions in graph4lg (1.8.0)

genind_to_structure

Convert a genind object into a STRUCTURE file
gen_graph_thr

Create a graph of genetic differentiation using a link weight threshold
gen_graph_topo

Create a graph of genetic differentiation with a specific topology
get_graphab

Download Graphab if not present on the user's machine
genind_to_genepop

Convert a genind object into a GENEPOP file
get_graphab_linkset_cost

Get cost values associated with a linkset in a Graphab project
genepop_to_genind

Convert a GENEPOP file into a genind object
get_graphab_linkset

Get linkset computed in the Graphab project
graph_modul_compar

Compare the partition into modules of two graphs
gini_coeff

Compute Gini coefficient from a numeric vector
graph_node_compar

Compare the local properties of the nodes from two graphs
graph_plan

Create a graph with a minimum planar graph topology
graph_to_df

Convert a graph into a edge list data.frame
graph_plot_compar

Visualize the topological differences between two spatial graphs on a map
get_graphab_raster_codes

Get unique raster codes from a Graphab project
get_graphab_metric

Get metrics computed at the node in the Graphab project
graph_topo_compar

Compute an index comparing graph topologies
graph_to_shp

Export a spatial graph to shapefile layers
dist_gc_vicenty

Calculate the Great-Circle distance between two points using the Vincenty inverse formula for ellipsoids (vicenty)
graphab_link

Create a link set in the Graphab project
gstud_to_genind

Convert a file from gstudio or popgraph into a genind object
graphab_capacity

Computes custom capacities of patches in the Graphab project
graphab_graph

Create a graph in the Graphab project
graphab_to_igraph

Create landscape graphs from Graphab link set
graphab_metric

Compute connectivity metrics from a graph in the Graphab project
graphab_corridor

Computes corridors from least-cost paths already computed in the Graphab project
graphab_modul

Create modules from a graph in the Graphab project
graphab_project_desc

Describe the objects of a Graphab project
loci_to_genind

Convert a loci object into a genind object
graphab_interpol

Creates a raster with interpolated connectivity metric values from metrics already computed in the Graphab project
graphab_project

Create a Graphab project
mat_pw_fst

Compute a pairwise FST matrix between populations
mat_geo_dist

Compute Euclidean geographic distances between points
graphab_pointset

Add a point set to the Graphab project
mat_pw_dps

Compute a pairwise genetic distance matrix between populations using Bowcock et al. (1994) formula
link_compar

Compare two link sets created in a Graphab project
mypalette

Vector of custom colors
pts_pop_simul

pts_pop_simul : details on simulated populations
reorder_mat

Reorder the rows and columns of a symmetric matrix
kernel_param

Compute dispersal kernel parameters
sample_raster

Sample points or patches on a categorical raster layer
harm_mean

Compute the harmonic mean of a numeric vector
scatter_dist

Plot scatterplots of genetic distance vs landscape distance
plot_w_hist

Plot histograms of link weights
pop_gen_index

Compute population-level genetic indices
mat_gen_dist

Compute a pairwise matrix of genetic distances between populations
mat_cost_dist

Compute cost distances between points on a raster
pop_rare_gen_index

Compute population-level rarefied genetic indices with ADZE software
sc01

Scaling function
pts_pop_ex

pts_pop_ex : details on simulated populations
plot_graph_lg

Plot graphs
scatter_dist_g

Plot scatterplots of distances to visualize the graph pruning intensity
structure_to_genind

Convert a file in STRUCTURE format into a genind object
patch_areas

Extract patch areas from a categorical raster
pw_mat_to_df

Convert a pairwise matrix into an edge-list data.frame
add_nodes_attr

Add attributes to the nodes of a graph
data_ex_genind

data_ex_genind genetic dataset
compute_node_metric

Compute graph-theoretic metrics from a graph at the node level
compute_graph_modul

Compute modules from a graph by maximising modularity
convert_cd

Fit a model to convert cost-distances into Euclidean distances
check_merge

Check whether the option 'nomerge' was used when building the landscape graph with Graphab
data_ex_loci

data_ex_loci genetic dataset
compar_r_fisher

Compare two correlation coefficients obtained from different sample sizes
data_ex_gstud

data_ex_gstud genetic dataset
data_simul_genind

data_simul_genind genetic dataset
dist_max_corr

Compute the distance at which the correlation between genetic distance and landscape distance is maximal
df_to_pw_mat

Convert an edge-list data.frame into a pairwise matrix
dist_great_circle

Compute the Great Circle distance between two points
dist_gc_slc

Calculate the Great-Circle distance between two points using the Spherical Law of Cosines (slc)
dist_gc_hvs

Calculate the Great-Circle distance between two points using the Harversine formula (hvs)
gen_graph_indep

Create an independence graph of genetic differentiation from genetic data of class genind
g_percol

Prune a graph using the 'percolation threshold' method
data_tuto

data_tuto : data used to generate the vignette
deg2rad

Convert degrees to radians