Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metashrimps tool suite #73

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
6d54a4a
Add files via upload
TanguyGen Jul 21, 2023
348afd9
Add files via upload
TanguyGen Jul 21, 2023
62966ed
Add files via upload
TanguyGen Jul 21, 2023
82c3609
Update .shed.yml
TanguyGen Jul 21, 2023
5aa6917
Update .shed.yml
TanguyGen Jul 21, 2023
036b977
Add files via upload
TanguyGen Jul 21, 2023
b25bba0
Update DataPaper.xml
TanguyGen Jul 21, 2023
44c50dd
Update DataPaper.xml
TanguyGen Jul 21, 2023
6c010c2
Update DataPaper.xml
TanguyGen Jul 21, 2023
2598001
Update DataPaper.R
TanguyGen Jul 21, 2023
73444b2
Update DataPaper.xml
TanguyGen Jul 24, 2023
927a21f
Remove extensions
TanguyGen Jul 24, 2023
128e7a3
Update DataPaper.xml
TanguyGen Jul 24, 2023
5b83553
Update DataPaper.xml
TanguyGen Jul 24, 2023
efd45b4
Update DataPaper.xml
TanguyGen Jul 24, 2023
b9e5462
Update DataPaper.xml
TanguyGen Jul 24, 2023
2edb116
Update DataPaper.R
TanguyGen Jul 24, 2023
a071344
Update DataPaper.xml
TanguyGen Jul 25, 2023
e9dcab5
Update DataPaper.xml
TanguyGen Jul 25, 2023
9d0caa7
Add files via upload
TanguyGen Jul 26, 2023
9d71e84
Update DataPaper.xml
TanguyGen Jul 26, 2023
2c033c2
Update DataPaper.xml
TanguyGen Jul 26, 2023
987749e
Update DataPaper.xml
TanguyGen Jul 26, 2023
d696225
Update DataPaper.xml
TanguyGen Jul 26, 2023
ea07435
Update DataPaper.xml
TanguyGen Jul 26, 2023
844525a
Update DataPaper.xml
TanguyGen Jul 26, 2023
0489090
reformatting
bgruening Jul 27, 2023
cb648a9
change the id to make it a bit more informative
bgruening Jul 27, 2023
29cd255
Update .shed.yml
TanguyGen Jul 27, 2023
429f319
Update DataPaper.xml
TanguyGen Jul 27, 2023
b44b5e3
Update DataPaper.xml
TanguyGen Jul 27, 2023
154b442
Update DataPaper.xml
TanguyGen Jul 27, 2023
2f91ecc
Update DataPaper.xml
TanguyGen Jul 27, 2023
6d65451
Update DataPaper.xml
TanguyGen Jul 27, 2023
c5e708d
Update DataPaper.xml
TanguyGen Jul 27, 2023
b5a9de8
Update DataPaper.R
TanguyGen Jul 27, 2023
611479e
Update DataPaper.xml
TanguyGen Jul 27, 2023
9685cb4
Update DataPaper.xml
TanguyGen Jul 27, 2023
3b2f3f1
Add files via upload
yvanlebras Jul 28, 2023
c46f92e
Add files via upload
TanguyGen Jul 28, 2023
283b107
Update DataPaper.xml
TanguyGen Jul 28, 2023
47e06be
Update DataPaper.xml r-dplyr requirements as last place in order inst…
yvanlebras Sep 14, 2023
727b51d
Update DataPaper.xml add r-codetools 0.2_18 requirement
yvanlebras Sep 14, 2023
66d5e3a
Update footer.xsl add https for http://unconf17.ropensci.org/images/r…
yvanlebras Sep 14, 2023
b8fe7f1
Update .shed.yml to retest through CI
yvanlebras Jan 24, 2024
faffc64
Update DataPaper.xml try reorganise dependencies order
yvanlebras Jan 24, 2024
3046d26
Update DataPaper.xml try letting conda find good dependendcies versio…
yvanlebras Jan 26, 2024
677cd96
Update DataPaper.xml retry dependencies versions
yvanlebras Jan 26, 2024
cc5056a
Update DataPaper.xml test depednanecies versions
yvanlebras Jan 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tools/metashrimps/.shed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: MetaShRIMPS
owner: ecology
description: Tools to operate machine actionnable actions on EML metadata
homepage_url: https://github.com/tanguygen/metacure
long_description: |
Tools to operate machine actionnable jobs to EML metadata from MetaShRIMPS, a project from the PNDB (French hub for biodiversity data)
remote_repository_url: https://github.com/galaxyecology/tools-ecology/tree/master/tools/EMLassemblyline
type: unrestricted
categories:
- Ecology
auto_tool_repositories:
name_template: "{{ tool_id }}"
description_template: "MetaShRIMPS: {{ tool_name }}"
suite:
name: "suite_metashrimps"
description: Tools to operate machine actionnable jobs on EML metadata
long_description: |
Tools to operate machine actionnable jobs to EML metadata from MetaShRIMPS, a project from the PNDB (French hub for biodiversity data).
97 changes: 97 additions & 0 deletions tools/metashrimps/DataPaper.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
##07/06/2023
##Genthon Tanguy
### Data Paper draft production

