https://github.com/biodivhealth/automaxent

https://github.com/biodivhealth/automaxent

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.6%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: BioDivHealth
  • License: mit
  • Language: HTML
  • Default Branch: main
  • Size: 3.12 MB
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created about 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme License

README.md

AutoMaxent

Rather than a formal package, AutoMaxent is a collection of functions that facilitate the general processing and generation of data for Species Distribution Modelling type analysis. Functions can be directly downloaded from this repository or loaded and stored in your R working environment folder using the following code:

```{r}

0. Load/install the needed packages

list.of.packages<-c("httr","tidyverse")

new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])] if(length(new.packages)) install.packages(new.packages)

lapply(list.of.packages,require,character.only=TRUE) # conflicts_prefer(dplyr::filter) rm(list.of.packages,new.packages)

1. Connect to the AutoMaxent GitHub repository

github <- "https://api.github.com/repos/BioDivHealth/AutoMaxent/git/trees/main?recursive=1" MaxRepo <- GET(github) # Extract the repo information MaxRepo

2. Get the route to the functions

filepath <- data.frame(unlist(lapply(content(MaxRepo)$tree, function(x) x$path))) colnames(filepath) = c('Path') head(file_path)

Extract routes

filepath <- filepath %>% separate(Path,c('folder','filename'),'/') %>% filter(folder == 'Functions') %>% filter(str_detect(filename,'.R'))

3. Configure the routes, download, and export scripts

raw_route <- "https://raw.githubusercontent.com/BioDivHealth/AutoMaxent/main" #This is the raw route to the gitHub repository MyRoute <- paste(getwd(),"AutoMaxent",sep="/") ; dir.create(MyRoute,recursive=T,showWarnings = F)

for(i in 1:nrow(filepath)){ writelines(content(GET(paste(rawroute,filepath$folder[i],filepath$filename[i],sep="/"))), paste(MyRoute,filepath$filename[i],sep="/")) }

4. Load the functions

functions <- MyRoute %>% list.files(recursive = FALSE,pattern = ".R$",full.names = TRUE) lapply(functions,function(x) source(x)) `` **IMPORTANT** - Please make sure to configure your working environment before you run this code. By default, this script will create anAutoMaxEntandSessionInfofolders within your working environment. You can check the location of your **R** working environment using thegetwd()function. To change the location of your working directory, you can use thesetwd()` function with your folder route as input.

AutoMaxent and its complementary functions use a combination of custom and specific packages and functions to run the analysis and data preparation. Due to this, it is important to install the right version of the packages. The list of needed packages, along with their version, can be found in the same GitHub repository. This list of functions and packages is likely to change in the future with further updates to the code.

```{r}

1. Configure the environment to run the AutoMaxent function ----

install.packages("remotes") ; install.packages("fs") library("remotes") library("fs")

a Get the route to the SessionInfo folder

file_route <- data.frame(unlist(lapply(content(MaxRepo)$tree, function(x) x$path))) MySession <- paste(getwd(),"SessionInfo",sep="/") ; MySession %>% dir.create()

b Download and export the information

writeBin(content(GET(paste(rawroute,"Sessioninfo/SessionInfo.rds",sep="/")),"raw"), paste(MySession,"SessionInfo.rds",sep="/"))

c Load the information and install the needed packages

Sinfo <- readRDS(MySession %>% list.files(".rds$",full.names = T))

Older package versions can conflict with newer or older versions. Therefore, we are going to set up a new package library to host the

new.lib <- "./SessionInfo/LibMaxEnt" ; new.lib %>% dir.create(showWarnings = FALSE,recursive = TRUE)

pathhomer(new.lib) # Set up the direction to the new library as the default (first load all the other packages)

d Install the packages

Packages <- Sinfo$otherPkgs Pack.nmes <- Sinfo$otherPkgs %>% names()

# Check if packages are already installed new.packages <- Pack.nmes[!(Pack.nmes %in% installed.packages(lib.loc = new.lib)[,"Package"])] if(length(new.packages)>0){ lapply(Packages[names(Packages) %in% new.packages], function(x) install_version(package = x$Package, version = x$Version, upgrade = "never", lib = new.lib))

}else{
  print("AutoMaxent dependencies already installed!")  
}

```

Some libraries related to the tydiverse like ggplot2 might fail to install since the code loads them before the installation. However, this should not interfere with the rest of the functions or code. Once the new library is configured, we can load the right package versions in the working environment before running the Auto_maxent function.

```{r}

a. Load the packages

pathhomer(new.lib) # MaxEnt library lapply(installed.packages()[,"Package"],require,lib.loc=new.lib,character.only=TRUE) # Load the packages

```

Owner

  • Name: Biodiversity and Health
  • Login: BioDivHealth
  • Kind: organization

GitHub Events

Total
  • Push event: 5
  • Create event: 2
Last Year
  • Push event: 5
  • Create event: 2