comparison macros.xml @ 6:1ac4a5f05f33 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/snapatac2 commit e0f59fae19e57f54ae0c351a16dd1805d12aba1d
author iuc
date Tue, 25 Nov 2025 16:41:12 +0000
parents 05bd4db20227
children
comparison
equal deleted inserted replaced
5:05bd4db20227 6:1ac4a5f05f33
1 <macros> 1 <macros>
2 <token name="@TOOL_VERSION@">2.6.4</token> 2 <token name="@TOOL_VERSION@">2.8.0</token>
3 <token name="@VERSION_SUFFIX@">1</token> 3 <token name="@VERSION_SUFFIX@">0</token>
4 <token name="@PROFILE@">23.0</token> 4 <token name="@PROFILE@">24.0</token>
5 <xml name="xrefs"> 5 <xml name="xrefs">
6 <xrefs> 6 <xrefs>
7 <xref type="bio.tools">snapatac</xref> 7 <xref type="bio.tools">snapatac</xref>
8 </xrefs> 8 </xrefs>
9 </xml> 9 </xml>
10 <xml name="requirements"> 10 <xml name="requirements">
11 <requirement type="package" version="@TOOL_VERSION@">snapatac2</requirement> 11 <requirement type="package" version="@TOOL_VERSION@">snapatac2</requirement>
12 <requirement type="package" version="5.22.0">plotly</requirement> 12 <requirement type="package" version="0.8.37">hdbscan</requirement>
13 <requirement type="package" version="0.2.1">python-kaleido</requirement> 13 <requirement type="package" version="0.10.2">leidenalg</requirement>
14 <requirement type="package" version="1.1.0">polars</requirement> 14 <requirement type="package" version="0.5.7">umap-learn</requirement>
15 <requirement type="package" version="16.1.0">pyarrow</requirement> 15 <requirement type="package" version="3.0.4">xgboost</requirement>
16 <requirement type="package" version="0.11.6">python-igraph</requirement> 16 <requirement type="package" version="0.2.1">python-kaleido</requirement>
17 <requirement type="package" version="0.8.37">hdbscan</requirement> 17 <requirement type="package" version="1.31.0">polars</requirement>
18 <requirement type="package" version="0.0.10">harmonypy</requirement> 18 <requirement type="package" version="5.24.1">plotly</requirement>
19 <requirement type="package" version="1.7.4">scanorama</requirement> 19 <requirement type="package" version="0.2.1">python-kaleido</requirement>
20 <requirement type="package" version="3.0.1">macs3</requirement> 20 <requirement type="package" version="0.0.10">harmonypy</requirement>
21 <requirement type="package" version="0.70.16">multiprocess</requirement> 21 <requirement type="package" version="1.7.4">scanorama</requirement>
22 <requirement type="package" version="0.10.2">leidenalg</requirement>
23 <yield /> 22 <yield />
24 </xml> 23 </xml>
25 24
26 <token name="@PREP_ADATA@"><![CDATA[ 25 <!-- command section -->
26 <token name="@CMD_PREP_ADATA@"><![CDATA[
27 ## ln -s does not work here
27 cp '$method.adata' 'anndata.h5ad' && 28 cp '$method.adata' 'anndata.h5ad' &&
28 ]]> 29 ]]></token>
29 </token>
30
31 <token name="@CMD@"><![CDATA[ 30 <token name="@CMD@"><![CDATA[
32 cat '$script_file' > '$hidden_output' && 31 cat '$script_file' > '$hidden_output' &&
33 python '$script_file' >> '$hidden_output' && 32 python '$script_file' >> '$hidden_output' &&
34 touch 'anndata_info.txt' && 33 touch 'anndata_info.txt' &&
35 cat 'anndata_info.txt' @CMD_prettify_stdout@ 34 cat 'anndata_info.txt' @CMD_PRETTIFY_STDOUT@
36 ]]> 35 ]]></token>
37 </token> 36 <token name="@CMD_PRETTIFY_STDOUT@"><![CDATA[
38 37 | sed -r '1 s|AnnData object with (.+) = (.*)\s*|\1: \2|g' | sed "s|'||g" | sed -r 's|^\s*(.*):\s(.*)|[\1]\n- \2|g' | sed 's|, |\n- |g'
39 <token name="@CMD_prettify_stdout@"><![CDATA[ | sed -r '1 s|AnnData object with (.+) = (.*)\s*|\1: \2|g' | sed "s|'||g" | sed -r 's|^\s*(.*):\s(.*)|[\1]\n- \2|g' | sed 's|, |\n- |g' 38 ]]></token>
40 ]]></token> 39 <token name="@CMD_GET_GFF@"><![CDATA[
41 40 #if $method.gff_file_condi.gffSource == 'cached':
42 <token name="@CMD_imports@"><![CDATA[ 41 ln -s '$method.gff_file_condi.gff_pre_installed.fields.path' gff &&
43 import snapatac2 as sa 42 #else:
43 ln -s '$method.gff_file_condi.gff_history' gff &&
44 #end if
45 ]]></token>
46 <token name="@CMD_GET_FASTA@"><![CDATA[
47 #if $method.fasta_file_condi.fastaSource == 'indexed':
48 zcat '$method.fasta_file_condi.fasta_pre_installed.fields.path' > fasta.fa &&
49 echo "Using built-in FASTA: '$method.fasta_file_condi.fasta_pre_installed.fields.name'" >&2 &&
50 #else:
51 #if $method.fasta_file_condi.fasta_history.ext.endswith('.gz')
52 zcat '$method.fasta_file_condi.fasta_history' > fasta.fa &&
53 #else:
54 ln -s '$method.fasta_file_condi.fasta_history' fasta.fa &&
55 #end if
56 #end if
57 ]]></token>
58
59 <!-- Config section -->
60 <token name="@CONF_IMPORTS@"><![CDATA[
61 import snapatac2 as snap
44 import os 62 import os
45 ]]> 63 ]]></token>
46 </token> 64 <token name="@CONF_READ_INPUTS@"><![CDATA[
47 <xml name="sanitize_query" token_validinitial="string.printable"> 65 adata = snap.read('anndata.h5ad', backed = None)
48 <sanitizer> 66 ]]></token>
49 <valid initial="@VALIDINITIAL@"> 67 <token name="@CONF_ANNDATA_WRITE_OUTPUTS@"><![CDATA[
50 <remove value="&apos;" /> 68 adata.write_h5ad('anndata.h5ad.gz', compression='gzip')
51 </valid>
52 </sanitizer>
53 </xml>
54
55 <xml name="inputs_anndata">
56 <param name="adata" type="data" format="h5ad" label="Annotated data matrix"/>
57 </xml>
58
59 <token name="@CMD_read_inputs@"><![CDATA[
60
61 adata = sa.read('anndata.h5ad', backed = None)
62 ]]>
63 </token>
64
65 <xml name="dimentions_plot">
66 <param argument="width" type="integer" value="500" label="Width of the plot"/>
67 <param argument="height" type="integer" value="400" label="Height of the plot"/>
68 </xml>
69
70 <xml name="param_groupby">
71 <param argument="groupby" type="text" label="The key of the observation grouping to consider">
72 <expand macro="sanitize_query" />
73 </param>
74 </xml>
75
76 <xml name="out_file">
77 <param name="out_file" type="select" optional="true" label="Type of output plot">
78 <option value="png" selected="true">PNG</option>
79 <option value="svg">SVG</option>
80 <option value="pdf">PDF</option>
81 </param>
82 </xml>
83 <token name="@CMD_anndata_write_outputs@"><![CDATA[
84 adata.write('anndata.h5ad')
85 with open('anndata_info.txt','w', encoding='utf-8') as ainfo: 69 with open('anndata_info.txt','w', encoding='utf-8') as ainfo:
86 print(adata, file=ainfo) 70 print(adata, file=ainfo)
87 ]]> 71 ]]></token>
88 </token> 72 <token name="@CONF_PARAMS_RENDER_PLOT@"><![CDATA[
89 <xml name="inputs_common_advanced"> 73 width = $method.width,
90 <section name="advanced_common" title="Advanced Options" expanded="false"> 74 height = $method.height,
91 <param name="show_log" type="boolean" checked="false" label="Output Log?" /> 75 show = False,
92 </section> 76 interactive = False,
93 </xml> 77 out_file = 'plot.$method.out_file',
94 <xml name="params_render_plot"> 78 ]]></token>
95 <param argument="width" type="integer" value="600" label="Width of the plot"/> 79 <token name="@CONF_PARAMS_DATA_INTEGRATION@"><![CDATA[
96 <param argument="height" type="integer" value="400" label="Height of the plot"/>
97 <expand macro="out_file"/>
98 </xml>
99 <xml name="param_shift">
100 <param argument="shift_left" type="integer" value="4" label="Insertion site correction for the left end" help="Note this has no effect on single-end reads"/>
101 <param argument="shift_right" type="integer" value="-5" label="Insertion site correction for the right end" help="Note this has no effect on single-end reads"/>
102 </xml>
103 <xml name="param_chunk_size" tokens="size">
104 <param argument="chunk_size" type="integer" value="@SIZE@" label="chunk size"/>
105 </xml>
106 <xml name="min_max_frag_size">
107 <param argument="min_frag_size" type="integer" optional="true" value="" label="Minimum fragment size to include"/>
108 <param argument="max_frag_size" type="integer" optional="true" value="" label="Maximum fragment size to include"/>
109 </xml>
110 <xml name="params_data_integration">
111 <param argument="use_rep" type="text" value="X_spectral" label="The key for the matrix"/>
112 <param argument="use_dims" type="text" optional="true" value="" label="The dimensions used for computation">
113 <expand macro="sanitize_query"/>
114 </param>
115 <param argument="groupby" type="text" optional="true" value="" label="The key of the observation grouping to consider">
116 <expand macro="sanitize_query" />
117 </param>
118 <param argument="key_added" type="text" optional="true" value="" label="If specified, add the result to adata.obsm with this key"/>
119 </xml>
120 <xml name="param_n_comps">
121 <param argument="n_comps" type="integer" value="30" label="Number of dimensions to keep" help="The result is insensitive to this parameter when `weighted_by_sd` is set, as long as it is large enough, e.g. 30."/>
122 </xml>
123 <xml name="param_random_state">
124 <param argument="random_state" type="integer" value="0" label="Seed of the random state generator"/>
125 </xml>
126 <xml name="param_key_added" tokens="key_added">
127 <param argument="key_added" type="text" value="@KEY_ADDED@" label="`adata.obs` key under which t add cluster labels"/>
128 </xml>
129 <xml name="param_use_rep">
130 <param argument="use_rep" type="text" value="X_spectral" label="Use the indicated representation in `.obsm`"/>
131 </xml>
132 <xml name="genome_fasta">
133 <param argument="genome_fasta" type="text" label="A fasta file containing the genome sequences or a Genome object"/>
134 </xml>
135 <xml name="background">
136 <param argument="background" type="text" optional="true" value="" label="A list of regions to be used as the background">
137 <expand macro="sanitize_query"/>
138 </param>
139 </xml>
140 <xml name="mat">
141 <param argument="peak_mat" type="data" format="h5ad" optional="true" label="AnnData or AnnDataSet object storing the cell by peak count matrix"/>
142 <param argument="gene_mat" type="data" format="h5ad" optional="true" label="AnnData or AnnDataSet object storing the cell by gene count matrix"/>
143 </xml>
144 <xml name="param_network">
145 <param argument="network" type="text" label="network"/>
146 </xml>
147 <xml name="param_n_iterations">
148 <param argument="n_iterations" type="integer" value="-1" label="How many iterations of the Leiden clustering algorithm to perform"
149 help="Positive values above 2 define the total number of iterations to perform, -1 has the algorithm run until it reaches its optimal clustering."/>
150 </xml>
151
152 <xml name="citations">
153 <citations>
154 <citation type="doi">10.1038/s41592-023-02139-9</citation>
155 </citations>
156 </xml>
157 <xml name="render_plot_test">
158 <param name="width" value="650"/>
159 <param name="height" value="450"/>
160 </xml>
161 <xml name="render_plot_matching_text">
162 <has_text_matching expression="width = 650"/>
163 <has_text_matching expression="height = 450"/>
164 </xml>
165 <xml name="param_counting_strategy">
166 <param argument="counting_strategy" type="select" label="The strategy to compute feature counts">
167 <option value="fragment">"fragment": based on the number of fragments that overlap with a region of interest</option>
168 <option value="insertion" selected="true">"insertion": based on the number of insertions that overlap with a region of interest</option>
169 <option value="paired-insertion">"paired-insertion": similar to "insertion", but it only counts the insertions once if the pair of insertions of a fragment are both within the same region of interest</option>
170 </param>
171 </xml>
172
173 <token name="@CMD_params_data_integration@"><![CDATA[
174 use_rep = '$method.use_rep', 80 use_rep = '$method.use_rep',
175 #if $method.use_dims != '' 81 #if $method.use_dims != ''
176 #set $dims = ([x.strip() for x in str($method.use_dims).split(',')]) 82 #set $dims = ([x.strip() for x in str($method.use_dims).split(',')])
177 use_dims=$dims, 83 use_dims=$dims,
178 #end if 84 #end if
181 groupby=$groupby, 87 groupby=$groupby,
182 #end if 88 #end if
183 #if $method.key_added != '' 89 #if $method.key_added != ''
184 key_added = '$method.key_added', 90 key_added = '$method.key_added',
185 #end if 91 #end if
186 ]]> 92 ]]></token>
187 </token> 93 <token name="@CONF_IMPORT_MEME@"><![CDATA[
188 94 motifs = read_motifs("input.meme")
189 <token name="@CMD_params_render_plot@"><![CDATA[ 95 for motif in motifs:
190 width = $method.width, 96 motif.name = motif.id.split('+')[0]
191 height = $method.height, 97
192 out_file = 'plot.$method.out_file', 98 unique_motifs = {}
193 ]]> 99 for motif in motifs:
194 </token> 100 name = motif.name
101 if (
102 name not in unique_motifs or
103 unique_motifs[name].info_content() < motif.info_content()
104 ):
105 unique_motifs[name] = motif
106 motifs = list(unique_motifs.values())
107
108
109 #else:
110 motifs = read_motifs("input.meme")
111 for motif in motifs:
112 motif.name = motif.id.split('_')[0]
113 motif.family = motif.id.split('+')[-1]
114 ]]></token>
115
116 <!-- input section -->
117 <xml name="sanitize_query" token_validinitial="string.printable">
118 <sanitizer>
119 <valid initial="@VALIDINITIAL@">
120 <remove value="&apos;" />
121 <yield/>
122 </valid>
123 </sanitizer>
124 </xml>
125
126 <xml name="param_inputs_anndata" token_multiple="false" token_label="Annotated data matrix">
127 <param name="adata" type="data" multiple="@MULTIPLE@" format="h5ad" label="@LABEL@"/>
128 </xml>
129 <xml name="param_groupby">
130 <param argument="groupby" type="text" label="The key of the observation grouping to consider">
131 <expand macro="sanitize_query" />
132 </param>
133 </xml>
134 <xml name="param_common_advanced">
135 <section name="advanced_common" title="Advanced Options" expanded="false">
136 <param name="show_log" type="boolean" checked="false" label="Output Log?" />
137 </section>
138 </xml>
139 <xml name="param_render_plot">
140 <param argument="width" type="integer" value="600" label="Width of the plot"/>
141 <param argument="height" type="integer" value="400" label="Height of the plot"/>
142 <param name="out_file" type="select" optional="true" label="Type of output plot">
143 <option value="png" selected="true">PNG</option>
144 <option value="svg">SVG</option>
145 <option value="pdf">PDF</option>
146 <option value="html">HTML</option>
147 </param>
148 </xml>
149 <xml name="param_shift" tokens="varname" token_value="0" token_label="Insertion site correction for the left end">
150 <param argument="@VARNAME@" type="integer" value="@VALUE@" label="@LABEL@" help="Note this has no effect on single-end reads"/>
151 </xml>
152 <xml name="param_chunk_size" tokens="size">
153 <param argument="chunk_size" type="integer" value="@SIZE@" label="chunk size"/>
154 </xml>
155 <xml name="param_min_max_frag_size">
156 <param argument="min_frag_size" type="integer" optional="true" value="" label="Minimum fragment size to include"/>
157 <param argument="max_frag_size" type="integer" optional="true" value="" label="Maximum fragment size to include"/>
158 </xml>
159 <xml name="param_data_integration">
160 <param argument="use_rep" type="text" value="X_spectral" label="The key for the matrix"/>
161 <param argument="use_dims" type="text" optional="true" value="" label="The dimensions used for computation">
162 <expand macro="sanitize_query"/>
163 </param>
164 <param argument="groupby" type="text" optional="true" value="" label="The key of the observation grouping to consider">
165 <expand macro="sanitize_query" />
166 </param>
167 <param argument="key_added" type="text" optional="true" value="" label="If specified, add the result to adata.obsm with this key"/>
168 </xml>
169 <xml name="param_random_state" token_label="Seed of the random state generator" token_help="">
170 <param argument="random_state" type="integer" value="0" label="@LABEL@" help="@HELP@"/>
171 </xml>
172 <xml name="param_key_added" tokens="key_added">
173 <param argument="key_added" type="text" value="@KEY_ADDED@" label="`adata.obs` key under which t add cluster labels"/>
174 </xml>
175 <xml name="param_use_rep" token_label="Use the indicated representation in `.obsm`">
176 <param argument="use_rep" type="text" value="X_spectral" label="@LABEL@"/>
177 </xml>
178 <xml name="param_n_iterations">
179 <param argument="n_iterations" type="integer" value="-1" label="How many iterations of the Leiden clustering algorithm to perform"
180 help="Positive values above 2 define the total number of iterations to perform, -1 has the algorithm run until it reaches its optimal clustering."/>
181 </xml>
182 <xml name="param_counting_strategy">
183 <param argument="counting_strategy" type="select" label="The strategy to compute feature counts">
184 <option value="fragment">"fragment": based on the number of fragments that overlap with a region of interest</option>
185 <option value="insertion">"insertion": based on the number of insertions that overlap with a region of interest</option>
186 <option value="paired-insertion" selected="true">"paired-insertion": similar to "insertion", but it only counts the insertions once if the pair of insertions of a fragment are both within the same region of interest</option>
187 </param>
188 </xml>
189 <xml name="param_chrom_sizes">
190 <param argument="chrom_sizes" type="data" format="tabular" label="Chromosome sizes" help="First column the chromosome name and second column the size"/>
191 </xml>
192 <xml name="param_genome_fasta">
193 <conditional name="fasta_file_condi">
194 <param name="fastaSource" type="select" label="Select a built-in FASTA or one from your history" help="Choose history if you don't see the correct FASTA.">
195 <option value="indexed" selected="true">Use a built-in FASTA</option>
196 <option value="history">Use a FASTA from history</option>
197 </param>
198 <when value="indexed">
199 <param name="fasta_pre_installed" type="select" label="Select a FASTA file" help="Select the FASTA file from a list of pre-installed genomes">
200 <options from_data_table="all_fasta">
201 <filter type="sort_by" column="2" />
202 </options>
203 </param>
204 </when>
205 <when value="history">
206 <param name="fasta_history" type="data" format="fasta,fasta.gz" label="FASTA file" />
207 </when>
208 </conditional>
209 </xml>
210 <xml name="param_gene_anno">
211 <conditional name="gff_file_condi">
212 <param name="gffSource" type="select" label="Select a built-in GFF file or one from your history" help="Choose history if you don't see the correct GFF" >
213 <option value="cached" selected="true">Use a built-in GFF</option>
214 <option value="history">Use a GFF from history</option>
215 </param>
216 <when value="cached">
217 <param name="gff_pre_installed" type="select" label="Select a GFF file" help="Select the GFF from a list of pre-installed files">
218 <options from_data_table="gene_sets">
219 <filter type="sort_by" column="1" />
220 </options>
221 </param>
222 </when>
223 <when value="history">
224 <param name="gff_history" type="data" format="gff3.gz" label="Select a GFF file" help="Make sure that the GFF corresponds to the same genome as the FASTA"/>
225 </when>
226 </conditional>
227 </xml>
228 <xml name="param_n_comps" token_value="30" token_label="Number of dimensions to keep" token_help="The result is insensitive to this parameter when `weighted_by_sd` is set, as long as it is large enough, e.g. 30.">
229 <param argument="n_comps" type="integer" value="@VALUE@" label="@LABEL@" help="@HELP@"/>
230 </xml>
231 <xml name="param_meme_table">
232 <param name="motifs" type="select" label="Select list of transcription factor motifs">
233 <options from_data_table="meme">
234 <filter type="sort_by" column="2" />
235 </options>
236 </param>
237 </xml>
238
239
240 <!-- test section -->
241 <xml name="test_param_render_plot">
242 <param name="width" value="650"/>
243 <param name="height" value="450"/>
244 </xml>
245 <xml name="test_render_plot_matching_text">
246 <has_text_matching expression="width = 650"/>
247 <has_text_matching expression="height = 450"/>
248 </xml>
249
250
251 <xml name="citations">
252 <citations>
253 <citation type="doi">10.1038/s41592-023-02139-9</citation>
254 </citations>
255 </xml>
195 </macros> 256 </macros>