#load arguments
args = commandArgs(trailingOnly=TRUE)
if (length(args)==0)
{
stop("This tool needs at least one argument")
}else{
path_temp <- args[1]
data <- args[2]
edit <- args[3]
}

library(dplyr)
#####################################################################################################
#Functions for creation of Data Papers

#' map_geographical_coverage
#'Make a map from EML
#' @param eml Metadata using EML standard in XML format
#'
#' @return A map
#' @export
map_geographical_coverage <- function(eml,editable=edit){
name <- xml2::xml_find_all(eml, "//geographicCoverage/geographicDescription")
name <- unlist(xml2::as_list(name))

west <- xml2::xml_find_all(eml, "//geographicCoverage/boundingCoordinates/westBoundingCoordinate")
west <- as.numeric(unlist(xml2::as_list(west)))

east <- xml2::xml_find_all(eml, "//geographicCoverage/boundingCoordinates/eastBoundingCoordinate")
east <- as.numeric(unlist(xml2::as_list(east)))

north <- xml2::xml_find_all(eml, "//geographicCoverage/boundingCoordinates/northBoundingCoordinate")
north <- as.numeric(unlist(xml2::as_list(north)))

south <- xml2::xml_find_all(eml, "//geographicCoverage/boundingCoordinates/southBoundingCoordinate")
south <- as.numeric(unlist(xml2::as_list(south)))

geo_info <- data.frame(name = name,
west = west, east = east,
south = south, north = north)

map <- leaflet::leaflet(geo_info) %>%
leaflet::addProviderTiles("CartoDB.Positron") %>%
leaflet::addRectangles(
lng1 = west, lat1 = south,
lng2 = east, lat2 = north,
popup = name,
fillColor = "transparent"
)
if (editable=="true") {
mapview::mapshot(map,file="map.png")
}
mapview::mapshot(map, url = "map.html")
}


##' Render EML metadata into a webpage
##'
##' Pass in an xml file of EML metadata and generate a nice webpage describing
##' the dataset.
##'
##' @title Render EML
##' @param eml A valid Ecological Metadata Language file to be rendered to html.
##' @param open Whether to open the file in a browser. Defaults to TRUE.
##' @param publish_mode TRUE. If TRUE the website is pretty without warnings for weird stuff.
##' @param output_dir directory where will be stored the result file
##' @param encoding "" encoding of the EML file if necessary
##' @return HTML file containing dataset information
render_eml <- function(eml, open = FALSE,
publish_mode = TRUE, output_dir = "/docs",
encoding = "",editable) {
eml <- xml2::read_xml(eml, encoding = encoding)
if (editable=="true"){
style2 <- xml2::read_xml(paste0(path_temp,"/bootstrap2.xsl"))
html <- xslt::xml_xslt(eml, style2)
# make map
xml2::write_html(html, "DataPaper2.html")
rmarkdown::pandoc_convert("DataPaper2.html", output="DataPaper.docx", options =c("--standalone"))
file.copy("DataPaper.docx",".")
}
style <- xml2::read_xml(paste0(path_temp,"/bootstrap.xsl"))
html <- xslt::xml_xslt(eml, style)
# make map
map_geographical_coverage(eml)
xml2::write_html(html, "DataPaper.html")
}

