The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

NicheBarcoding

This is a quick guide to getting started with the two main functions.

Installation

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")

Functions

This package provides three primary actions:

Usage

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.

Scenario 0

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,
               independence=TRUE,
               model="RF",variables="ALL",
               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,
                independence=TRUE,
                model="RF",variables="SELECT",
                en.vir=en.vir,bak.vir=bak.vir)
NBSI.out2

Scenario 1

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="RF",variables="SELECT",
                 en.vir=en.vir,bak.vir=bak.vir)
NBSI2.out

Scenario 2

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="RF",variables="ALL",
                  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.

Citing this package

To cite {NicheBarcoding}, use:

Yang, C. Q., X. H. Li, M. C. Orr, A. B. Zhang (2021). NicheBarcoding: An R package for species identification using DNA barcodes integrated with Environmental Niche Models. R package version 1.0. https://github.com/Yangcq-Ivy/NicheBarcoding

Acknowledgments

We thank reviewer ldecicco-USGS for comments on an early version of the package.

This work was was supported by China National Funds for Distinguished Young Scientists (to Zhang, Grant No. 31425023), by Natural Science Foundation of China (to Zhang, Grant No. 31071963 and 31272340), Program for Changjiang Scholars and Innovative Research Team in University (IRT13081), and Science and Technology Foundation Project (2012FY110803).

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.