banner
Riceneeder

Riceneeder

卜得山火贲之变艮卦,象曰:装饰既成,宜静宜止。2025下半年,不宜躁进,宜守正持中,沉淀与反思,将为日后之再发打下基石。
github
email

Redundant sample point removal using ENMTools in biological adaptation zone prediction

Principle of Data Screening with ENMTools:

The ENMTools tool can automatically match the grid size of the environmental factors used in the analysis and can delete redundant data within the same grid, rather than removing data based on distance methods. This method is quick and efficient, and the analysis results are more reasonable; many English journals use this method. Through this method, points A or B in the figure below can be deleted (within the same grid), while points C and D, although they are within a shorter straight-line distance than the buffer zone, will not be deleted.

20230830-1

Quoting CSDN blogger "Bioinformatics Nest"
Original link: https://blog.csdn.net/weixin_40632177/article/details/111502337

There are quite few Chinese tutorials online for the ENMTools software or R package, most are English articles or videos by the original authors. If you directly use the ENMTools software, it is actually much more convenient, and teaching videos are also easy to find. However, tutorials for using R are scarce. The code I initially used was provided by a Bilibili user, but there were issues with installing the ENMTools package or errors during the running process. After consulting the original project documentation on GitHub and debugging, I finally modified the code as follows:

install.packages("devtools")
library(devtools)
install_github("danlwarren/ENMTools",force = TRUE) # May require a VPN
library(ENMTools)
library(terra)
worldclim <- raster('G:/4.其他/现在_bio_tif/bio_1.tif') # Here I used my own file
# worldclim <- raster::getData("worldclim", res = 5,var = "bio") # If you don't have your own, you can use the data provided by worldclim
pts <- read.csv(file = "BZ.csv")
pts.spat <- vect(pts,geom=c("X","Y")) # Replace XY with the corresponding Longitude, Latitude in your csv
pa <- rasterize(as.matrix(crds(pts.spat)), worldclim[[1]],fun=sum)
new.points <- rasterToPoints(pa)
write.csv(new.points, file = "BZ.trim.csv")

Using this code, I reduced 1164 points to 324, and there was no coordinate offset issue as seen when using the ENMTools software.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.