Repository 'makeeml'
hg clone https://toolshed.g2.bx.psu.edu/repos/ecology/makeeml

Changeset 2:8a697f446051 (2023-12-02)
Previous changeset 1:9d56f6480194 (2023-11-17) Next changeset 3:642e31c435c9 (2023-12-04)
Commit message:
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline commit ea09df299078ff13beda210b36b7edaa6a79c099
modified:
make_eml.xml
test-data/geographic_coverage.txt
added:
geo_cov_temp.R
table_templates.R
taxo_cov_template.R
templates1.R
test-data/datafile_1.tsv
test-data/taxa.tsv
test-data/taxonomic_coverage.txt
test-data/test-geocov.tabular
b
diff -r 9d56f6480194 -r 8a697f446051 geo_cov_temp.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/geo_cov_temp.R Sat Dec 02 01:50:00 2023 +0000
[
@@ -0,0 +1,37 @@
+#27/11/2023
+#Seguineau Pauline
+#Make geographic coverage template
+
+#Load packages
+
+library(EMLassemblyline)
+
+#Load arguments
+
+args = commandArgs(trailingOnly=TRUE)
+if(length(args)>0){
+  
+  data_table <- args[1]
+  tablename <- args[2]
+  lat_col <- as.numeric(args[3])
+  long_col <- as.numeric(args[4])
+  site_col <- as.numeric(args[5])
+  empty <- args[6]
+}
+
+datatable = read.table(data_table,header=T)
+
+latcol = names(datatable[lat_col])
+longcol = names(datatable[long_col])
+sitecol = names(datatable[site_col])
+
+if (empty == "false"){
+   empty = FALSE
+}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)
+
+
b
diff -r 9d56f6480194 -r 8a697f446051 make_eml.xml
--- a/make_eml.xml Fri Nov 17 17:07:36 2023 +0000
+++ b/make_eml.xml Sat Dec 02 01:50:00 2023 +0000
[
b'@@ -1,134 +1,134 @@\n-<tool id="makeeml" name="Make EML" version="0.1.0+galaxy0">\r\n-    <description> Create EML from EAL templates</description>\r\n-    <requirements>\r\n-        <requirement type="package" version="4.3.1">r-base</requirement>\r\n-        <requirement type="package" version="3.5.5">r-emlassemblyline</requirement>\r\n-    </requirements>\r\n-    <command detect_errors="exit_code"><![CDATA[\r\n-    \r\n-    mkdir output_template &&\r\n-    #for $input in $templates\r\n-        ln -s \'$input\' \'output_template/${input.element_identifier}\';\r\n-    #end for\r\n-   \r\n-    #set $table = ""\r\n-    mkdir data_files && \r\n-    #for $indata in $inputdata\r\n-        ln -s \'$indata\' \'data_files/${indata.element_identifier}\';\r\n-        #set $table += $indata.element_identifier + " ";\r\n-    #end for\r\n-    \r\n-    #set $other = ""\r\n-    #for $data_other in $dataother\r\n-        ln -s \'$data_other\' \'data_files/${data_other.element_identifier}\';\r\n-        #set $other += $data_other.element_identifier + " ";\r\n-    #end for\r\n-  \r\n-    #set $quotetable ="" \r\n-    #for $q in $table_quote \r\n-       #set $quotetable += $q.quote + ",";\r\n-    #end for \r\n-\r\n-    Rscript \r\n-     \'$__tool_directory__/make_eml.R\' 2> err.txt\r\n-     \'$title\'\r\n-     \'$temporal_coverage.start\'\r\n-     \'$temporal_coverage.end\'\r\n-     \'$table\'\r\n-     \'$other\'\r\n-     \'$destable\'\r\n-     \'$desother\'\r\n-     \'$quotetable\'\r\n-     \'$table_url\'\r\n-     \'$other_url\'\r\n-\t\t\r\n-    ]]></command>\r\n-    <inputs>\r\n-        <param name="templates" type="data_collection"  collection_type="list" format="tabular" label="Upload all EAL templates" help= "Input a data collection with only tabular files." />\r\n-      <section name="data_table" title="Do you have data table ? " >\r\n-        <param name="inputdata" type="data_collection"  collection_type="list"  label="Upload all data files wich are data table" help= "Input a data collection." optional = "true"/>\r\n-        <param name="destable" type="text" label="Give a short description of your data file. If there is multiple data files please separate your descriptions with a comma (,) in the same order of your data input" optional = "true"/>\r\n-        <repeat name="table_quote" title="What\'s the quotes of your data table ? Repeat this parameter as many time as the number of data tables you\'ve input and in the same order" >\r\n-                <param name="quote" type="select" label="What\'s the quotes of your data table ?" optional="true">\r\n-                 <option value="quote">Quote</option>\r\n-                 <option value="apostrophe">Apostrophe</option>\r\n-                 <option value="none">None</option>\r\n-                </param>\r\n-        </repeat>\r\n-        <param name="table_url" type="text" label="Give the publicly accessible URL from which your data table can be downloaded. If more than one, data files please separate your URLs with a comma (,) in the same order of your data input. If wanting to include URLs for some but not all then use a - for those that don\'t have a URL." optional = "true"/>\r\n-      </section>\r\n-      <section name="data_other" title="Do you have other data entity ? " >\r\n-        <param name="dataother" type="data_collection"  collection_type="list"  label="Upload all data files wich are other entity" help= "Input a data collection." optional = "true"/>\r\n-        <param name="desother" type="text" label="Give a short description of your data file. If there are multiple data files please separate your descriptions with a comma (,) in the same order of your data input" optional = "true"/>\r\n-        <param name="other_url" type="text" label="Give the publicly accessible URL from which your other data entity can be downloaded. If more than one, data files please separate your URLs with a comma (,) in the same order of your data input. If wanting to include URLs for some but not all then use a - for those that don\'t have a URL." optional = "true"/>\r\n-      </section>\r\n-\t<param name="title" type="text" label="Title for your dataset." />\r\n'..b'ty can be downloaded. If more than one, data files please separate your URLs with a comma (,) in the same order of your data input. If wanting to include URLs for some but not all then use a - for those that don\'t have a URL." optional = "true"/>\n+      </section>\n+\t<param name="title" type="text" label="Title for your dataset." />\n+      <section name="temporal_coverage" title="Temporal coverage" >\n+\t<param name="start" type="text" label="Beginning date of the dataset in the format YYYY-MM-DD" />\n+\t<param name="end" type="text" label="Ending date of the dataset in the format YYYY-MM-DD" />\n+      </section>\n+    </inputs>\n+    <outputs>\n+\t\t <data name="metadataout" from_work_dir="eml.xml" format="xml" label="EML"/>\n+\t\t <data name="error" from_work_dir="err.txt" format="txt" label="Warning message"/>\n+    </outputs>\n+    <tests>\n+        <test expect_num_outputs="2"> \n+            <param name="templates">\n+                <collection type="list">\n+\t\t\t<element name="annotations.txt" value="annotations.txt"/>\n+                        <element name="keywords.txt" value="keywords.txt" />\n+                        <element name="attributes_data_blary_al.txt" value="attributes_data_blary_al.txt"/>\n+                        <element name="catvars_data_blary_al.txt" value="catvars_data_blary_al.txt"/>\n+                        <element name="geographic_coverage.txt" value="geographic_coverage.txt" />\n+                        <element name="personnel.txt" value="personnel.txt" />\n+                </collection>\n+            </param>\n+            <output name="metadataout" >\n+\t\t\t<assert_contents>\n+\t\t\t\t<is_valid_xml />\n+\t\t\t\t<xml_element path="./dataset"/>\n+                \t</assert_contents>\n+            </output>\n+        </test>\n+    </tests>\n+<help><![CDATA[\n+.. class:: warningmark\n+\n+\'\'\'TIP\'\'\' This tool accept as inputs only Galaxy collections containing EAL templates in tabular format.\n+\n+**What it does?**\n+--------------------\n+\n+This tool produce EML metadata from EAL templates.\n+This tool can be used in the continuation of the eml2eal tool.\n+\n+**How to use it?**\n+--------------------\n+To use this tool, you can select, in your history a data collection with EAL templates made by the eml2eal tool. \n+You can also select your own templates that you have to integrate into a Galaxy collection.\n+\n+To do so you can select the **Upload file** tool, select the *Collection* tab, upload all your templates, click on the *Start* button to integrate the files to Galaxy and then click\n+on *Build*. You will need to choose a name and select *Create collection* to build a collection with your templates.\n+You also can upload your files to Galaxy, select them in the history by clicking the *Select items* button, click on the newly appeared box on the right and select *Build dataset list*.\n+\n+**Recommended optional input:**\n+\n+Data files : If you have data files you can input them to give more information in your metadata file. There are two parameters to do to so. The first is "Do you have data table ?" that provide you to import a collection with all your data table. The second is "Do you have other data entity ?" is for all your data file that not data table. \n+\n+Description : You can add a short description of each data files you input. If there are multiple data files, please separate your descriptions with a comma (,) in the same order of your data input \n+\n+Quote : If you have import data table files, you can specify if there are quotes and what type of quote is it. Repeat this parameter as many times as the number of data tables you\'ve input and in the same order\n+\n+Title : You can give a title for your dataset.\n+\n+Temporal coverage : You can specify the temporal coverage of your data. \n+\n+ .. class:: infomark \n+ \n+ Templates can be directly edited in Galaxy (view **eml2eal** tool for more information.)\n+ \n+\n+You then have to select your collection in the upload box of the tool and click **Execute** to get your EML metadata.\n+]]></help>\n+</tool>\n'
b
diff -r 9d56f6480194 -r 8a697f446051 table_templates.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/table_templates.R Sat Dec 02 01:50:00 2023 +0000
[
@@ -0,0 +1,21 @@
+#28/11/2023 #SEGUINEAU Pauline 
+
+#Load packages
+
+library(EMLassemblyline)
+
+#Load arguments
+
+if (length(commandArgs(trailingOnly = TRUE)) > 0) {
+    data_table <- commandArgs(trailingOnly = TRUE)[1]
+}
+
+#Transform arguments
+
+table =  strsplit(data_table," ")
+
+#Make templates to describe data tables : Describes columns of a data table (classes, units, datetime formats, missing value codes) + catégorical variables.
+
+template_table_attributes(path = ".",data.path= "data_files", data.table = table[[1]])
+template_categorical_variables(path = ".", data.path = "data_files")
+
b
diff -r 9d56f6480194 -r 8a697f446051 taxo_cov_template.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/taxo_cov_template.R Sat Dec 02 01:50:00 2023 +0000
[
@@ -0,0 +1,47 @@
+#28/11/2023
+#Seguineau Pauline
+#Make taxonomic coverage template
+
+#Load packages
+
+library(EMLassemblyline)
+
+#Load arguments
+
+args = commandArgs(trailingOnly=TRUE)
+if(length(args)>0){
+  data_taxa <- args[1]
+  taxa_table <- args[2]
+  taxa_col <- as.numeric(args[3])
+  taxa_name_type <- args[4]
+  authority <- as.numeric(args[5])
+  authority2 <- as.numeric(args[6])
+  authority3 <- as.numeric(args[7])
+  empty <- args[8]
+}
+
+#transfom arguments
+taxatable = read.table(data_taxa,header=T,sep="\t")
+taxacol = names(taxatable[taxa_col])
+
+if (authority2 == 0 && authority3==0){
+   authority_f = authority}
+   
+if(authority2 == 0 && authority3 != 0){
+   authority_f = c(authority,authority3)}
+
+if (authority2 !=0 && authority3==0){
+   authority_f = c(authority,authority2)}
+
+if (authority3 !=0 && authority2 !=0){
+   authority_f = c(authority,authority2,authority3)}
+   
+if (empty == "false"){
+   empty = FALSE
+}else if (empty=="true"){
+   empty=TRUE}
+
+
+#Make template
+
+template_taxonomic_coverage(path =".", data.path = "data_files", taxa.table = taxa_table, taxa.col = taxacol, taxa.name.type = taxa_name_type , taxa.authority = authority_f, empty = empty)
b
diff -r 9d56f6480194 -r 8a697f446051 templates1.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates1.R Sat Dec 02 01:50:00 2023 +0000
[
@@ -0,0 +1,23 @@
+#22/11/2023 #SEGUINEAU Pauline 
+
+###First tool of EML Workflow
+
+#Load packages
+
+library(EMLassemblyline)
+
+#Load arguments
+
+args = commandArgs(trailingOnly=TRUE)
+if(length(args)>0){
+  
+  license <- args[1]
+  file_type <- args[2]
+}
+
+#Make templates to describe core features of a data package (abstract, methods, keywords, personnel, license). 
+
+template_core_metadata(path=".",license = license, file.type = file_type)
+
+
+
b
diff -r 9d56f6480194 -r 8a697f446051 test-data/datafile_1.tsv
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/datafile_1.tsv Sat Dec 02 01:50:00 2023 +0000
b
@@ -0,0 +1,113 @@
+Id density_boats distance_coast percentage_turbidity nb_individual recorder min_t max_wind
+ID1 0 7.083851986 1 1 13740 9 13
+ID2 0 5.057419245 1 1 3760 11.7 15
+ID3 0 14.81271925 1 1 17598 9 13
+ID4 23.38130966 17.39474876 0 1 17607 12.8 24
+ID5 0 13.8788222 1 1 17608 14.3 17
+ID6 0 20.55593297 1 1 13733 20 17
+ID7 0 5.228906117 1 1 10250 14.3 30
+ID8 0 8.18336163 0.963336783 2 13740 11.7 15
+ID9 0 14.77478497 1 1 13733 11.7 15
+ID10 0 18.23789045 1 1 17573 9 13
+ID11 0 30.97770737 0.934057759 2 17608 8.1 13
+ID12 0 14.72135785 0 2 13733 8.1 13
+ID13 0 26.97792869 1 1 17578 8.1 13
+ID14 0 8.63834361 1 1 17329 11.7 15
+ID15 23.42372625 2.371250707 0.611485317 2 17232 14.3 30
+ID16 0 2.058590657 1 1 NA 11.7 15
+ID17 0 14.5557442 1 1 11693 14.3 17
+ID18 0 15.31628381 0.484376584 2 10250 14.2 9
+ID19 22.68310089 18.12266606 1 1 13733 16.9 13
+ID20 0 10.71630644 0.946424061 2 17608 NA NA
+ID21 0 7.492501839 1 1 17608 14.3 30
+ID22 0 2.455167732 1 1 17578 8.1 13
+ID23 0 0.215005092 0.619357094 2 17608 13.3 0
+ID24 0 20.5942275 0.530977409 2 17573 12.8 24
+ID25 0 0.00565931 1 1 10250 9 13
+ID26 0 4.61669024 1 1 3760 8.1 13
+ID27 0 0.650746944 1 1 13289 NA NA
+ID28 11.55094443 4.256523462 0.534748923 2 17608 17.4 15
+ID29 25.29249263 0.333785924 0 3 11693 16.9 13
+ID30 5.659985665 3.927116342 1 1 17578 16.9 13
+ID31 0 0.011314137 0 2 13740 20 17
+ID32 0 6.724401426 0.262229612 3 17578 8.5 7
+ID33 0 10.20546782 0.456408314 2 13676 17.8 13
+ID34 0 0.005662514 1 1 13289 9 13
+ID35 0 12.50424544 1 1 13733 13.3 0
+ID36 41.24173899 0.028288543 0 2 17607 NA NA
+ID37 0 0.707453733 0 2 13733 17.8 13
+ID38 7.278017273 8.411585021 0.521433594 2 17601 17.4 15
+ID39 26.46665163 3.174693 1 1 17598 11.7 15
+ID40 21.65723654 8.846001472 0.672489759 2 17232 9 13
+ID41 0 7.296088753 0.033790965 2 17601 9 13
+ID42 0 0.848848396 0 3 17608 17.4 14
+ID43 0 17.47693701 1 1 NA 8.1 13
+ID44 0 8.040770102 1 1 17329 8.1 13
+ID45 0 9.227200724 1 1 17607 8.1 13
+ID46 0 4.089829166 0 1 17607 17.4 15
+ID47 16.24258106 12.9081546 0.519677866 2 17232 14.3 17
+ID48 0 28.17682685 0 3 13733 14.2 9
+ID49 0 11.13752122 0.568145458 2 17329 12.8 24
+ID50 0 12.15482119 0.744442086 2 13676 17.4 14
+ID51 0 1.075147125 0.126547756 2 17329 17.8 13
+ID52 0 0.639429606 0.318501019 3 17573 17.8 13
+ID53 0 11.34563151 1 1 13289 9 13
+ID54 0 6.070721358 1 1 11693 8.1 13
+ID55 0 2.534940304 1 1 3760 NA NA
+ID56 0 0 1 1 17608 14.9 13
+ID57 23.6734518 9.73526417 1 1 13733 14.9 13
+ID58 22.77461434 2.30834512 0 2 3760 17.4 15
+ID59 0 9.034849513 1 1 NA 14.3 30
+ID60 0 1.61299451 1 1 17598 8.1 13
+ID61 0 1.550212164 1 1 17601 8.1 13
+ID62 16.6417688 0.198064626 1 1 13676 13.3 0
+ID63 0 0.147167035 0.503759276 2 13740 14.9 13
+ID64 0 1.126075147 1 1 17329 14.2 9
+ID65 0 1.166213768 0.486555056 2 10250 17.4 14
+ID66 0 37.17890687 0.241246715 3 11693 12.3 11
+ID67 0 1.01318843 1 1 NA 11.7 15
+ID68 0 14.97426034 0.513275979 3 17578 8.5 7
+ID69 0 0.050933786 1 1 10250 13.3 0
+ID70 0 1.60733488 1 1 11693 13.3 0
+ID71 0 0.15274085 0.616607437 2 11693 14.9 13
+ID72 0 4.745186863 0.427826338 3 17578 14.9 13
+ID73 0 0.005658029 1 1 13289 17.4 15
+ID74 20.10097018 1.120479882 1 1 17329 9 13
+ID75 0 1.833512535 1 1 11693 9 13
+ID76 0 1.964892412 1 1 3760 14.9 13
+ID77 0 1.024508972 1 1 17598 13.3 0
+ID78 13.02008677 2.446206116 0 2 17601 17.8 13
+ID79 0 5.849408836 0.506514891 2 17601 12.3 11
+ID80 0 0.82602546 1 1 17607 20 17
+ID81 0 6.632335465 1 1 13733 17.8 13
+ID82 9.774097667 2.083923212 0.147137616 2 17329 17.4 14
+ID83 0 0.843046283 1 1 17598 11.7 15
+ID84 0 17.16743054 1 1 3760 9 13
+ID85 0 2.347816248 1 1 17607 13.3 0
+ID86 0 2.089467724 1 1 17608 8.1 13
+ID87 14.70497236 1.782279054 1 1 17329 8.1 13
+ID88 0 1.828267391 1 1 10250 8.1 13
+ID89 19.54258479 2.829334541 1 1 3760 14.3 30
+ID90 22.89867383 0.50376408 1 1 17573 14.3 30
+ID91 0 7.486419194 1 1 13676 14.2 9
+ID92 0 4.612337295 1 1 17601 11.7 15
+ID93 0 20.34521788 1 1 17232 11.7 15
+ID94 0 13.69731259 0.558754442 2 13289 14.3 17
+ID95 0 0.481041313 0.601822162 2 17607 14.3 17
+ID96 0 19.55721647 0.856473518 3 17232 16.9 13
+ID97 0 9.467489106 1 1 10250 17.4 15
+ID98 0 22.78746039 0.460271388 3 11693 14.3 30
+ID99 0 8.380520951 0.769578171 2 17607 9 13
+ID100 32.43763517 0.486507892 0.297384797 4 17573 12.3 11
+ID101 39.87341993 18.47598574 0.377696294 3 17329 NA NA
+ID102 0 1.482655198 0.420523151 2 17598 NA NA
+ID103 0 1.188455008 1 1 13289 8.1 13
+ID104 0 2.981949867 1 1 17232 13.3 0
+ID105 6.048310547 0.06224536 1 1 17578 17.4 14
+ID106 0 0.067957866 1 1 17232 17.4 14
+ID107 0 0.305516266 0 1 17598 17.4 14
+ID108 0 1.375212224 0.512278187 2 17601 20 17
+ID109 23.18323585 0.045282164 0.355925541 2 13676 17.4 14
+ID110 0 0 0.599181014 2 17232 13.3 0
+ID111 0 0.050922259 1 1 17329 14.9 13
+ID112 0 0.763920326 1 1 13740 13.3 0
b
diff -r 9d56f6480194 -r 8a697f446051 test-data/geographic_coverage.txt
--- a/test-data/geographic_coverage.txt Fri Nov 17 17:07:36 2023 +0000
+++ b/test-data/geographic_coverage.txt Sat Dec 02 01:50:00 2023 +0000
b
@@ -1,2 +1,5 @@
 geographicDescription northBoundingCoordinate southBoundingCoordinate eastBoundingCoordinate westBoundingCoordinate
-Yvelines - Essonne - Seine et Marne 49.08428 48.12266 3.56409 1.60296
+1 -65.999946 -65.999946 142.3360535 142.3360535
+2 -66.394359 -66.394359 140.4840125 140.4840125
+3 -66.023545 -66.023545 142.745584 142.745584
+4 -66.3379125 -66.3379125 144.011634 144.011634
b
diff -r 9d56f6480194 -r 8a697f446051 test-data/taxa.tsv
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/taxa.tsv Sat Dec 02 01:50:00 2023 +0000
b
@@ -0,0 +1,5 @@
+taxa site
+Achelia_sp 1
+Achelia_spicata 2
+Achelia_suflata 2
+Ammothea_adunca 3
b
diff -r 9d56f6480194 -r 8a697f446051 test-data/taxonomic_coverage.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/taxonomic_coverage.txt Sat Dec 02 01:50:00 2023 +0000
b
@@ -0,0 +1,5 @@
+name name_type name_resolved authority_system authority_id
+Achelia_sp scientific Achelia GBIF Backbone Taxonomy 2118396
+Achelia_spicata scientific Achelia spicata GBIF Backbone Taxonomy 4338694
+Achelia_suflata scientific Achelia suflata GBIF Backbone Taxonomy NA
+Ammothea_adunca scientific Ammothea adunca GBIF Backbone Taxonomy 5720487
b
diff -r 9d56f6480194 -r 8a697f446051 test-data/test-geocov.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test-geocov.tabular Sat Dec 02 01:50:00 2023 +0000
b
@@ -0,0 +1,5 @@
+site lat long
+1 -65.999946 142.3360535
+2 -66.394359 140.4840125
+3 -66.023545 142.745584
+4 -66.3379125 144.011634