Mercurial > repos > iuc > anndata_import
comparison import.xml @ 15:bfac01f0393b draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/anndata/ commit 08ce25c9b0ae236d3c0c352119de9db6b56c2925
| author | iuc |
|---|---|
| date | Sat, 29 Mar 2025 07:35:15 +0000 |
| parents | 47ecd3ed0564 |
| children |
comparison
equal
deleted
inserted
replaced
| 14:b08778769c73 | 15:bfac01f0393b |
|---|---|
| 1 <tool id="anndata_import" name="Import Anndata" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@"> | 1 <tool id="anndata_import" name="Import Anndata" version="@TOOL_VERSION@+galaxy2" profile="@PROFILE@"> |
| 2 <description>from different formats</description> | 2 <description>from different formats</description> |
| 3 <macros> | 3 <macros> |
| 4 <import>macros.xml</import> | 4 <import>macros.xml</import> |
| 5 <xml name="params_10x"> | 5 <xml name="params_10x"> |
| 6 <param name="barcodes" type="data" format="tabular,txt" label="Barcodes (whitelist) file with one barcode per line"/> | 6 <param name="barcodes" type="data" format="tabular,txt" label="Barcodes (whitelist) file with one barcode per line"/> |
| 83 gex_only=$in.tenx.gex_only) | 83 gex_only=$in.tenx.gex_only) |
| 84 #end if | 84 #end if |
| 85 | 85 |
| 86 #else if $in.adata_format == 'umi_tools' | 86 #else if $in.adata_format == 'umi_tools' |
| 87 adata = ad.read_umi_tools('umi_tools_input.gz') | 87 adata = ad.read_umi_tools('umi_tools_input.gz') |
| 88 | |
| 89 #else if $in.adata_format == 'custom' | |
| 90 import pandas as pd | |
| 91 | |
| 92 adata = ad.read_mtx(filename='$in.mtx') | |
| 93 adata = adata.transpose().copy() | |
| 94 | |
| 95 obs = pd.read_csv('$in.obs', sep='\t', index_col=0) | |
| 96 var = pd.read_csv('$in.var', sep='\t', index_col=0) | |
| 97 | |
| 98 if adata.shape[0] != obs.shape[0]: | |
| 99 raise ValueError(f"Mismatch: adata has {adata.shape[0]} cells, but obs has {obs.shape[0]} rows.") | |
| 100 | |
| 101 if adata.shape[1] != var.shape[0]: | |
| 102 raise ValueError(f"Mismatch: adata has {adata.shape[1]} genes, but var has {var.shape[0]} rows.") | |
| 103 | |
| 104 | |
| 105 adata.obs = obs | |
| 106 adata.var = var | |
| 107 | |
| 88 #end if | 108 #end if |
| 89 adata.write('anndata.h5ad', compression='gzip') | 109 adata.write('anndata.h5ad', compression='gzip') |
| 90 print(adata) | 110 print(adata) |
| 91 ]]></configfile> | 111 ]]></configfile> |
| 92 </configfiles> | 112 </configfiles> |
| 96 <option value="loom">Loom data</option> | 116 <option value="loom">Loom data</option> |
| 97 <option value="tabular">Tabular, CSV, TSV</option> | 117 <option value="tabular">Tabular, CSV, TSV</option> |
| 98 <option value="10x_h5">H5 format from Cell ranger or not</option> | 118 <option value="10x_h5">H5 format from Cell ranger or not</option> |
| 99 <option value="mtx">Matrix Market (mtx), from Cell ranger or not</option> | 119 <option value="mtx">Matrix Market (mtx), from Cell ranger or not</option> |
| 100 <option value="umi_tools">UMI tools count matrix</option> | 120 <option value="umi_tools">UMI tools count matrix</option> |
| 121 <option value="custom">custom (with annotated cells and genes tables)</option> | |
| 101 </param> | 122 </param> |
| 102 <when value="loom"> | 123 <when value="loom"> |
| 103 <param name="input" type="data" format="loom" label="Annotated data matrix"/> | 124 <param name="input" type="data" format="loom" label="Annotated data matrix"/> |
| 104 <param name="sparse" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Is the data matrix to read sparse?"/> | 125 <param name="sparse" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Is the data matrix to read sparse?"/> |
| 105 <param name="cleanup" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Cleanup?"/> | 126 <param name="cleanup" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Cleanup?"/> |
| 134 </conditional> | 155 </conditional> |
| 135 </when> | 156 </when> |
| 136 <when value="umi_tools"> | 157 <when value="umi_tools"> |
| 137 <param name="input" type="data" format="tabular" label="condensed count matrix from UMI tools"/> | 158 <param name="input" type="data" format="tabular" label="condensed count matrix from UMI tools"/> |
| 138 </when> | 159 </when> |
| 160 <when value="custom"> | |
| 161 <param name="mtx" type="data" format="mtx" label="Matrix in Matrix Market format"/> | |
| 162 <param name="obs" type="data" format="tabular,tabular.gz" label="Annotated cells (first column will be obs_index)"/> | |
| 163 <param name="var" type="data" format="tabular,tabular.gz" label="Annotated genes (first column will be var_index)"/> | |
| 164 </when> | |
| 139 </conditional> | 165 </conditional> |
| 140 </inputs> | 166 </inputs> |
| 141 <outputs> | 167 <outputs> |
| 142 <data name="anndata" format="h5ad" from_work_dir="anndata.h5ad" label="Anndata import on ${on_string}"/> | 168 <data name="anndata" format="h5ad" from_work_dir="anndata.h5ad" label="Anndata import on ${on_string}"/> |
| 143 </outputs> | 169 </outputs> |
| 271 <has_text text="ENSG00000258728" /> | 297 <has_text text="ENSG00000258728" /> |
| 272 <has_text text="GCGAGAAAGTTGTAGA" /> | 298 <has_text text="GCGAGAAAGTTGTAGA" /> |
| 273 </assert_contents> | 299 </assert_contents> |
| 274 </output> | 300 </output> |
| 275 </test> | 301 </test> |
| 302 <test expect_num_outputs="1"> | |
| 303 <conditional name="in"> | |
| 304 <param name="adata_format" value="custom"/> | |
| 305 <param name="mtx" value="trimmed_matrix.mtx"/> | |
| 306 <param name="obs" value="trimmed_barcode.tabular"/> | |
| 307 <param name="var" value="trimmed_gene.tabular"/> | |
| 308 </conditional> | |
| 309 <assert_stdout> | |
| 310 <has_text_matching expression="1000 × 500"/> | |
| 311 </assert_stdout> | |
| 312 <output name="anndata" ftype="h5ad"> | |
| 313 <assert_contents> | |
| 314 <has_h5_keys keys="var/symbol,var/mito"/> | |
| 315 </assert_contents> | |
| 316 </output> | |
| 317 </test> | |
| 276 </tests> | 318 </tests> |
| 277 <help><