changeset 0:ef1449a3f358 draft

planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 06283e92907321289efca757b97c46c3bd94a2ea-dirty
author ebi-gxa
date Sun, 20 Oct 2019 08:47:47 -0400
parents
children f62bc418173f
files sceasy_convert.xml sceasy_macros.xml
diffstat 2 files changed, 139 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sceasy_convert.xml	Sun Oct 20 08:47:47 2019 -0400
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tool id="sceasy_convert" name="SCEasy convert" version="@TOOL_VERSION@+galaxy0">
+  <description>a data object between formats</description>
+  <macros>
+    <import>sceasy_macros.xml</import>
+  </macros>
+  <expand macro="requirements"/>
+  <command detect_errors="exit_code"><![CDATA[
+#if str($conversion['direction']).startswith("loom")
+    ln -s ${conversion.input_object_file} input.loom &&
+#else if str($conversion['direction']).startswith("anndata")
+    ln -s ${conversion.input_object_file} input.h5ad &&
+#else
+    ln -s ${conversion.input_object_file} input.rds &&
+#end if
+
+    Rscript -e 'library(sceasy)'
+#if $conversion.direction == "loom2sce"
+            -e 'sce <- sceasy::convertFormat("input.loom", from="loom", to="sce", main_layer_name="${assay_name}")'
+            -e 'saveRDS(sce, "output.rds")'
+            -e 'print(sce)'
+#else if $conversion.direction == "sce2loom"
+            -e 'sce <- readRDS("input.rds")'
+            -e 'sceasy::convertFormat(sce, outFile="output.loom", from="sce", to="loom", main_layer="${assay}")'
+#else if $conversion.direction == "sce2anndata"
+            -e 'sce <- readRDS("input.rds")'
+            -e 'sceasy::convertFormat(sce, outFile="output.h5ad", from="sce", to="anndata", main_layer="${assay}")'
+            -e 'print(sce)'
+#else if $conversion.direction == "seurat2anndata"
+            -e 'srt <- readRDS("input.rds")'
+            -e 'sceasy::convertFormat(srt, outFile="output.h5ad", from="seurat", to="anndata", assay="${assay}", main_layer="${dtype}")'
+            -e 'print(srt)'
+#end if
+]]></command>
+
+  <inputs>
+    <conditional name="conversion">
+      <param name="direction" type="select" label="Direction of conversion">
+        <option value="loom2sce" selected="true">Loom to SingleCellExperiment</option>
+        <option value="sce2loom">SingleCellExperiment to Loom</option>
+        <option value="seurat2anndata">Seurat to AnnData</option>
+        <option value="sce2anndata">SingleCellExperiment to AnnData</option>
+      </param>
+      <when value="loom2sce">
+        <param name="input_object_file" type="data" format="h5" label="Input object in Loom format"/>
+        <param name="assay_name" type="text" label="Name of the expression matrix to be transferred as">
+          <option value="counts" selected="true">counts</option>
+          <option value="logcounts">logcounts</option>
+          <option value="cpm">cpm</option>
+        </param>
+      </when>
+      <when value="sce2loom">
+        <param name="input_object_file" type="data" format="rdata" label="Input object in SingleCellExperiment RDS format"/>
+        <param name="assay" type="text" label="Name of the assay to be transferred as main layer" help="Please make sure the assay exists">
+          <option value="counts" selected="true">counts</option>
+          <option value="logcounts">logcounts</option>
+          <option value="cpm">cpm</option>
+        </param>
+      </when>
+      <when value="sce2anndata">
+        <param name="input_object_file" type="data" format="rdata" label="Input object in SingleCellExperiment RDS format"/>
+        <param name="assay" type="text" label="Name of the assay to be transferred as main layer" help="Please make sure the assay exists">
+          <option value="counts" selected="true">counts</option>
+          <option value="logcounts">logcounts</option>
+          <option value="cpm">cpm</option>
+        </param>
+      </when>
+      <when value="seurat2anndata">
+        <param name="input_object_file" type="data" format="rdata" label="Input object in Seurat RDS format"/>
+        <param name="assay" type="text" value="RNA" label="Name of the assay to be transferred" help="Please make sure the assay exists"/>
+        <param name="dtype" type="select" value="RNA" label="Data type of the assay to be transferred" help="Please make sure the data type exists">
+          <option value="data" selected="true">data</option>
+          <option value="counts">counts</option>
+          <option value="scale.data">scale.data</option>
+        </param>
+      </when>
+    </conditional>
+  </inputs>
+
+  <outputs>
+    <data name="output_sce" format="rdata" from_work_dir="output.rds" label="${tool.name} on ${on_string}: SingleCellExperiment">
+      <filter>conversion['direction'].endswith('sce')</filter>
+    </data>
+    <data name="output_loom" format="h5" from_work_dir="output.loom" label="${tool.name} on ${on_string}: Loom">
+      <filter>conversion['direction'].endswith('loom')</filter>
+    </data>
+    <data name="output_anndata" format="h5" from_work_dir="output.h5ad" label="${tool.name} on ${on_string}: AnnData">
+      <filter>conversion['direction'].endswith('anndata')</filter>
+    </data>
+  </outputs>
+
+  <tests>
+    <test>
+      <param name="direction" value="loom2sce"/>
+      <param name="input_object_file" value="input.loom"/>
+      <output name="output_sce" file="output.rds" ftype="rdata" compare="sim_size"/>
+    </test>
+  </tests>
+
+  <help><![CDATA[
+===================================================================
+Convert scRNA data object between formats `sceasy::convertFormat()`
+===================================================================
+
+Support the following conversion:
+ * Loom <-> SingleCellExperiment (full)
+ * SingleCellExperiment -> AnnData (matrix, metadata, reducedDim)
+ * Seurat -> AnnData (matrix, metadata, reducedDim)
+
+@HELP@
+
+@VERSION_HISTORY@
+]]></help>
+  <expand macro="citations"/>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sceasy_macros.xml	Sun Oct 20 08:47:47 2019 -0400
@@ -0,0 +1,24 @@
+<macros>
+  <token name="@TOOL_VERSION@">0.0.5</token>
+  <token name="@HELP@">More information can be found at https://github.com/cellgeni/sceasy</token>
+  <token name="@VERSION_HISTORY@"><![CDATA[
+**Version history**
+
+0.0.1+galaxy0: Initial version based on sceasy 0.0.5 by Ni Huang, WTSI.
+    ]]></token>
+
+  <xml name="requirements">
+    <requirements>
+      <requirement type="package" version="0.0.5">r-sceasy</requirement>
+      <yield/>
+    </requirements>
+  </xml>
+
+  <xml name="citations">
+    <citations>
+      <yield />
+      <!-- <citation type="doi"> </citation> -->
+      <!-- <citation type="bibtex"> </citation> -->
+    </citations>
+  </xml>
+</macros>