Skip to contents

Genetic data processing

data_processing_packages()
Install data processing packages
gen_to_geno()
Convert dosage matrix or vcf to geno type object (N.B.: this only works for diploids!)
geno_to_dosage()
Convert lfmm/geno matrix to dosage matrix (N.B.: this only works for diploids!)
ld_prune()
ld_prune prunes SNPs based on linkage disequilibrium using SNPRelate and SeqArray packages
simple_impute()
Impute NA values NOTE: use extreme caution when using this form of simplistic imputation. We mainly provide this code for creating test datasets and highly discourage its use in analyses.
str_impute()
Imputation of missing values using population structure inferred with LEA::snmf
vcf_to_dosage()
Convert a vcf to a dosage matrix

Environmental data processing

envirodata_packages()
Install environmental and geographic data processing packages
check_dists()
Check geographic and environmental distances for collinearity
check_env()
Check environmental layers for collinearity
check_vals()
Check extracted values for collinearity
env_dist()
Calculate distance between environmental vars
geo_dist()
Calculate geographic distance between coordinates
get_worldclim()
Download and merge WorldClim data for study area
rm_islands()
Remove islands from mapping

Masking

extrap_mask() range_mask() sd_mask() buffer_mask() chull_mask()
Create raster mask based on coordinates
plot_extrap_mask()
Plot mask on top of map
masking_packages()
Install masking packages

Genetic distances

gen_dist()
Calculate genetic distances
gen_dist_corr()
Plot the relationship between two distance metrics
gen_dist_hm()
Make heatmap of genetic distances
gen_dist_packages()
Install genetic distance packages

TESS

tess_barplot()
Create TESS barplot
tess_col_default()
Create default TESS color palette
tess_do_everything()
TESS function to do everything
tess_ggbarplot()
Create TESS barplot using ggplot2
tess_ggplot()
ggplot of TESS results
tess_krig()
Krige admixture values
tess_ktest()
Test multiple K values
tess_packages()
Install TESS packages
tess_plot_allK()
Plot all kriged Q values for each K
bestK()
Best K Selection based on cross entropy

MMRR

mmrr_df()
Make nice dataframe from MMRR results
mmrr_do_everything()
MMRR function to do everything
mmrr_packages()
Install MMRR packages
mmrr_plot()
Plot MMRR results
mmrr_run()
Run MMRR and return model object
mmrr_table()
Create gt table of MMRR results
mmrr_var_sel()
mmrr_var_sel performs MMRR with backward elimination variable selection
MMRR()
MMRR performs Multiple Matrix Regression with Randomization analysis
unfold()
unfold converts the lower diagonal elements of a matrix into a vector

GDM

gdm_coeffs()
Get coefficients for each predictor
gdm_df()
Create dataframe of GDM results
gdm_do_everything()
GDM function to do everything (fit model, get coefficients, make and save raster)
gdm_format()
Format Data for Generalized Dissimilarity Modeling (GDM)
gdm_map()
Make map from model
gdm_packages()
Install GDM packages
gdm_plot_diss()
Plot compositional dissimilarity spline plots
gdm_plot_isplines()
Plot I-splines for each variable
gdm_plot_vars()
Create a PCA plot for GDM
gdm_run()
Run GDM and return model object
gdm_table()
Create gt table of GDM results
gdm_var_sel()
Get best set of variables from a GDM model
gdm_varimp_table()
Generate a Variable Importance Table for GDM Models
scale01()
Scale genetic distances from 0 to 1
scaleRGB()
Scale three layers of environmental data to R, G, and B for mapping

RDA

rda_cor()
Genotype-environment correlation test
rda_do_everything()
RDA function to do everything
rda_getoutliers()
Get significant outliers from RDA model
rda_packages()
Install RDA packages
rda_plot()
Plot RDA results
rda_run()
Run RDA
rda_table()
Create gt table of RDA results
rda_varpart()
Partial RDA variance partitioning
rda_varpart_table()
Create gt table with RDA variance partitioning results

LFMM

lfmm_df()
Convert LFMM results into a tidy dataframe for downstream processing
lfmm_do_everything()
LFMM function to do everything
lfmm_manhattanplot()
LFMM Manhattan Plot
lfmm_packages()
Install LFMM packages
lfmm_qqplot()
LFMM QQplot
lfmm_run()
Run LFMM
lfmm_table()
Create gt table of LFMM results
select_K() select_K_tw() select_K_elbow() select_K_tess() select_K_fc()
K selection
quick_elbow()
Quickly choose an elbow for a PC

Wingen

wingen_do_everything()
wingen function to do everything (preview and generate moving window maps, krige, and mask)
wingen_packages()
Install wingen packages

Alazygatr

alazygatr_packages()
Install alazygatr packages
do_everything_for_me()
Lazy run of all landscape genomic analyses contained within algatr

Data

load_algatr_example()
Load example data
CA_env
Example environmental data, calculated by performing a raster PCA on 18 bioclimatic variables for state of California
liz_coords
Example coordinates from Bouzid et al. 2022
liz_gendist
Example genetic distance matrix, calculated with Plink using data from Bouzid et al. 2022
liz_vcf
Example VCF from Bouzid et al. 2022

Other

coords_to_sf()
Convert from matrix, data frame, or sf to sf (sf is a pass through)
coords_to_sp()
Convert from matrix, data frame, or sf to formatted sp