Repository 'scanpy_run_tsne'
hg clone https://toolshed.g2.bx.psu.edu/repos/ebi-gxa/scanpy_run_tsne

Changeset 15:b5e1939cc155 (2020-09-17)
Previous changeset 14:c4a20a57d825 (2020-09-11) Next changeset 16:9d2b6c6f9e07 (2020-09-29)
Commit message:
"planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/tree/develop/tools/tertiary-analysis/scanpy commit e572b5425460d57f1bd13ab6374674c1c6801ab3-dirty"
modified:
scanpy-run-tsne.xml
b
diff -r c4a20a57d825 -r b5e1939cc155 scanpy-run-tsne.xml
--- a/scanpy-run-tsne.xml Fri Sep 11 11:05:07 2020 +0000
+++ b/scanpy-run-tsne.xml Thu Sep 17 16:28:31 2020 +0000
[
@@ -1,27 +1,37 @@
 <?xml version="1.0" encoding="utf-8"?>
-<tool id="scanpy_run_tsne" name="Scanpy RunTSNE" version="@TOOL_VERSION@+galaxy0" profile="@PROFILE@">
+<tool id="scanpy_run_tsne" name="Scanpy RunTSNE" version="@TOOL_VERSION@+galaxy1" profile="@PROFILE@">
   <description>visualise cell clusters using tSNE</description>
   <macros>
     <import>scanpy_macros2.xml</import>
   </macros>
   <expand macro="requirements"/>
   <command detect_errors="exit_code"><![CDATA[
+#from pathlib import Path
+#set embeddings_tsv='embeddings.tsv'
 ln -s '${input_obj_file}' input.h5 &&
 PYTHONIOENCODING=utf-8 scanpy-run-tsne
 #if $use_rep != "auto"
     --use-rep '${use_rep}'
 #end if
-#if $key_added
-    --key-added '${key_added}'
-#end if
 #if $embeddings
     --export-embedding embeddings.tsv
 #end if
 #if $settings.default == "false"
     #if $settings.perplexity_file
-        --perplexity \$( cat $settings.perplexity_file )
-    #else
-        --perplexity '${settings.perplexity}'
+        #set perplexity = Path($settings.perplexity_file.__str__).read_text().strip()
+    #elif $settings.perplexity
+        #set perplexity = $settings.perplexity.__str__.strip()
+    #end if      
+    #if $perplexity
+        --perplexity '$perplexity'
+    #end if
+    #if $settings.key_added
+        #set key_added = $settings.key_added
+        #if $perplexity
+            #set key_added = $key_added.replace('PERPLEXITY', $perplexity.__str__)
+        #end if
+        --key-added '${key_added}'
+        #set embeddings_tsv="embeddings_" + $key_added.__str__ + ".tsv"    
     #end if
     --early-exaggeration '${settings.early_exaggeration}'
     --learning-rate '${settings.learning_rate}'
@@ -40,6 +50,11 @@
 #end if
     @INPUT_OPTS@
     @OUTPUT_OPTS@
+#if $embeddings
+    #if $embeddings_tsv != 'embeddings.tsv'
+        && mv '${embeddings_tsv}' embeddings.tsv
+    #end if
+#end if
 
 ]]></command>
 
@@ -53,13 +68,12 @@
       <option value="X">X, use normalised expression values</option>
       <option value="auto" selected="true">Automatically chosen based on problem size</option>
     </param>
-    <param name="key_added" argument="--key-added" type="text" optional="true"
-           label="Additional suffix to the name of the slot to save the embedding"/>
-
     <conditional name="settings">
       <param name="default" type="boolean" checked="true" label="Use programme defaults"/>
       <when value="true"/>
       <when value="false">
+        <param name="key_added" argument="--key-added" type="text" optional="true"
+               label="Additional suffix to the name of the slot to save the embedding" help="If included, PERPLEXITY will be substituted with the value of the perplexity setting."/>
         <param name="perplexity" argument="--perplexity" type="float" value="30" label="The perplexity is related to the number of nearest neighbours, select a value between 5 and 50"/>
         <param name="perplexity_file" argument="--perplexity" type="data" format="txt,tsv" label="The perplexity is related to the number of nearest neighbours" help="For use with the parameter iterator. Overrides the persplexity option above" optional="true"/>
         <param name="early_exaggeration" argument="--early-exaggeration" type="float" value="12" label="Controls the tightness within and between clusters"/>