This is a quick guide to getting started with the two main functions.
You can install the stable released version of {NicheBarcoding}
from
GitHub with:
# install.packages("devtools")
devtools::install_github("Yangcq-Ivy/NicheBarcoding")
or directly install from CRAN with:
install.packages("NicheBarcoding")
This package provides three primary actions:
NBSI
and NBSI2
functions execute the main identification
integrating both DNA barcoding and ecological niche modeling.extractSpeInfo
, niche.Model.Build
, pseudo.present.points
and pseudo.absent.points
functions are the extractable intermediate
steps of NBSI
and NBSI2
that execute information extraction,
niche modeling and pseudo points generation.monophyly.prop
, spe.mantel.test
and niche.PCA
functions
execute the analysis of the characteristics of reference or/and query
datasets, including the phylogenetic monophyletic proportion, the
correlation between interspecific pairwise genetic distance and
ecological distance, and the principal component analysis of ecological
niche between datasets.rm(list=ls())
library(NicheBarcoding)
Load the example bioclimatic layers first.
data(en.vir)
data(bak.vir)
or if you want to download the complete bioclimatic layers from online
worldclim
, run:
envir<-raster::getData("worldclim",download=FALSE,var="bio",res=2.5)
en.vir<-raster::brick(envir)
# Generate random background points
back<-dismo::randomPoints(mask=en.vir,n=5000,ext=NULL,extf=1.1,
excludep=TRUE,prob=FALSE,
cellnumbers=FALSE,tryf=3,warn=2,
lonlatCorrection=TRUE)
bak.vir<-raster::extract(en.vir,back)
Here, users can start running the main functions from three different scenarios below.
This is the typical situation for most users, where the users have DNA barcodes of species under study for both reference and query samples, with coordinates of species / samples recorded from their own collections.
#################################################################
### Scenario 0
### NBSI DNA barcodes + coordinates of species distribution
### available (using online climate data)
#################################################################
library(ape)
data(LappetMoths)
ref.seq<-LappetMoths$ref.seq
que.seq<-LappetMoths$que.seq
NBSI.out<-NBSI(ref.seq,que.seq,ref.add=NULL,
model="MAXENT",
en.vir=en.vir,bak.vir=bak.vir)
NBSI.out
In addition, the coordinates collected from GBIF
or published literature can also be included through the ref.add
parameter.
When you have an additional reference coordinates information, run:
ref.add<-LappetMoths$ref.add
NBSI.out2<-NBSI(ref.seq,que.seq,ref.add=ref.add,
model="MAXENT",
en.vir=en.vir,bak.vir=bak.vir)
NBSI.out2
In this case, users may already have species identified by another barcoding method.
They attempt to further confirm their identifications with niche models built by environmental data.
The function NBSI2
is especially designed for this purpose.
#################################################################
### Scenario 1
### NBSI2 species identified by other methods or barcodes +
### coordinates of species distribution available
### (for using online climatic data)
#################################################################
data(LappetMoths)
barcode.identi.result<-LappetMoths$barcode.identi.result
ref.infor<-LappetMoths$ref.infor
que.infor<-LappetMoths$que.infor
NBSI2.out<-NBSI2(ref.infor=ref.infor,que.infor=que.infor,
barcode.identi.result=barcode.identi.result,
model="MAXENT",
en.vir=en.vir,bak.vir=bak.vir)
NBSI2.out
Sometimes users may have species identified by other methods or barcodes alone, or their own environmental data collected by themselves (or alternative online sources).
Obviously, users no longer need to provide species distribution data (coordinates), or use the online environmental data in this case.
They should prepare two environmental datasets for both reference and query samples.
#################################################################
### Scenario 2
### NBSI2 species identified by other methods or barcodes +
### users possessing their own environmental data
#################################################################
data(LappetMoths)
barcode.identi.result<-LappetMoths$barcode.identi.result
ref.env<-LappetMoths$ref.env
que.env<-LappetMoths$que.env
NBSI2.out2<-NBSI2(ref.env=ref.env,que.env=que.env,
barcode.identi.result=barcode.identi.result,
model="MAXENT",
en.vir=en.vir,bak.vir=bak.vir)
NBSI2.out2
Complete examples can also be found in the help documentation of each functions.
Users can also read the manual to learn more.
To cite {NicheBarcoding}
, use:
Yang, C. Q., Y. Wang, X. H. Li, J. Li, B. Yang, M. C. Orr, A. B. Zhang (2024). Environmental Niche Models Improve Species Identification in DNA Barcoding. R package version 1.8. https://github.com/Yangcq-Ivy/NicheBarcoding
We thank reviewer ldecicco-USGS for comments on an early version of the package.
This research was supported by the Natural Science Foundation of China (32200343, 32170421), Beijing Municipal Natural Science Foundation (5232001), Chinese Academy of Sciences President’s International Fellowship Initiative program (2024PVC0046), Support Project of High-level Teachers in Beijing Municipal Universities in the Period of 14th Five–year Plan (BPHR20220114), National Key Research and Development Program of China (2023YFC2606600), and Academy for Multidisciplinary Studies, Capital Normal University.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.