Mercurial > repos > iuc > mudata_import_export
comparison mudata_import_export.xml @ 0:f5672da27c4b draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/muon commit fef10e0d450018d1e6ba4cbbda76c7686edc8aae
| author | iuc |
|---|---|
| date | Sat, 25 Oct 2025 21:00:32 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:f5672da27c4b |
|---|---|
| 1 <tool id="mudata_import_export" name="MuData import and export" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@"> | |
| 2 <macros> | |
| 3 <import>macros.xml</import> | |
| 4 </macros> | |
| 5 <expand macro="bio_tools"/> | |
| 6 <expand macro="requirements"/> | |
| 7 <expand macro="version_command"/> | |
| 8 <command detect_errors="exit_code"><![CDATA[ | |
| 9 @CMD@ | |
| 10 ]]></command> | |
| 11 <configfiles> | |
| 12 <configfile name="script_file"><![CDATA[ | |
| 13 @CMD_imports@ | |
| 14 #if $operation.mode == 'import' | |
| 15 import anndata as ad | |
| 16 | |
| 17 mdata = mu.MuData({ | |
| 18 #for $modality in $operation.modalities | |
| 19 '$modality.name': ad.read_h5ad('$modality.anndata'), | |
| 20 #end for | |
| 21 }) | |
| 22 #if $make_unique | |
| 23 mdata.var_names_make_unique() | |
| 24 #end if | |
| 25 mdata.write_h5mu('mudata.h5mu') | |
| 26 | |
| 27 #else if $operation.mode == 'export' | |
| 28 mdata = mu.read_h5mu('$operation.mudata_in') | |
| 29 for mod in mdata.mod: | |
| 30 mdata[mod].write_h5ad(mod + '.h5ad') | |
| 31 | |
| 32 #end if | |
| 33 | |
| 34 ]]></configfile> | |
| 35 </configfiles> | |
| 36 <inputs> | |
| 37 <conditional name="operation"> | |
| 38 <param name="mode" type="select" label="Mode of operation"> | |
| 39 <option value="import" selected="true">Import multiple Anndata objects into a MuData object</option> | |
| 40 <option value="export">Export Anndata objects from a MuData objects</option> | |
| 41 </param> | |
| 42 <when value="import"> | |
| 43 <repeat name="modalities" title="Modalities" min="2" default="2"> | |
| 44 <param name="name" type="text" label="Modality name" value="" | |
| 45 help="Name to give for the modality in the MuData object"> | |
| 46 <expand macro="sanitize_string" /> | |
| 47 </param> | |
| 48 <param name="anndata" type="data" format="h5ad" label="Anndata object for the modality"/> | |
| 49 </repeat> | |
| 50 <param name="make_unique" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Make variable names unique?"/> | |
| 51 </when> | |
| 52 <when value="export"> | |
| 53 <param name="mudata_in" type="data" format="h5ad" label="Multimodal MuData object"/> | |
| 54 </when> | |
| 55 </conditional> | |
| 56 <expand macro="inputs_common_advanced" /> | |
| 57 </inputs> | |
| 58 <outputs> | |
| 59 <data name="mudata_out" format="h5ad" from_work_dir="mudata.h5mu" label="MuData object built from ${on_string}"> | |
| 60 <filter>operation['mode'] == 'import' </filter> | |
| 61 </data> | |
| 62 <collection name="collection_anndata" type="list" label="Anndata objects extracted from ${on_string}"> | |
| 63 <discover_datasets pattern="(?P<designation>.*).h5ad" format="h5ad"/> | |
| 64 <filter>operation['mode'] == 'export' </filter> | |
| 65 </collection> | |
| 66 <expand macro="outputs_common_advanced"/> | |
| 67 </outputs> | |
| 68 <tests> | |
| 69 <test expect_num_outputs="2"> | |
| 70 <!--Import test for RNA and ATAC modalities--> | |
| 71 <conditional name="operation"> | |
| 72 <param name="mode" value="import"/> | |
| 73 <repeat name="modalities"> | |
| 74 <param name="name" value="RNA"/> | |
| 75 <param name="anndata" location="https://zenodo.org/records/12570984/files/rna.h5ad"/> | |
| 76 </repeat> | |
| 77 <repeat name="modalities"> | |
| 78 <param name="name" value="ATAC"/> | |
| 79 <param name="anndata" location="https://zenodo.org/records/12570984/files/atac.h5ad"/> | |
| 80 </repeat> | |
| 81 <param name="make_unique" value="True"/> | |
| 82 </conditional> | |
| 83 <section name="advanced_common"> | |
| 84 <param name="show_log" value="true" /> | |
| 85 </section> | |
| 86 <output name="hidden_output"> | |
| 87 <assert_contents> | |
| 88 <has_text_matching expression="mu.MuData"/> | |
| 89 <has_text_matching expression="'RNA': ad.read"/> | |
| 90 <has_text_matching expression="'ATAC': ad.read"/> | |
| 91 <has_text_matching expression="var_names_make_unique()"/> | |
| 92 </assert_contents> | |
| 93 </output> | |
| 94 <output name="mudata_out" ftype="h5ad"> | |
| 95 <assert_contents> | |
| 96 <has_h5_keys keys="mod/RNA"/> | |
| 97 <has_h5_keys keys="mod/ATAC"/> | |
| 98 <has_h5_keys keys="var/feature_types"/> | |
| 99 </assert_contents> | |
| 100 </output> | |
| 101 </test> | |
| 102 <test expect_num_outputs="2"> | |
| 103 <!--Export test for RNA and ATAC modalities--> | |
| 104 <conditional name="operation"> | |
| 105 <param name="mode" value="export"/> | |
| 106 <param name="mudata_in" location="https://zenodo.org/records/12570984/files/rna_atac.h5mu"/> | |
| 107 </conditional> | |
| 108 <section name="advanced_common"> | |
| 109 <param name="show_log" value="true" /> | |
| 110 </section> | |
| 111 <output name="hidden_output"> | |
| 112 <assert_contents> | |
| 113 <has_text_matching expression="mu.read_h5mu"/> | |
| 114 <has_text_matching expression="write_h5ad"/> | |
| 115 </assert_contents> | |
| 116 </output> | |
| 117 <output_collection name="collection_anndata" type="list" count="2"> | |
| 118 <element name="ATAC" ftype="h5ad"> | |
| 119 <assert_contents> | |
| 120 <has_h5_keys keys="var/gene_ids"/> | |
| 121 <has_h5_keys keys="uns/neighbors"/> | |
| 122 <has_h5_keys keys="obsp/connectivities"/> | |
| 123 </assert_contents> | |
| 124 </element> | |
| 125 <element name="RNA" ftype="h5ad"> | |
| 126 <assert_contents> | |
| 127 <has_h5_keys keys="var/gene_ids"/> | |
| 128 <has_h5_keys keys="uns/neighbors"/> | |
| 129 <has_h5_keys keys="obsp/connectivities"/> | |
| 130 </assert_contents> | |
| 131 </element> | |
| 132 </output_collection> | |
| 133 </test> | |
| 134 </tests> | |
| 135 <help><![CDATA[ | |
| 136 **What it does** | |
| 137 Create MuData from AnnData is a tool that allows creating a muon.MuData object out of two or more AnnData objects | |
| 138 for multimodal analysis. The multimodal data is created by combining AnnData objects as | |
| 139 h5ad files into a MuData object as a h5mu file using muon. | |
| 140 Furthermore, it runs pp.intersect_obs to keep only entries present in both modalities (AnnData objects) in the | |
| 141 final MuData file. | |
| 142 ]]></help> | |
| 143 <expand macro="citations"/> | |
| 144 </tool> |
