# HG changeset patch # User ecology # Date 1747734728 0 # Node ID d19c3cbbdd7ed59af328ea8f755f17d16c0dc3b8 planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/Phylodiversity_workflow commit 0de557d919c26eb0b5ab61504bc597d551503ac3 diff -r 000000000000 -r d19c3cbbdd7e CRSconverter.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CRSconverter.R Tue May 20 09:52:08 2025 +0000 @@ -0,0 +1,84 @@ +#!/bin/Rscript +# GRID CREATION +args = commandArgs(trailingOnly=TRUE) + +library(sf) +library(tidyr) + + +save_as_pdf_fun <- function(){ + + pdf(file = "output.pdf") + plot(st_geometry(Transformed_spacial_coordinates)) + dev.off() +} + + +save_as_image_fun <- function(format){ + + filename <- paste0("output.", format) + # Ouvre le bon device graphique selon le format demandé + switch(format, + png = png(filename), + jpeg = jpeg(filename), + tiff = tiff(filename), + bmp = bmp(filename), + stop("Unsupported format: ", format) + ) + plot(st_geometry(Transformed_spacial_coordinates)) + dev.off() +} + + +save_as_shp_fun <- function(){ + write_sf(Transformed_spacial_coordinates, "output.shp") +} + + + + +if (length(args)<1){stop('please provide spacial coordinates files(.shp files)') +}else{ + Spacial_coordinates_files <- read_sf(as.character(args[1]), layer = 'shapefile') + output_file <- args[10] + + projection <- paste('+proj=' + , as.character(args[2]) + , ' +lat_0=' + , as.character(args[3]) + , ' +lon_0=' + , as.character(args[4]) + , ' +x_0=' + , as.character(args[5]) + , ' +y_0=' + , as.character(args[6]) + , ' +ellps=' + , as.character(args[7]) + , ' +datum=' + , as.character(args[7]) + , ' +units=' + , as.character(args[8]) + , ' +no_defs', sep = "", collapse = NULL) #presonalisation du systeme de références + + Transformed_spacial_coordinates <- st_transform(Spacial_coordinates_files, crs = projection) + + if (as.character(args[9]) == "pdf") { + save_as_pdf_fun() + + } else if (as.character(args[9]) == "shp") { + save_as_shp_fun() + + } else { + save_as_image_fun(as.character(args[9])) + } +} + + + + + + +#write.table(Transformed_spacial_coordinates, file = "output.tabular", sep="\t", row.names=FALSE) + #enregistrement dans quoi ? + +#this tool convert shp files to the right format for whatever you like ~a phylodiversity analysis diff -r 000000000000 -r d19c3cbbdd7e CRSconverter.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CRSconverter.xml Tue May 20 09:52:08 2025 +0000 @@ -0,0 +1,250 @@ + + from environmental predictors for species distribution modeling + + + 1.0 + 0 + + + + r-sf + r-tidyr + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + output_file_format != 'shp' + + + + + + + + + + + + output_file_format == 'shp' + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + +
+ + + + + + + +
+ + + + + + + +
+ + + +
+ + + + + + + +
+ + + + + + + +
+ + + +
+ + + + + + + +
+ + + + + + + +
+ + + +
+ + + + + + + +
+ + + + + + + +
+ + + +
+ + + + + + + +
+ + + + + + + +
+ + + +
+
+ + + + 10.32614/CRAN.package.sf + 10.32614/CRAN.package.tidyr + +
diff -r 000000000000 -r d19c3cbbdd7e test-data/composite_dataset/composite_dataset_shp.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/composite_dataset/composite_dataset_shp.html Tue May 20 09:52:08 2025 +0000 @@ -0,0 +1,17 @@ +Shapefile Galaxy Composite Dataset

+

This composite dataset is composed of the following files:

diff -r 000000000000 -r d19c3cbbdd7e test-data/composite_dataset/shapefile.dbf Binary file test-data/composite_dataset/shapefile.dbf has changed diff -r 000000000000 -r d19c3cbbdd7e test-data/composite_dataset/shapefile.prj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/composite_dataset/shapefile.prj Tue May 20 09:52:08 2025 +0000 @@ -0,0 +1,1 @@ +PROJCS["WGS_1984_Antarctic_Polar_Stereographic",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Stereographic_South_Pole"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",-71.0],UNIT["Meter",1.0]] diff -r 000000000000 -r d19c3cbbdd7e test-data/composite_dataset/shapefile.shp Binary file test-data/composite_dataset/shapefile.shp has changed diff -r 000000000000 -r d19c3cbbdd7e test-data/composite_dataset/shapefile.shx Binary file test-data/composite_dataset/shapefile.shx has changed diff -r 000000000000 -r d19c3cbbdd7e test-data/output.bmp Binary file test-data/output.bmp has changed diff -r 000000000000 -r d19c3cbbdd7e test-data/output.jpeg Binary file test-data/output.jpeg has changed diff -r 000000000000 -r d19c3cbbdd7e test-data/output.pdf Binary file test-data/output.pdf has changed diff -r 000000000000 -r d19c3cbbdd7e test-data/output.png Binary file test-data/output.png has changed diff -r 000000000000 -r d19c3cbbdd7e test-data/output.tiff Binary file test-data/output.tiff has changed diff -r 000000000000 -r d19c3cbbdd7e test-data/shapefile/output.dbf Binary file test-data/shapefile/output.dbf has changed diff -r 000000000000 -r d19c3cbbdd7e test-data/shapefile/output.prj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/shapefile/output.prj Tue May 20 09:52:08 2025 +0000 @@ -0,0 +1,1 @@ +PROJCS["unknown",GEOGCS["GCS_unknown",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Latitude_Of_Origin",-90.0],UNIT["Meter",1.0]] \ No newline at end of file diff -r 000000000000 -r d19c3cbbdd7e test-data/shapefile/output.shp Binary file test-data/shapefile/output.shp has changed diff -r 000000000000 -r d19c3cbbdd7e test-data/shapefile/output.shx Binary file test-data/shapefile/output.shx has changed diff -r 000000000000 -r d19c3cbbdd7e test-data/shapefile/shapefile_shp.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/shapefile/shapefile_shp.html Tue May 20 09:52:08 2025 +0000 @@ -0,0 +1,17 @@ +Shapefile Galaxy Composite Dataset

+

This composite dataset is composed of the following files: