Repository 'sceasy_convert'
hg clone https://toolshed.g2.bx.psu.edu/repos/iuc/sceasy_convert

Changeset 0:d70139524747 (2023-11-10)
Next changeset 1:2062be7efc84 (2023-12-12)
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sceasy/ commit e83761e8057df5ce516fc6681636435078c81534
added:
sceasy.xml
static/images/conv.png
test-data/ad2cds.rds
test-data/ad2seurat.rds
test-data/loom2anndata.h5ad
test-data/loom2sce.rds
test-data/sce2anndata.h5ad
test-data/sce2loom.rds
test-data/test_anndata.h5ad
test-data/test_sce.rds
test-data/test_seurat.rds
b
diff -r 000000000000 -r d70139524747 sceasy.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sceasy.xml Fri Nov 10 20:24:21 2023 +0000
[
b'@@ -0,0 +1,224 @@\n+<tool id="sceasy_convert" name="SCEasy Converter" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="22.05">\n+    <description>\n+        Convert between common single cell formats\n+    </description>\n+    <macros>\n+        <token name="@TOOL_VERSION@">0.0.7</token>\n+        <token name="@VERSION_SUFFIX@">1</token>\n+        <macro name="mac_input_form" token_format="@FORMAT@" >\n+            <param name="input_object_file" type="data" format="@FORMAT@" label="Input object in @FORMAT@ format"/>\n+        </macro>\n+    </macros>\n+    <requirements>\n+        <requirement type="package" version="0.0.7">r-sceasy</requirement>\n+        <requirement type="package" version="3.0.6" >loompy</requirement>\n+        <requirement type="package" version="0.10.0" >anndata</requirement>\n+        <requirement type="package" version="3.10" >python</requirement>\n+        <requirement type="package" version="0.7.5.4" >r-anndata</requirement>\n+        <requirement type="package" version="1.32.0" >r-reticulate</requirement>\n+    </requirements>\n+    <command detect_errors="exit_code">\n+            Rscript \'$script_file\'\n+    </command>\n+    <configfiles>\n+        <configfile name="script_file"><![CDATA[\n+direction=\'$conversion.direction\'\n+tokens = unlist(strsplit(direction, split="2"))\n+format.from = tokens[1]\n+format.to = tokens[2]\n+\n+library(sceasy)\n+library(reticulate)\n+\n+## HACK: CI biocontainers do not contain a useable conda binary, just the env.\n+##  see: https://github.com/galaxyproject/tools-iuc/issues/5585#issuecomment-1803773923\n+is_biocontainer = grepl("^# cmd: /opt/conda/bin/",\n+                        paste0(reticulate:::python_info_condaenv_find("/usr/local/"),\n+                               "-none"))\n+if (is_biocontainer) {\n+   ## conda detection false positive\n+   assignInNamespace("is_conda_python", function(x) FALSE, ns="reticulate")\n+   use_python("/usr/local/bin/python")\n+} else {\n+   conda_path = Sys.getenv("CONDA_PREFIX")\n+   if (conda_path != "") {\n+      ## Active conda env found\n+      use_python(file.path(conda_path, "bin", "python3"))\n+   } else {\n+      ## Not biocontainer or conda, assume system python\n+      use_python("/usr/bin/python3")\n+   }\n+}\n+loompy = reticulate::import(\'loompy\')\n+infile = \'$input_object_file\'\n+\n+outfile_ext_map=list(\n+    "anndata" = "h5ad",\n+    "seurat" = "rds",\n+    "sce" = "rds",\n+    "cds" = "rds",\n+    "loom" = "loom") ## this has to be a .loom ending for the export to work.\n+\n+outfile = paste0("outfile.", outfile_ext_map[format.to])\n+\n+\n+## IDIOSYNCRACIES:\n+## Some input formats need be loaded first and then converted,\n+## and other formats need to be specified as filenames only,\n+## and even then as formats with specific extensions,\n+## and some formats need to be objects, or stripped down objects,\n+## and probably more issues will be discovered in time.\n+\n+do_infile_as_first_arg = as.logical(direction == "loom2sce")\n+do_filename_as_first_arg = as.logical(direction %in% c("anndata2cds", "anndata2seurat", "loom2anndata"))\n+do_dietseurat_in_first_arg = as.logical(direction == "seurat2sce")\n+\n+if (do_infile_as_first_arg) {\n+   if (format.from == "loom") {\n+      ## LoomExperiment::import only correctly imports when ext is set\n+      loom_file = tempfile(tmpdir="/tmp", fileext=".loom")\n+      file.copy(from=infile, to=loom_file)  ## rename doesn\'t work in containers\n+      infile = loom_file\n+   }\n+   convertFormat(inFile = infile, from = format.from, to = format.to, outFile = outfile)\n+} else if (do_filename_as_first_arg) {\n+   convertFormat(infile, from = format.from, to = format.to, outFile = outfile)\n+} else {\n+   ## We need to physically load the object (either Seurat or SCE, both which should be\n+   ## of RDS input type)\n+   rds = readRDS(infile)\n+\n+   if (do_dietseurat_in_first_arg){\n+      library(Seurat)\n+      rds = DietSeurat(rds)\n+   }\n+   convertFormat(rds, from = format.from, to = format.to, outFile = outfile)\n+}\n+\n+        ]]></configfile>\n+    </config'..b'" token_format="rds" />\n+            </when>\n+        </conditional>\n+    </inputs>\n+    <outputs>\n+        <data name="output_sce" format="rdata" from_work_dir="outfile.rds" label="${tool.name} on ${on_string}: SingleCellExperiment">\n+            <filter>\n+                conversion[\'direction\'].endswith(\'sce\')\n+            </filter>\n+        </data>\n+        <data name="output_cds" format="rdata" from_work_dir="outfile.rds" label="${tool.name} on ${on_string}: CellDataSet">\n+            <filter>\n+                conversion[\'direction\'].endswith(\'cds\')\n+            </filter>\n+        </data>\n+        <data name="output_loom" format="h5" from_work_dir="outfile.loom" label="${tool.name} on ${on_string}: Loom">\n+            <filter>\n+                conversion[\'direction\'].endswith(\'loom\')\n+            </filter>\n+        </data>\n+        <data name="output_anndata" format="h5" from_work_dir="outfile.h5ad" label="${tool.name} on ${on_string}: AnnData">\n+            <filter>\n+                conversion[\'direction\'].endswith(\'anndata\')\n+            </filter>\n+        </data>\n+        <data name="output_seurat" format="rdata" from_work_dir="outfile.rds" label="${tool.name} on ${on_string}: Seurat">\n+            <filter>\n+                conversion[\'direction\'].endswith(\'seurat\')\n+            </filter>\n+        </data>\n+    </outputs>\n+    <tests>\n+        <test expect_num_outputs="1">\n+            <param name="direction" value="anndata2cds"/>\n+            <param name="input_object_file" value="test_anndata.h5ad"/>\n+            <output name="output_cds" file="ad2cds.rds" ftype="rdata" compare="sim_size"/>\n+        </test>\n+        <test expect_num_outputs="1">\n+            <param name="direction" value="anndata2seurat"/>\n+            <param name="input_object_file" value="test_anndata.h5ad"/>\n+            <output name="output_seurat" file="ad2seurat.rds" ftype="rdata" compare="sim_size"/>\n+        </test>\n+        <test expect_num_outputs="1">\n+            <param name="direction" value="loom2anndata"/>\n+            <param name="input_object_file" value="sce2loom.rds"/>\n+            <output name="output_anndata" file="loom2anndata.h5ad" ftype="h5" compare="sim_size"/>\n+        </test>\n+        <test expect_num_outputs="1">\n+            <param name="direction" value="loom2sce"/>\n+            <param name="input_object_file" value="sce2loom.rds"/>\n+            <output name="output_sce" file="loom2sce.rds" ftype="rdata" compare="sim_size"/>\n+        </test>\n+        <test expect_num_outputs="1">\n+            <param name="direction" value="sce2anndata"/>\n+            <param name="input_object_file" value="test_sce.rds"/>\n+            <output name="output_anndata" file="sce2anndata.h5ad" ftype="h5" compare="sim_size"/>\n+        </test>\n+        <test expect_num_outputs="1">\n+            <param name="direction" value="sce2loom"/>\n+            <param name="input_object_file" value="test_sce.rds"/>\n+            <output name="output_loom" file="sce2loom.rds" ftype="h5" compare="sim_size"/>\n+        </test>\n+        <test expect_num_outputs="1">\n+            <param name="direction" value="seurat2anndata"/>\n+            <param name="input_object_file" value="test_seurat.rds"/>\n+            <output name="output_seurat" file="test_anndata.h5ad" ftype="h5" compare="sim_size"/>\n+        </test>\n+        <test expect_num_outputs="1">\n+            <param name="direction" value="seurat2sce"/>\n+            <param name="input_object_file" value="test_seurat.rds"/>\n+            <output name="output_sce" file="test_sce.rds" ftype="rdata" compare="sim_size"/>\n+        </test>\n+    </tests>\n+    <help>\n+SCeasy\n+======\n+\n+        Convert scRNA data object between formats `sceasy::convertFormat()`\n+\n+Supports the following conversion:\n+\n+.. image:: $PATH_TO_IMAGES/conv.png\n+\t:width: 80 %\n+\t:align: center\n+\n+\n+    </help>\n+    <citations>\n+        <citation type="doi"> doi:10.1093/nargab/lqaa052</citation>\n+    </citations>\n+</tool>\n\\ No newline at end of file\n'
b
diff -r 000000000000 -r d70139524747 static/images/conv.png
b
Binary file static/images/conv.png has changed
b
diff -r 000000000000 -r d70139524747 test-data/ad2cds.rds
b
Binary file test-data/ad2cds.rds has changed
b
diff -r 000000000000 -r d70139524747 test-data/ad2seurat.rds
b
Binary file test-data/ad2seurat.rds has changed
b
diff -r 000000000000 -r d70139524747 test-data/loom2anndata.h5ad
b
Binary file test-data/loom2anndata.h5ad has changed
b
diff -r 000000000000 -r d70139524747 test-data/loom2sce.rds
b
Binary file test-data/loom2sce.rds has changed
b
diff -r 000000000000 -r d70139524747 test-data/sce2anndata.h5ad
b
Binary file test-data/sce2anndata.h5ad has changed
b
diff -r 000000000000 -r d70139524747 test-data/sce2loom.rds
b
Binary file test-data/sce2loom.rds has changed
b
diff -r 000000000000 -r d70139524747 test-data/test_anndata.h5ad
b
Binary file test-data/test_anndata.h5ad has changed
b
diff -r 000000000000 -r d70139524747 test-data/test_sce.rds
b
Binary file test-data/test_sce.rds has changed
b
diff -r 000000000000 -r d70139524747 test-data/test_seurat.rds
b
Binary file test-data/test_seurat.rds has changed