# HG changeset patch # User ecology # Date 1730816256 0 # Node ID 8ca01a4cfd2753a75c496e35072d697004079a4b # Parent ebb36b7dbae6c7155d5128c0f3e57b2cea4f117a planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/obisindicators commit 13ac67c0a21d742b29e6273cdff058560abad770 diff -r ebb36b7dbae6 -r 8ca01a4cfd27 macro.xml --- a/macro.xml Tue Feb 14 15:33:15 2023 +0000 +++ b/macro.xml Tue Nov 05 14:17:36 2024 +0000 @@ -1,18 +1,21 @@ 0.0.2 + + obisindicators + r-base r-ggplot2 + - + - - + @Manual{, @@ -25,6 +28,11 @@ + + + DOI:10.5281/zenodo.6969395 + + topic_0610 diff -r ebb36b7dbae6 -r 8ca01a4cfd27 obisindicators.xml --- a/obisindicators.xml Tue Feb 14 15:33:15 2023 +0000 +++ b/obisindicators.xml Tue Nov 05 14:17:36 2024 +0000 @@ -40,7 +40,7 @@ ]]> - + @@ -132,5 +132,5 @@ - Multiple PNG files representing the indicators on a map (according to the choice of map made). ]]> - + diff -r ebb36b7dbae6 -r 8ca01a4cfd27 robis.r --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/robis.r Tue Nov 05 14:17:36 2024 +0000 @@ -0,0 +1,57 @@ +#Rscript + +########################################### +## Retrieve Obis occurences data ## +########################################### + +##### Packages : robis +# https://iobis.github.io/robis/articles/getting-started.html +# Get args +args <- commandArgs(trailingOnly = TRUE) + +if (length(args) < 1) { + stop("This tool needs at least 1 argument : longitude, latitude, species or taxonID") +}else { + sname <- args[1] + taxid <- args[2] + lat_min <- args[3] + lat_max <- args[4] + long_min <- args[5] + long_max <- args[6] +} + +if (lat_min == "0.0" & lat_max == "0.0" & long_min == "0.0" & long_max == "0.0") { +lat_min <- "" +lat_max <- "" +long_min <- "" +long_max <- "" +} + +##### Import data +# Get biological occurrences +if (lat_min != "" & sname != "" & taxid != "") { +my_occs <- robis::occurrence(scientificname = sname, taxonid = taxid, geometry = paste("POLYGON ((", long_min, lat_min, ", ", long_min, lat_max, ", ", long_max, lat_min, ", ", long_max, lat_max, ", ", long_min, lat_min, "))")) +}else if (lat_min != "" & sname != "" & taxid == "") { +my_occs <- robis::occurrence(scientificname = sname, geometry = paste("POLYGON ((", long_min, lat_min, ", ", long_min, lat_max, ", ", long_max, lat_min, ", ", long_max, lat_max, ", ", long_min, lat_min, "))")) +}else if (lat_min != "" & sname == "" & taxid != "") { +my_occs <- robis::occurrence(taxonid = taxid, geometry = paste("POLYGON ((", long_min, lat_min, ", ", long_min, lat_max, ", ", long_max, lat_min, ", ", long_max, lat_max, ", ", long_min, lat_min, "))")) +}else if (lat_min != "" & sname == "" & taxid == "") { +my_occs <- robis::occurrence(geometry = paste("POLYGON ((", long_min, lat_min, ", ", long_min, lat_max, ", ", long_max, lat_min, ", ", long_max, lat_max, ", ", long_min, lat_min, "))")) +}else if (lat_min == "" & sname != "" & taxid != "") { +my_occs <- robis::occurrence(scientificname = sname, taxonid = taxid) +}else if (lat_min == "" & sname == "" & taxid != "") { +my_occs <- robis::occurrence(taxonid = taxid) +}else if (lat_min == "" & sname != "" & taxid == "") { +my_occs <- robis::occurrence(scientificname = sname) +} + + +# Dispay results + +# If empty +if(length(my_occs) == 0) { +cat("\nNo occurrences found.\nLittle tip : Check your input typo, some databases are case sensitive : Genus species.\n") +} + + +write.table(file = "output.tab", my_occs, sep = "\t", dec = ".", na = "", row.names = FALSE, col.names = TRUE, quote = FALSE)