#######################################################################################################
#exportation of Data Paper

render_eml(data,editable=edit)


83 changes: 83 additions & 0 deletions tools/metashrimps/DataPaper.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<tool id="metashrimp_datapaper" name="Production of a draft of Data Paper" version="0.1.0+galaxy0" profile="22.05">
<description>Create a draft of Data Paper from metadata</description>
<requirements>
<requirement type="package">r-base</requirement>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't remove version here.

What you can do is ... outside of Galaxy do:

conda create -n foo phantomjs pandoc gmp r-mapview .....

Then you get an ouput and you take the versions numbers from that output and add it here.

<requirement type="package">r-dplyr</requirement>
<requirement type="package">r-xml2</requirement>
<requirement type="package">r-xslt</requirement>
<requirement type="package">r-mapview</requirement>
<requirement type="package">r-leaflet</requirement>
<requirement type="package">gmp</requirement>
<requirement type="package" version="2.1.1">phantomjs</requirement>
<requirement type="package" version="2.19.2">pandoc</requirement>
<requirement type="package" version="2.23">r-rmarkdown</requirement>
<requirement type="package" version="0.2_18">r-codetools</requirement>
</requirements>
<command detect_errors="exit_code"><![CDATA[
Rscript
'$__tool_directory__/DataPaper.R'
'$__tool_directory__/template_emldown'
'$data'
'$editable'
]]></command>
<inputs>
<param name="data" type="data" format="xml" label="Upload metadata" help="Insert only metadata using EML standard"/>
<param name="editable" type="boolean" checked="false" label="Would you like to include a docx editable file instead of an HTML?" help= "HTML files are better for visualisation but are more difficult to edit than a docx."/>
</inputs>
<outputs>
<collection name="draft_html" type="list" label="Data Paper Draft">
<data name="DataPaper" from_work_dir="DataPaper.html" format="html" label="Data Paper"/>
<data name="map" from_work_dir="map.html" format="html" label="Leaflet Map"/>
</collection>
<collection name="draft_docx" type="list" label="Editable Data Paper Draft">
<data name="DataPaper" from_work_dir="DataPaper.docx" format="docx" label="Data Paper docx"/>
<data name="map" from_work_dir="map.png" format="png" label="Leaflet Map Image"/>
<filter>editable</filter>
</collection>
</outputs>
<tests>
<test expect_num_outputs="6">
<param name="data" value="Assessing_the_importance_of_field_margins_for_bat_species.xml"/>
<param name="editable" value="true"/>
<output_collection name="draft_html" type="list">
<element name="DataPaper" file="DataPaper.html" ftype="html" />
</output_collection>
<output_collection name="draft_docx" type="list">
<element name="DataPaper" file="DataPaper.docx" ftype="docx" />
<element name="map" file="map.png" ftype="png" />
</output_collection>
</test>
</tests>
<help><![CDATA[

.. class:: warningmark

'''TIP''' This tool requires metadata with **XML** format and using **EML** standard

**What it does?**
--------------------

This tool aims to produce, from a metadata using EML standard, a draft of Data Paper.
A Data Paper is an scientific publication describing the collect of data and thus highlighting the work of all data producers.
This Draft of Data Paper may be used to present your metadata in a more esthetetic and comprehensible way to others or can be modified and completed to help
the data producers redacting their publication.

**How to use it?**
--------------------

To use this tool, you have to upload a metadata written in XML and using EML standard.
You can then select whether you want an editable version of your Data Paper.
By clicking the **Execute** button, the work will launch and you will be able to get your results in the historic on your right.


]]></help>
<citations>
<citation type="bibtex">@misc{githubsurvey2023,
author = {ropensci-archive },
title = {{EMLdown}},
publisher = {Github},
url = {https://github.com/ropensci-archive/emldown}
}
}</citation>
</citations>
</tool>
Loading
Loading