Mercurial > repos > enis > rstudio_bioconductor_it
changeset 0:8661342f187e draft default tip
planemo upload commit 95e3d6f42b65d4aad0ebe5a027797e3cbf62400c
author | enis |
---|---|
date | Thu, 29 May 2025 14:27:36 +0000 |
parents | |
children | |
files | Rprofile.R bioconductor.png rstudio_bioconductor_it.xml |
diffstat | 3 files changed, 148 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Rprofile.R Thu May 29 14:27:36 2025 +0000 @@ -0,0 +1,5 @@ +library("GalaxyConnector") +options(encoding = "UTF-8") +if (interactive()) { + message("\n Welcome to the Galaxy RStudio with Bioconductor Interactive Tool.\n\n Any datasets that you included when starting RStudio are available in ~/galaxy_inputs directory. Any files you place in ~/galaxy_outputs will be available in Galaxy once you stop RStudio. You can use the convenience functions gx_put(), gx_get(), and gx_save() to fetch and place data to your current Galaxy history on demand.\n\n gx_get(42) - Fetch dataset 42 from your Galaxy history. The file will be available in ~/galaxy_imports folder\n gx_put('filename') - Push a dataset to Galaxy\n gx_save() - Save .RHistory, .RData to your Galaxy environment\n\nA number of packages are pre-installed, which you can inspect with the 'installed.packages()' command. To install new packages, you can use the BiocManager package. For example, to install the treeio package, you can use the following command to install it and load it:\n\n BiocManager::install(\"treeio\")\n library(treeio) # Load the treeio package after installation\n") +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rstudio_bioconductor_it.xml Thu May 29 14:27:36 2025 +0000 @@ -0,0 +1,143 @@ + +<tool id="rstudio_bioconductor_it" tool_type="interactive" name="RStudio" version="4.5.0+3.21" profile="22.01"> + <icon src="bioconductor.png" /> + <description>R 4.5.0 with Bioconductor 3.21</description> + <requirements> + <container type="docker">bioconductor/galaxy-rstudio:RELEASE_3_21</container> + </requirements> + <entry_points> + <entry_point name="RStudio" requires_domain="False" requires_path_in_header_named="X-RStudio-Root-Path"> + <port>8787</port> + <url>/</url> + </entry_point> + </entry_points> + <environment_variables> + <environment_variable name="HISTORY_ID" strip="True">${__app__.security.encode_id($rstudio.history_id)}</environment_variable> <!-- FIXME: Warning: The use of __app__ is deprecated and will break backward compatibility in the near future --> + <environment_variable name="GALAXY_WEB_PORT">8080</environment_variable> + <environment_variable name="GALAXY_URL">$__galaxy_url__</environment_variable> + <environment_variable name="DEBUG">true</environment_variable> + <environment_variable name="DISABLE_AUTH">true</environment_variable> + <environment_variable name="API_KEY" inject="api_key" /> + </environment_variables> + <inputs> + <param name="input" multiple="true" type="data" format="data" optional="true" label="Include data into the environment"/> + </inputs> + <command><![CDATA[ + #import re + echo "[`date`] - Setting up for RStudio as \$(id)." && + ## Match the container user id to the host user/group id if supplied + if [ -n "\$USERID" ]; then + echo "[`date`] - Setting user id to \$USERID." && + usermod -u "\$USERID" rstudio; + fi && + if [ -n "\$GROUPID" ]; then + echo "[`date`] - Setting user group to \$GROUPID." && + groupmod -g "\$GROUPID" rstudio; + fi && + + ## This is where GalaxyConnector places files copied from Galaxy + mkdir -p /import && + chown rstudio:rstudio /import && + ln -s "/import" /home/rstudio/galaxy_imports && + mkdir -p ./rstudio_outputs && chown rstudio:rstudio ./rstudio_outputs && ln -s "\$PWD/rstudio_outputs" /home/rstudio/galaxy_outputs && + + echo "[`date`] - Creating Rprofile" && + cp '$__tool_directory__/Rprofile.R' /home/rstudio/.Rprofile && + + ## Required because of the above usermod command, but before linking the input files + chown -R rstudio:rstudio /home/rstudio/ && + chown -R rstudio:rstudio /usr/local/lib/R/library && + chown -R rstudio:rstudio /usr/local/lib/R/doc && + + #if $input: + echo "[`date`] - Linking input files to '/home/rstudio/galaxy_inputs/'" && + mkdir -p /home/rstudio/galaxy_inputs/ && + #for $count, $file in enumerate($input): + #set $cleaned_name = str($count + 1) + '_' + re.sub('[^\w\-\.\s]', '_', str($file.element_identifier)) + echo "[`date`] - Linking '$file' to '/home/rstudio/galaxy_inputs/${cleaned_name}.${file.ext}'" && + ln -sf '$file' '/home/rstudio/galaxy_inputs/${cleaned_name}.${file.ext}' && + #end for + #else + echo "[`date`] - No input files provided, skipping file linking step." && + #end if + + echo "[`date`] - Starting container processes, including RStudio..." && + /init + ]]> + </command> + <outputs> + <data name="rstudio" format="txt" label="RStudio Interactive Tool"></data> + <collection name="output_collection" type="list" label="RStudio outputs"> + <discover_datasets pattern="__name_and_ext__" directory="rstudio_outputs/" assign_primary_output="true" recurse="true"/> + </collection> + </outputs> + <stdio> + <exit_code range="129" level="log" description="User shut down the container." /> + </stdio> + <tests> + <test expect_num_outputs="1"> + <param name="mode" value="previous" /> + <param name="rstudio" value="test.txt" /> + <param name="run_it" value="true" /> + <output name="rstudio" file="test.txt" ftype="txt"/> + </test> + </tests> + <help><![CDATA[ +The RStudio Interactive Tool in Galaxy provides a user-friendly interface +for conducting statistical analysis, visualization, and scripting using the +R programming language. This tool is ideal for bioinformatics workflows +involving data exploration, statistical modeling, and custom script +development within the Galaxy ecosystem. + +Use Cases +--------- +- Exploratory data analysis +- Custom script development +- Genomic and transcriptomic data visualization +- Statistical modeling and hypothesis testing + +Galaxy Integration Functions +---------------------------- + +To facilitate seamless data transfer between RStudio and Galaxy, the +following built-in functions are available: + +Before launching the tool, you can select datasets from your history to include +in the RStudio environment. This allows you to work with your data directly +within RStudio without needing to manually transfer files. All files will be +located in the `~/galaxy_inputs/` directory. Note that files +mapped from a Galaxy history into RStudio like this are read only. + +Any files that you store in the `~/galaxy_outputs/` directory will be +automatically transferred back to Galaxy when you finish your session and stop +the RStudio Interactive Tool. + +In addition, you can use the following functions within your R session to +facilitate interactive data transfer. All imported files will be located in the +`~/galaxy_imports` directory. + +**gx_get(history_dataset_number)** – Loads a dataset from your +Galaxy history into the R environment. Example: + +.. code-block:: r + + gx_get(1) + df <- read.csv("~/galaxy_imports/1") + head(df) + +**gx_put("file_name", ["file_type"])** – Saves an R object as a +new dataset in your Galaxy history. Example: + +.. code-block:: r + + gx_put("/home/rstudio/output.csv") + +**gx_save("session_name")** – Saves your R script to Galaxy for +reproducibility. Example: + +.. code-block:: r + + gx_save("analysis_script.R") + + ]]></help> +</tool>