# HG changeset patch # User ecology # Date 1703364102 0 # Node ID 2af7401f13e0a9bdaa5c723a63890d841a7bd20f # Parent 0cfc9b6da2aca1ce445b812082ba692f65d21aba planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit f00c48e2a16ba6154e6c1aa50330586eefb13a32 diff -r 0cfc9b6da2ac -r 2af7401f13e0 entities_templates.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/entities_templates.R Sat Dec 23 20:41:42 2023 +0000 @@ -0,0 +1,17 @@ +#19/12/2023 #SEGUINEAU Pauline + +#Load arguments + +if (length(commandArgs(trailingOnly = TRUE)) > 0) { + data_objects <- commandArgs(trailingOnly = TRUE)[1] +} + +#Transform arguments + +data = strsplit(data_objects," ")[[1]] + +#Make entities templates for raster and/or vector and/or other entities data + +EMLassemblyline::template_entities(path="output_template",data.path="data_files",data.objects=data) + + diff -r 0cfc9b6da2ac -r 2af7401f13e0 geo_cov_temp.R --- a/geo_cov_temp.R Mon Dec 04 21:48:41 2023 +0000 +++ b/geo_cov_temp.R Sat Dec 23 20:41:42 2023 +0000 @@ -30,6 +30,7 @@ }else if (empty=="true"){ empty=TRUE} + #Make template template_geographic_coverage(path =".", data.path = "data_files", data.table = tablename, lat.col = latcol, lon.col = longcol, site.col = sitecol, empty = empty) diff -r 0cfc9b6da2ac -r 2af7401f13e0 make_eml.R --- a/make_eml.R Mon Dec 04 21:48:41 2023 +0000 +++ b/make_eml.R Sat Dec 23 20:41:42 2023 +0000 @@ -1,5 +1,5 @@ ##07/06/2023 ##Genthon Tanguy -##update 15/11/2023 ##Seguineau Pauline +##update 15/11/2023 ## Seguineau Pauline ###make_eml @@ -9,17 +9,27 @@ start <- args[2] end <-args[3] data_table <- args[4] - data_other <- args[5] - destable <- args[6] - desother <- args[7] - quote <- args[8] - table_url <- args[9] - other_url <- args[10] + data_raster <- args[5] + data_vector <- args[6] + data_other <- args[7] + destable <- args[8] + desraster<- args[9] + desvector<- args[10] + desother <- args[11] + quote <- args[12] + table_url <- args[13] + other_url <- args[14] + raster_url <- args[15] + vector_url <- args[16] } - + +#Load package + +library(EMLassemblyline) +sessionInfo() + ###Format data### - if (data_table == ""){ table=NULL }else{ @@ -48,6 +58,22 @@ } +if (data_raster == ""){ + raster=NULL +}else{ + raster = strsplit(data_raster," ") + for (file in raster){ + name_raster = gsub("\\.[a-zA-Z]*", "", file)} + } + +if (data_vector == ""){ + vector=NULL +}else{ + vector = strsplit(data_vector," ") + for (file in vector){ + name_vector = gsub("\\.[a-zA-Z]*", "", file)} + } + if (data_other == ""){ other=NULL }else{ @@ -63,6 +89,19 @@ des_table = strsplit(destable,",")} } +if (data_raster !=""){ + if (desraster == ""){ + des_raster = name_raster + }else{ + des_raster = strsplit(desraster,",")} +} + +if (data_vector !=""){ + if (desvector == ""){ + des_vector = name_vector + }else{ + des_vector = strsplit(desvector,",")} +} if (data_other !=""){ if (desother == ""){ @@ -71,7 +110,6 @@ des_other = strsplit(desother,",")} } - if (data_table !=""){ if (table_url == ""){ urltable = "" @@ -90,9 +128,79 @@ } } +if (data_raster !=""){ + if (raster_url == ""){ + urlraster = "" + }else{ + raster_url = gsub("\\-" ,"", raster_url) + urlraster = strsplit(raster_url,",") + } +} + +if (data_vector !=""){ + if (vector_url == ""){ + urlvector = "" + }else{ + vector_url = gsub("\\-" ,"", vector_url) + urlvector = strsplit(vector_url,",") + } +} + + + ###Make EML### -if (!is.null(table) && !is.null(other)){ +if (!is.null(table) && !is.null(raster) && !is.null(vector) && !is.null(other)){ + + EMLassemblyline::make_eml( + path="output_template", + data.path="data_files", + eml.path=".", + dataset.title = title, + temporal.coverage = c(start,end), + data.table=table[[1]], + data.table.name = name_table, + data.table.description = des_table[[1]], + data.table.quote.character = tablequote, + data.table.url = urltable[[1]], + spatial.raster=raster[[1]], + spatial.raster.name = name_raster, + spatial.raster.description = des_raster[[1]], + spatial.raster.url = urlraster[[1]], + spatial.vector=vector[[1]], + spatial.vector.name = name_vector, + spatial.vector.description = des_vector[[1]], + spatial.vector.url = urlvector[[1]], + other.entity=other[[1]], + other.entity.name = name_other, + other.entity.description = des_other[[1]], + other.entity.url= urlother[[1]]) + +}else if (is.null(table) && is.null(raster) && is.null(vector) && is.null(other)){ + + EMLassemblyline::make_eml( + path="output_template", + data.path="data_files", + eml.path=".", + dataset.title = title, + temporal.coverage = c(start,end)) + +}else if (!is.null(table) && is.null(raster) && is.null(vector) && is.null(other)){ + + EMLassemblyline::make_eml( + path="output_template", + data.path="data_files", + eml.path=".", + dataset.title = title, + temporal.coverage = c(start,end), + data.table=table[[1]], + data.table.name = name_table, + data.table.description = des_table[[1]], + data.table.quote.character = tablequote, + data.table.url = urltable[[1]] + ) + +}else if (!is.null(table) && !is.null(raster) && is.null(vector) && is.null(other)){ EMLassemblyline::make_eml( path="output_template", @@ -105,22 +213,203 @@ data.table.description = des_table[[1]], data.table.quote.character = tablequote, data.table.url = urltable[[1]], + spatial.raster=raster[[1]], + spatial.raster.name = name_raster, + spatial.raster.description = des_raster[[1]], + spatial.raster.url = urlraster[[1]]) + +}else if (!is.null(table) && !is.null(raster) && !is.null(vector) && is.null(other)){ + + EMLassemblyline::make_eml( + path="output_template", + data.path="data_files", + eml.path=".", + dataset.title = title, + temporal.coverage = c(start,end), + data.table=table[[1]], + data.table.name = name_table, + data.table.description = des_table[[1]], + data.table.quote.character = tablequote, + data.table.url = urltable[[1]], + spatial.raster=raster[[1]], + spatial.raster.name = name_raster, + spatial.raster.description = des_raster[[1]], + spatial.raster.url = urlraster[[1]], + spatial.vector=vector[[1]], + spatial.vector.name = name_vector, + spatial.vector.description = des_vector[[1]], + spatial.vector.url = urlvector[[1]]) + +}else if (is.null(table) && !is.null(raster) && is.null(vector) && is.null(other)){ + + EMLassemblyline::make_eml( + path="output_template", + data.path="data_files", + eml.path=".", + dataset.title = title, + temporal.coverage = c(start,end), + spatial.raster=raster[[1]], + spatial.raster.name = name_raster, + spatial.raster.description = des_raster[[1]], + spatial.raster.url = urlraster[[1]]) + +}else if (is.null(table) && !is.null(raster) && !is.null(vector) && is.null(other)){ + + EMLassemblyline::make_eml( + path="output_template", + data.path="data_files", + eml.path=".", + dataset.title = title, + temporal.coverage = c(start,end), + spatial.raster=raster[[1]], + spatial.raster.name = name_raster, + spatial.raster.description = des_raster[[1]], + spatial.raster.url = urlraster[[1]], + spatial.vector=vector[[1]], + spatial.vector.name = name_vector, + spatial.vector.description = des_vector[[1]], + spatial.vector.url = urlvector[[1]]) + +}else if (is.null(table) && !is.null(raster) && !is.null(vector) && !is.null(other)){ + + EMLassemblyline::make_eml( + path="output_template", + data.path="data_files", + eml.path=".", + dataset.title = title, + temporal.coverage = c(start,end), + spatial.raster=raster[[1]], + spatial.raster.name = name_raster, + spatial.raster.description = des_raster[[1]], + spatial.raster.url = urlraster[[1]], + spatial.vector=vector[[1]], + spatial.vector.name = name_vector, + spatial.vector.description = des_vector[[1]], + spatial.vector.url = urlvector[[1]], + other.entity=other[[1]], + other.entity.name = name_other, + other.entity.description = des_other[[1]], + other.entity.url= urlother[[1]]) + +}else if (is.null(table) && is.null(raster) && !is.null(vector) && is.null(other)){ + + EMLassemblyline::make_eml( + path="output_template", + data.path="data_files", + eml.path=".", + dataset.title = title, + temporal.coverage = c(start,end), + spatial.vector=vector[[1]], + spatial.vector.name = name_vector, + spatial.vector.description = des_vector[[1]], + spatial.vector.url = urlvector[[1]]) + +}else if (is.null(table) && is.null(raster) && !is.null(vector) && !is.null(other)){ + + EMLassemblyline::make_eml( + path="output_template", + data.path="data_files", + eml.path=".", + dataset.title = title, + temporal.coverage = c(start,end), + spatial.vector=vector[[1]], + spatial.vector.name = name_vector, + spatial.vector.description = des_vector[[1]], + spatial.vector.url = urlvector[[1]], + other.entity=other[[1]], + other.entity.name = name_other, + other.entity.description = des_other[[1]], + other.entity.url= urlother[[1]]) + +}else if (is.null(table) && is.null(raster) && is.null(vector) && !is.null(other)){ + + EMLassemblyline::make_eml( + path="output_template", + data.path="data_files", + eml.path=".", + dataset.title = title, + temporal.coverage = c(start,end), + other.entity=other[[1]], + other.entity.name = name_other, + other.entity.description = des_other[[1]], + other.entity.url= urlother[[1]]) + +}else if (!is.null(table) && is.null(raster) && !is.null(vector) && is.null(other)){ + + EMLassemblyline::make_eml( + path="output_template", + data.path="data_files", + eml.path=".", + dataset.title = title, + temporal.coverage = c(start,end), + data.table=table[[1]], + data.table.name = name_table, + data.table.description = des_table[[1]], + data.table.quote.character = tablequote, + data.table.url = urltable[[1]], + spatial.vector=vector[[1]], + spatial.vector.name = name_vector, + spatial.vector.description = des_vector[[1]], + spatial.vector.url = urlvector[[1]]) + +}else if (!is.null(table) && is.null(raster) && is.null(vector) && !is.null(other)){ + + EMLassemblyline::make_eml( + path="output_template", + data.path="data_files", + eml.path=".", + dataset.title = title, + temporal.coverage = c(start,end), + data.table=table[[1]], + data.table.name = name_table, + data.table.description = des_table[[1]], + data.table.quote.character = tablequote, + data.table.url = urltable[[1]], other.entity=other[[1]], other.entity.name = name_other, other.entity.description = des_other[[1]], - other.entity.url= urlother[[1]] - ) - -}else if (is.null(table) && is.null(other)){ - + other.entity.url= urlother[[1]]) + +}else if (is.null(table) && !is.null(raster) && is.null(vector) && !is.null(other)){ + EMLassemblyline::make_eml( path="output_template", data.path="data_files", eml.path=".", dataset.title = title, - temporal.coverage = c(start,end)) + temporal.coverage = c(start,end), + spatial.raster=raster[[1]], + spatial.raster.name = name_raster, + spatial.raster.description = des_raster[[1]], + spatial.raster.url = urlraster[[1]], + other.entity=other[[1]], + other.entity.name = name_other, + other.entity.description = des_other[[1]], + other.entity.url= urlother[[1]]) + +}else if (!is.null(table) && is.null(raster) && !is.null(vector) && !is.null(other)){ -}else if (!is.null(table) && is.null(other)){ + EMLassemblyline::make_eml( + path="output_template", + data.path="data_files", + eml.path=".", + dataset.title = title, + temporal.coverage = c(start,end), + data.table=table[[1]], + data.table.name = name_table, + data.table.description = des_table[[1]], + data.table.quote.character = tablequote, + data.table.url = urltable[[1]], + spatial.vector=vector[[1]], + spatial.vector.name = name_vector, + spatial.vector.description = des_vector[[1]], + spatial.vector.url = urlvector[[1]], + other.entity=other[[1]], + other.entity.name = name_other, + other.entity.description = des_other[[1]], + other.entity.url= urlother[[1]]) + +}else if (!is.null(table) && !is.null(raster) && is.null(vector) && !is.null(other)){ EMLassemblyline::make_eml( path="output_template", @@ -132,26 +421,18 @@ data.table.name = name_table, data.table.description = des_table[[1]], data.table.quote.character = tablequote, - data.table.url = urltable[[1]]) - - -}else if (is.null(table) && !is.null(other)){ - - EMLassemblyline::make_eml( - path="output_template", - data.path="data_files", - eml.path=".", - dataset.title = title, - temporal.coverage = c(start,end), + data.table.url = urltable[[1]], + spatial.raster=raster[[1]], + spatial.raster.name = name_raster, + spatial.raster.description = des_raster[[1]], + spatial.raster.url = urlraster[[1]], other.entity=other[[1]], other.entity.name = name_other, other.entity.description = des_other[[1]], other.entity.url= urlother[[1]])} - - +issues() old.names <- list.files(path=".", pattern=".xml") -print(old.names) file.rename(from=old.names, to="eml.xml") diff -r 0cfc9b6da2ac -r 2af7401f13e0 raster_templates.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/raster_templates.R Sat Dec 23 20:41:42 2023 +0000 @@ -0,0 +1,22 @@ +#15/12/2023 #SEGUINEAU Pauline + +#Load packages + +library(EMLassemblyline) + +#Load arguments + +if (length(commandArgs(trailingOnly = TRUE)) > 0) { + data_raster <- commandArgs(trailingOnly = TRUE)[1] +} + +#Transform arguments + +raster = strsplit(data_raster," ") + +#Make templates to describe data raster + +template_raster_attributes(path = ".",data.path= "data_files", raster.file = raster[[1]]) +template_categorical_variables(path = ".", data.path = "data_files") + + diff -r 0cfc9b6da2ac -r 2af7401f13e0 taxo_cov_template.xml --- a/taxo_cov_template.xml Mon Dec 04 21:48:41 2023 +0000 +++ b/taxo_cov_template.xml Sat Dec 23 20:41:42 2023 +0000 @@ -1,8 +1,7 @@ - + for EML metadata creation - r-base - r-emlassemblyline + outils-patrinat.mnhn.fr/metashark:latest 0) { + data_vector <- commandArgs(trailingOnly = TRUE)[1] +} + +#Transform arguments + +vector = strsplit(data_vector," ") + +#Make templates to describe data raster + +template_vector_attributes(path = ".",data.path= "data_files", vector.file = vector[[1]]) +template_categorical_variables(path = ".", data.path = "data_files") + +