comparison dimension_reduction_clustering.xml @ 6:d258720d9a42 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:40:54 +0000
parents d3ea0ba3d066
children
comparison
equal deleted inserted replaced
5:d3ea0ba3d066 6:d258720d9a42
7 <requirements> 7 <requirements>
8 <expand macro="requirements"/> 8 <expand macro="requirements"/>
9 </requirements> 9 </requirements>
10 <command detect_errors="exit_code"><![CDATA[ 10 <command detect_errors="exit_code"><![CDATA[
11 export NUMBA_CACHE_DIR="\${TEMP:-/tmp}"; 11 export NUMBA_CACHE_DIR="\${TEMP:-/tmp}";
12 @PREP_ADATA@ 12 #if $method.method == 'tl.multi_spectral'
13 #for $i in range(len($method.adata))
14 cp $method.adata[$i] 'adata_${i}.h5ad' &&
15 #end for
16 #else
17 @CMD_PREP_ADATA@
18 #end if
13 @CMD@ 19 @CMD@
14 ]]></command> 20 ]]></command>
15 <configfiles> 21 <configfiles>
16 <configfile name="script_file"><![CDATA[ 22 <configfile name="script_file"><![CDATA[
17 23
18 @CMD_imports@ 24 @CONF_IMPORTS@
19 @CMD_read_inputs@ 25 #if $method.method == 'tl.multi_spectral'
26 ## read all files ending with .h5ad in the working directory
27 import glob
28 files = sorted(glob.glob('adata_*.h5ad'))
29
30 adata_list = []
31 for fn in files:
32 ad = snap.read(fn, backed=None)
33 adata_list.append(ad)
34 #else
35 @CONF_READ_INPUTS@
36 #end if
20 37
21 #if $method.method == 'tl.spectral' 38 #if $method.method == 'tl.spectral'
22 #if $method.features 39 #if $method.features
23 with open('$method.features') as f: 40 with open('$method.features') as f:
24 features_mask = [x.lower().capitalize() == "True" for x in f.read().splitlines()] 41 features_mask = [x.lower().capitalize() == "True" for x in f.read().splitlines()]
25 #end if 42 #end if
26 sa.tl.spectral( 43
44 ## somewhere in the SnapATAC2 code, a pandas Series is being passed where a numpy array is expected.
45 ## This is a workaround to add the nonzero method back to pandas Series.
46 ## Add the nonzero method back to pandas Series
47 import pandas as pd
48 def series_nonzero(self):
49 return (self != 0).values.nonzero()
50
51 pd.Series.nonzero = series_nonzero
52
53
54 snap.tl.spectral(
27 adata, 55 adata,
28 n_comps = $method.n_comps, 56 n_comps = $method.n_comps,
29 #if $method.features 57 #if $method.features
30 features = features_mask, 58 features = features_mask,
31 #end if 59 #end if
37 distance_metric = '$method.distance_metric', 65 distance_metric = '$method.distance_metric',
38 weighted_by_sd = $method.weighted_by_sd, 66 weighted_by_sd = $method.weighted_by_sd,
39 inplace = True 67 inplace = True
40 ) 68 )
41 69
70 #else if $method.method == 'tl.multi_spectral'
71 #if $method.features
72 with open('$method.features') as f:
73 features_mask = [x.lower().capitalize() == "True" for x in f.read().splitlines()]
74 #end if
75
76 embedding = snap.tl.multi_spectral(
77 adatas = adata_list,
78 n_comps = $method.n_comps,
79 #if $method.features
80 features = features_mask,
81 #else
82 features = None,
83 #end if
84 weights = None, # Will enable if requested by users
85 random_state = $method.random_state,
86 weighted_by_sd = $method.weighted_by_sd,
87 )
88
89 adata = adata_list[0].copy()
90 adata.uns['spectral_eigenvalue_joint'] = embedding[0]
91 adata.obsm['X_joint'] = embedding[1]
92
42 #else if $method.method == 'tl.umap' 93 #else if $method.method == 'tl.umap'
43 sa.tl.umap( 94 snap.tl.umap(
44 adata, 95 adata,
45 n_comps = $method.n_comps, 96 n_comps = $method.n_comps,
46 #if $method.use_dims != '' 97 #if $method.use_dims != ''
47 #set $dims = ([x.strip() for x in str($method.use_dims).split(',')]) 98 #set $dims = ([x.strip() for x in str($method.use_dims).split(',')])
48 use_dims=$dims, 99 use_dims=$dims,
52 random_state = $method.random_state, 103 random_state = $method.random_state,
53 inplace = True 104 inplace = True
54 ) 105 )
55 106
56 #else if $method.method == 'pp.knn' 107 #else if $method.method == 'pp.knn'
57 sa.pp.knn( 108 snap.pp.knn(
58 adata, 109 adata,
59 n_neighbors = $method.n_neighbors, 110 n_neighbors = $method.n_neighbors,
60 #if $method.use_dims != '' 111 #if $method.use_dims != ''
61 #set $dims = ([x.strip() for x in str($method.use_dims).split(',')]) 112 #set $dims = ([x.strip() for x in str($method.use_dims).split(',')])
62 use_dims=$dims, 113 use_dims=$dims,
65 method = '$method.algorithm', 116 method = '$method.algorithm',
66 inplace = True, 117 inplace = True,
67 random_state = $method.random_state 118 random_state = $method.random_state
68 ) 119 )
69 120
121 #else if $method.method == 'tl.leiden'
122 snap.tl.leiden(
123 adata,
124 resolution = $method.resolution,
125 objective_function = '$method.objective_function',
126 min_cluster_size = $method.min_cluster_size,
127 n_iterations = $method.n_iterations,
128 random_state = $method.random_state,
129 key_added = '$method.key_added',
130 use_leidenalg = $method.use_leidenalg,
131 weighted = $method.weighted,
132 inplace = True
133 )
134
135 #else if $method.method == 'tl.kmeans'
136 snap.tl.kmeans(
137 adata,
138 n_clusters = $method.n_clusters,
139 n_iterations = $method.n_iterations,
140 random_state = $method.random_state,
141 use_rep = '$method.use_rep',
142 key_added = '$method.key_added'
143 )
144
70 #else if $method.method == 'tl.dbscan' 145 #else if $method.method == 'tl.dbscan'
71 sa.tl.dbscan( 146 snap.tl.dbscan(
72 adata, 147 adata,
73 eps = $method.eps, 148 eps = $method.eps,
74 min_samples = $method.min_samples, 149 min_samples = $method.min_samples,
75 leaf_size = $method.leaf_size, 150 leaf_size = $method.leaf_size,
76 use_rep = '$method.use_rep', 151 use_rep = '$method.use_rep',
77 key_added = '$method.key_added' 152 key_added = '$method.key_added',
153 n_jobs = int(os.getenv("GALAXY_SLOTS", 4))
78 ) 154 )
79 155
80 #else if $method.method == 'tl.hdbscan' 156 #else if $method.method == 'tl.hdbscan'
81 sa.tl.hdbscan( 157 snap.tl.hdbscan(
82 adata, 158 adata,
83 min_cluster_size = $method.min_cluster_size, 159 min_cluster_size = $method.min_cluster_size,
84 #if $method.min_samples 160 #if $method.min_samples
85 min_samples = $method.min_samples, 161 min_samples = $method.min_samples,
86 #end if 162 #end if
90 random_state = $method.random_state, 166 random_state = $method.random_state,
91 use_rep = '$method.use_rep', 167 use_rep = '$method.use_rep',
92 key_added = '$method.key_added' 168 key_added = '$method.key_added'
93 ) 169 )
94 170
95 #else if $method.method == 'tl.leiden' 171 ## It is implemented in select_feature function, and it is problematic if the user don't select a groupby (will return an array). i think this can be skipped unless needed
96 sa.tl.leiden( 172 ## #else if $method.method == 'tl.aggregate_X'
97 adata, 173 ## snap.tl.aggregate_X(
98 resolution = $method.resolution, 174 ## adata,
99 objective_function = '$method.objective_function', 175 ## #if $method.groupby != ''
100 #if $method.objective_function == 'RBConfiguration' 176 ## groupby = '$method.groupby',
101 use_leidenalg = True, 177 ## #end if
102 #end if 178 ## normalize = '$method.normalize'
103 min_cluster_size = $method.min_cluster_size, 179 ## )
104 n_iterations = $method.n_iterations,
105 random_state = $method.random_state,
106 key_added = '$method.key_added',
107 weighted = $method.weighted,
108 inplace = True
109 )
110
111 #else if $method.method == 'tl.kmeans'
112 sa.tl.kmeans(
113 adata,
114 n_clusters = $method.n_clusters,
115 n_iterations = $method.n_iterations,
116 random_state = $method.random_state,
117 use_rep = '$method.use_rep',
118 key_added = '$method.key_added'
119 )
120
121 #else if $method.method == 'tl.aggregate_X'
122 sa.tl.aggregate_X(
123 adata,
124 #if $method.groupby != ''
125 groupby = '$method.groupby',
126 #end if
127 normalize = '$method.normalize'
128 )
129 180
130 #else if $method.method == 'tl.aggregate_cells' 181 #else if $method.method == 'tl.aggregate_cells'
131 sa.tl.aggregate_cells( 182 snap.tl.aggregate_cells(
132 adata, 183 adata,
133 use_rep = '$method.use_rep', 184 use_rep = '$method.use_rep',
134 #if $method.target_num_cells 185 #if $method.target_num_cells
135 target_num_cells = $method.target_num_cells, 186 target_num_cells = $method.target_num_cells,
136 #end if 187 #end if
139 key_added = '$method.key_added', 190 key_added = '$method.key_added',
140 inplace = True 191 inplace = True
141 ) 192 )
142 #end if 193 #end if
143 194
144 @CMD_anndata_write_outputs@ 195 @CONF_ANNDATA_WRITE_OUTPUTS@
145 ]]></configfile> 196 ]]></configfile>
146 </configfiles> 197 </configfiles>
147 <inputs> 198 <inputs>
148 <conditional name="method"> 199 <conditional name="method">
149 <param name="method" type="select" label="Dimension reduction and Clustering"> 200 <param name="method" type="select" label="Dimension reduction and Clustering">
150 <option value="tl.spectral">Perform dimension reduction using Laplacian Eigenmap, using 'tl.spectral'</option> 201 <option value="tl.spectral">Perform dimension reduction using Laplacian Eigenmap, using 'tl.spectral'</option>
202 <option value="tl.multi_spectral">similar to 'tl.multi_spectral' but it can work on multiple modalities.</option>
151 <option value="tl.umap">Compute Umap, using 'tl.umap'</option> 203 <option value="tl.umap">Compute Umap, using 'tl.umap'</option>
152 <option value="pp.knn">Compute a neighborhood graph of observations, using 'pp.knn'</option> 204 <option value="pp.knn">Compute a neighborhood graph of observations, using 'pp.knn'</option>
153 <option value="tl.leiden">Cluster cells into subgroups, using 'tl.leiden'</option> 205 <option value="tl.leiden">Cluster cells into subgroups, using 'tl.leiden'</option>
154 <option value="tl.kmeans">Cluster cells into subgroups using the K-means algorithm, using 'tl.kmeans'</option> 206 <option value="tl.kmeans">Cluster cells into subgroups using the K-means algorithm, using 'tl.kmeans'</option>
155 <option value="tl.dbscan">Cluster cells into subgroups using the DBSCAN algorithm, using 'tl.dbscan'</option> 207 <option value="tl.dbscan">Cluster cells into subgroups using the DBSCAN algorithm, using 'tl.dbscan'</option>
156 <option value="tl.hdbscan">Cluster cells into subgroups using the HDBSCAN algorithm, using 'tl.hdbscan'</option> 208 <option value="tl.hdbscan">Cluster cells into subgroups using the HDBSCAN algorithm, using 'tl.hdbscan'</option>
157 <option value="tl.aggregate_X">Aggregate values in adata.X in a row-wise fashion, using 'tl.aggregate_X'</option> 209 <!-- It is implemented in select_feature function in preprocessing.xml tool (implemented in upstream code, not in the xml). It is problematic if the user don't select a groupby (will return an array). i think this can be skipped unless needed -->
210 <!-- <option value="tl.aggregate_X">Aggregate values in adata.X in a row-wise fashion, using 'tl.aggregate_X'</option> -->
158 <option value="tl.aggregate_cells">Aggregate cells into pseudo-cells, using 'tl.aggregate_cells'</option> 211 <option value="tl.aggregate_cells">Aggregate cells into pseudo-cells, using 'tl.aggregate_cells'</option>
159 </param> 212 </param>
160 <when value="tl.spectral"> 213 <when value="tl.spectral">
161 <expand macro="inputs_anndata"/> 214 <expand macro="param_inputs_anndata"/>
162 <expand macro="param_n_comps"/> 215 <expand macro="param_n_comps"/>
163 <param argument="features" type="data" format="txt" optional="true" label="Text file indicating features to keep. Each line contains only word (True/False)." help="True means that the feature is kept. False means the feature is removed"/> 216 <param argument="features" type="data" format="txt,tabular" optional="true" label="Text file indicating features to keep. Each line contains only word (True/False)." help="True means that the feature is kept. False means the feature is removed"/>
164 <expand macro="param_random_state"/> 217 <expand macro="param_random_state"/>
165 <param argument="sample_size" type="float" min="0" max="1" optional="true" label="Approximate the embedding using the Nystrom algorithm by selecting a subset of cells" help="Using this only when the number of cells is too large, e.g. &gt; 10,000,000, or the `distance_metric` is “jaccard”"/> 218 <param argument="sample_size" type="float" min="0" max="1" optional="true" label="Approximate the embedding using the Nystrom algorithm by selecting a subset of cells" help="Using this only when the number of cells is too large, e.g. &gt; 10,000,000, or the `distance_metric` is “jaccard”"/>
166 <param argument="chunk_size" type="integer" value="20000" label="chunk size"/> 219 <param argument="chunk_size" type="integer" value="20000" label="chunk size"/>
167 <param argument="distance_metric" type="select" label="distance metric: “jaccard”, “cosine“"> 220 <param argument="distance_metric" type="select" label="distance metric: “jaccard”, “cosine“">
168 <option value="jaccard">jaccard</option> 221 <option value="jaccard">jaccard</option>
169 <option value="cosine" selected="true">cosine</option> 222 <option value="cosine" selected="true">cosine</option>
170 </param> 223 </param>
171 <param argument="weighted_by_sd" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Whether to weight the result eigenvectors by the square root of eigenvalues"/> 224 <param argument="weighted_by_sd" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Whether to weight the result eigenvectors by the square root of eigenvalues"/>
172 </when> 225 </when>
226 <when value="tl.multi_spectral">
227 <expand macro="param_inputs_anndata" multiple="true" label="list of Anndatas to use for multi_spectral" help="Please note that the embedding will be saved in the first Anndata"/>
228 <!-- Will enable if requested by users -->
229 <!-- <param name="weights" type="data" format="tabular" optional="true" label="Weights" help="Text file indicating weights for each modality. Each line contains only floats.If not provided, all modalities are weighted equally" /> -->
230 <expand macro="param_n_comps"/>
231 <param argument="features" type="data" format="txt,tabular" optional="true" label="Text file indicating features to keep. Each line contains only word (True/False)." help="True means that the feature is kept. False means the feature is removed"/>
232 <expand macro="param_random_state"/>
233 <param argument="weighted_by_sd" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Whether to weight the result eigenvectors by the square root of eigenvalues"/>
234 </when>
173 <when value="tl.umap"> 235 <when value="tl.umap">
174 <expand macro="inputs_anndata"/> 236 <expand macro="param_inputs_anndata"/>
175 <param argument="n_comps" type="integer" value="2" label="Number of dimensions of embedding"/> 237 <expand macro="param_n_comps" value="2" label="Number of components" help=""/>
176 <param argument="use_dims" type="text" optional="true" label="Use these dimensions in `use_rep`" help="comma separated list of dimensions"> 238 <param argument="use_dims" type="text" optional="true" label="Use these dimensions in `use_rep`" help="comma separated list of dimensions">
177 <expand macro="sanitize_query"/> 239 <expand macro="sanitize_query"/>
178 </param> 240 </param>
179 <expand macro="param_use_rep"/> 241 <expand macro="param_use_rep"/>
180 <expand macro="param_key_added" key_added="umap"/> 242 <expand macro="param_key_added" key_added="umap"/>
181 <expand macro="param_random_state"/> 243 <expand macro="param_random_state"/>
182 </when> 244 </when>
183 <when value="pp.knn"> 245 <when value="pp.knn">
184 <expand macro="inputs_anndata"/> 246 <expand macro="param_inputs_anndata"/>
185 <param argument="n_neighbors" type="integer" value="50" label="The number of nearest neighbors to be searched"/> 247 <param argument="n_neighbors" type="integer" value="50" label="The number of nearest neighbors to be searched"/>
186 <param argument="use_dims" type="text" value="" optional="true" label="The dimensions used for computation"> 248 <param argument="use_dims" type="text" value="" optional="true" label="The dimensions used for computation">
187 <expand macro="sanitize_query"/> 249 <expand macro="sanitize_query"/>
188 </param> 250 </param>
189 <param argument="use_rep" type="text" value="X_spectral" label="The key for the matrix"/> 251 <expand macro="param_use_rep" label="The key for the matrix"/>
190 <param argument="algorithm" type="select" label="Choose method"> 252 <param argument="algorithm" type="select" label="Choose method">
191 <option value="kdtree" selected="true">'kdtree': use the kdtree algorithm to find the nearest neighbors</option> 253 <option value="kdtree" selected="true">'kdtree': use the kdtree algorithm to find the nearest neighbors</option>
192 <option value="hora">'hora': use the HNSW algorithm to find the approximate nearest neighbors</option> 254 <option value="hora">'hora': use the HNSW algorithm to find the approximate nearest neighbors</option>
193 <option value="pynndescent">'pynndescent': use the pynndescent algorithm to find the approximate nearest neighbors</option> 255 <option value="pynndescent">'pynndescent': use the pynndescent algorithm to find the approximate nearest neighbors</option>
194 </param> 256 </param>
195 <param argument="random_state" type="integer" value="0" label="Random seed for approximate nearest neighbor search"/> 257 <expand macro="param_random_state" label="Random seed for approximate nearest neighbor search" help="Note that this is only used when method='pynndescent'. Currently hora does not support random seed, so the result of hora is not reproducible."/>
196 </when> 258 </when>
197 <when value="tl.leiden"> 259 <when value="tl.leiden">
198 <expand macro="inputs_anndata"/> 260 <expand macro="param_inputs_anndata"/>
199 <param argument="resolution" type="float" value="1" label="Parameter value controlling the coarseness of the clustering" help="Higher values lead to more clusters"/> 261 <param argument="resolution" type="float" value="1" label="Parameter value controlling the coarseness of the clustering" help="Higher values lead to more clusters"/>
200 <param argument="objective_function" type="select" label="Whether to use the Constant Potts Model (CPM) or modularity"> 262 <param argument="objective_function" type="select" label="Whether to use the Constant Potts Model (CPM) or modularity">
201 <option value="CPM">CPM</option> 263 <option value="CPM">CPM</option>
202 <option value="modularity" selected="true">modularity</option> 264 <option value="modularity" selected="true">modularity</option>
203 <option value="RBConfiguration">RBConfiguration</option> 265 <option value="RBConfiguration">RBConfiguration</option>
204 </param> 266 </param>
205 <param argument="min_cluster_size" type="integer" value="5" label="The minimum size of clusters"/> 267 <param argument="min_cluster_size" type="integer" value="5" label="The minimum size of clusters"/>
206 <expand macro="param_n_iterations"/> 268 <expand macro="param_n_iterations"/>
207 <expand macro="param_random_state"/> 269 <expand macro="param_random_state"/>
208 <expand macro="param_key_added" key_added="leiden"/> 270 <expand macro="param_key_added" key_added="leiden"/>
271 <param argument="use_leidenalg" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Whether to use the leidenalg package for Leiden clustering"/>
209 <param argument="weighted" type="boolean" truevalue="True" falsevalue="False" label="Whether to use the edge weights in the graph"/> 272 <param argument="weighted" type="boolean" truevalue="True" falsevalue="False" label="Whether to use the edge weights in the graph"/>
210 </when> 273 </when>
211 <when value="tl.kmeans"> 274 <when value="tl.kmeans">
212 <expand macro="inputs_anndata"/> 275 <expand macro="param_inputs_anndata"/>
213 <param argument="n_clusters" type="integer" value="5" label="Number of clusters to return"/> 276 <param argument="n_clusters" type="integer" value="5" label="Number of clusters to return"/>
214 <expand macro="param_n_iterations"/> 277 <expand macro="param_n_iterations"/>
215 <expand macro="param_random_state"/> 278 <expand macro="param_random_state"/>
216 <expand macro="param_use_rep"/> 279 <expand macro="param_use_rep"/>
217 <expand macro="param_key_added" key_added="kmeans"/> 280 <expand macro="param_key_added" key_added="kmeans"/>
218 </when> 281 </when>
219 <when value="tl.dbscan"> 282 <when value="tl.dbscan">
220 <expand macro="inputs_anndata"/> 283 <expand macro="param_inputs_anndata"/>
221 <param argument="eps" type="float" value="0.5" label=" The maximum distance between two samples for one to be considered as in the neighborhood of the other" help="This is not a maximum bound on the distances of points within a cluster. This is the most important DBSCAN parameter to choose appropriately for your data set and distance function."/> 284 <param argument="eps" type="float" value="0.5" label=" The maximum distance between two samples for one to be considered as in the neighborhood of the other" help="This is not a maximum bound on the distances of points within a cluster. This is the most important DBSCAN parameter to choose appropriately for your data set and distance function."/>
222 <param argument="min_samples" type="integer" value="5" label="The number of samples (or total weight) in a neighborhood for a point to be considered as a core point."/> 285 <param argument="min_samples" type="integer" value="5" label="The number of samples (or total weight) in a neighborhood for a point to be considered as a core point."/>
223 <param argument="leaf_size" type="integer" value="30" label="Leaf size passed to BallTree or cKDTree" help="This can affect the speed of the construction and query, as well as the memory required to store the tree."/> 286 <param argument="leaf_size" type="integer" value="30" label="Leaf size passed to BallTree or cKDTree" help="This can affect the speed of the construction and query, as well as the memory required to store the tree."/>
224 <expand macro="param_use_rep"/> 287 <expand macro="param_use_rep"/>
225 <expand macro="param_key_added" key_added="dbscan"/> 288 <expand macro="param_key_added" key_added="dbscan"/>
226 </when> 289 </when>
227 <when value="tl.hdbscan"> 290 <when value="tl.hdbscan">
228 <expand macro="inputs_anndata"/> 291 <expand macro="param_inputs_anndata"/>
229 <param argument="min_cluster_size" type="integer" value="5" label="The minimum size of clusters"/> 292 <param argument="min_cluster_size" type="integer" value="5" label="The minimum size of clusters"/>
230 <param argument="min_samples" type="integer" value="" optional="true" label="The number of samples in a neighbourhood for a point to be considered a core point"/> 293 <param argument="min_samples" type="integer" value="" optional="true" label="The number of samples in a neighborhood for a point to be considered a core point"/>
231 <param argument="cluster_selection_epsilon" type="float" value="0.0" label="A distance threshold. Clusters below this value will be merged"/> 294 <param argument="cluster_selection_epsilon" type="float" value="0.0" label="A distance threshold. Clusters below this value will be merged"/>
232 <param argument="alpha" type="float" value="1.0" label="A distance scaling parameter as used in robust single linkage"/> 295 <param argument="alpha" type="float" value="1.0" label="A distance scaling parameter as used in robust single linkage"/>
233 <param argument="cluster_selection_method" type="select" label="The method used to select clusters from the condensed tree"> 296 <param argument="cluster_selection_method" type="select" label="The method used to select clusters from the condensed tree">
234 <option value="eom">Excess of Mass algorithm to find the most persistent clusters</option> 297 <option value="eom">Excess of Mass algorithm to find the most persistent clusters</option>
235 <option value="leaf">Select the clusters at the leaves of the tree - this provides the most fine grained and homogeneous clusters</option> 298 <option value="leaf">Select the clusters at the leaves of the tree - this provides the most fine grained and homogeneous clusters</option>
236 </param> 299 </param>
237 <expand macro="param_random_state"/> 300 <expand macro="param_random_state"/>
238 <expand macro="param_use_rep"/> 301 <expand macro="param_use_rep"/>
239 <expand macro="param_key_added" key_added="hdbscan"/> 302 <expand macro="param_key_added" key_added="hdbscan"/>
240 </when> 303 </when>
241 <when value="tl.aggregate_X"> 304 <!-- <when value="tl.aggregate_X">
242 <expand macro="inputs_anndata"/> 305 <expand macro="param_inputs_anndata"/>
243 <expand macro="param_groupby"/> 306 <expand macro="param_groupby"/>
244 <param argument="normalize" type="select" optional="true" label="normalization method"> 307 <param argument="normalize" type="select" optional="true" label="normalization method">
245 <option value="RPM">RPM</option> 308 <option value="RPM">RPM</option>
246 <option value="RPKM">RPKM</option> 309 <option value="RPKM">RPKM</option>
247 </param> 310 </param>
248 </when> 311 </when> -->
249 <when value="tl.aggregate_cells"> 312 <when value="tl.aggregate_cells">
250 <expand macro="inputs_anndata"/> 313 <expand macro="param_inputs_anndata"/>
251 <expand macro="param_use_rep"/> 314 <expand macro="param_use_rep"/>
252 <param argument="target_num_cells" type="integer" value="" optional="true" label="target_num_cells" help="If None, `target_num_cells = num_cells / min_cluster_size`"/> 315 <param argument="target_num_cells" type="integer" value="" optional="true" label="target_num_cells" help="If None, `target_num_cells = num_cells / min_cluster_size`"/>
253 <param argument="min_cluster_size" type="integer" value="50" label="The minimum size of clusters"/> 316 <param argument="min_cluster_size" type="integer" value="50" label="The minimum size of clusters"/>
254 <expand macro="param_random_state"/> 317 <expand macro="param_random_state"/>
255 <expand macro="param_key_added" key_added="pseudo_cell"/> 318 <expand macro="param_key_added" key_added="pseudo_cell"/>
256 </when> 319 </when>
257 </conditional> 320 </conditional>
258 <expand macro="inputs_common_advanced"/> 321 <expand macro="param_common_advanced"/>
259 </inputs> 322 </inputs>
260 <outputs> 323 <outputs>
261 <data name="anndata_out" format="h5ad" from_work_dir="anndata.h5ad" label="${tool.name} (${method.method}) on ${on_string}: Annotated data matrix"/> 324 <data name="anndata_out" format="h5ad" from_work_dir="anndata.h5ad.gz" label="${tool.name} (${method.method}) on ${on_string}: Annotated data matrix"/>
262 <data name="hidden_output" format="txt" label="Log file"> 325 <data name="hidden_output" format="txt" label="Log file">
263 <filter>advanced_common['show_log']</filter> 326 <filter>advanced_common['show_log']</filter>
264 </data> 327 </data>
265 <data name="diff_peaks" format="tabular" from_work_dir="differential_peaks.tsv" label="${tool.name} on ${on_string}: Differential peaks">
266 <filter>method['method'] and 'tl.diff_test' in method['method']</filter>
267 </data>
268 </outputs> 328 </outputs>
269 <tests> 329 <tests>
270 <test expect_num_outputs="2"> 330 <test expect_num_outputs="2">
271 <!-- tl.spectral --> 331 <!-- tl.spectral -->
272 <conditional name="method"> 332 <conditional name="method">
273 <param name="method" value="tl.spectral"/> 333 <param name="method" value="tl.spectral"/>
274 <param name="adata" location="https://zenodo.org/records/11260316/files/pp.select_features.pbmc_500_chr21.h5ad"/> 334 <param name="adata" location="https://zenodo.org/records/17512085/files/pp.select_features.pbmc_500_chr21.h5ad"/>
275 <param name="n_comps" value="30"/> 335 <param name="n_comps" value="30"/>
276 <param name="random_state" value="0"/> 336 <param name="random_state" value="0"/>
277 <param name="chunk_size" value="20000"/> 337 <param name="chunk_size" value="20000"/>
278 <param name="distance_metric" value="jaccard"/> 338 <param name="distance_metric" value="jaccard"/>
279 <param name="weighted_by_sd" value="True"/> 339 <param name="weighted_by_sd" value="True"/>
281 <section name="advanced_common"> 341 <section name="advanced_common">
282 <param name="show_log" value="true"/> 342 <param name="show_log" value="true"/>
283 </section> 343 </section>
284 <output name="hidden_output"> 344 <output name="hidden_output">
285 <assert_contents> 345 <assert_contents>
286 <has_text_matching expression="sa.tl.spectral"/> 346 <has_text_matching expression="snap.tl.spectral"/>
287 <has_text_matching expression="random_state = 0"/> 347 <has_text_matching expression="random_state = 0"/>
288 <has_text_matching expression="n_comps = 30"/> 348 <has_text_matching expression="n_comps = 30"/>
289 <has_text_matching expression="chunk_size = 20000"/> 349 <has_text_matching expression="chunk_size = 20000"/>
290 <has_text_matching expression="distance_metric = 'jaccard'"/> 350 <has_text_matching expression="distance_metric = 'jaccard'"/>
291 <has_text_matching expression="weighted_by_sd = True"/> 351 <has_text_matching expression="weighted_by_sd = True"/>
292 </assert_contents> 352 </assert_contents>
293 </output> 353 </output>
294 <output name="anndata_out" ftype="h5ad" compare="sim_size" delta_frac="0.1" location="https://zenodo.org/records/11260316/files/tl.spectral.pbmc_500_chr21.h5ad"/> 354 <output name="anndata_out" ftype="h5ad">
355 <assert_contents>
356 <has_h5_keys keys="uns/spectral_eigenvalue"/>
357 <has_h5_keys keys="obsm/X_spectral"/>
358 </assert_contents>
359 </output>
360 </test>
361 <test expect_num_outputs="2">
362 <!-- tl.multi_spectral -->
363 <conditional name="method">
364 <param name="method" value="tl.multi_spectral"/>
365 <param name="adata" location="https://zenodo.org/records/17512085/files/snap_datasets_pbmc10k_multiome_RNA.h5ad.gz,https://zenodo.org/records/17512085/files/snap_datasets_pbmc10k_multiome_ATAC.h5ad.gz"/>
366 <param name="n_comps" value="30"/>
367 <param name="random_state" value="0"/>
368 <param name="weighted_by_sd" value="True"/>
369 </conditional>
370 <section name="advanced_common">
371 <param name="show_log" value="true"/>
372 </section>
373 <output name="hidden_output">
374 <assert_contents>
375 <has_text_matching expression="snap.tl.multi_spectral"/>
376 <has_text_matching expression="random_state = 0"/>
377 <has_text_matching expression="n_comps = 30"/>
378 <has_text_matching expression="weighted_by_sd = True"/>
379 <has_text_matching expression="features = None"/>
380 </assert_contents>
381 </output>
382 <output name="anndata_out" ftype="h5ad">
383 <assert_contents>
384 <has_h5_keys keys="uns/spectral_eigenvalue_joint"/>
385 <has_h5_keys keys="obsm/X_joint"/>
386 </assert_contents>
387 </output>
295 </test> 388 </test>
296 <test expect_num_outputs="2"> 389 <test expect_num_outputs="2">
297 <!-- tl.umap --> 390 <!-- tl.umap -->
298 <conditional name="method"> 391 <conditional name="method">
299 <param name="method" value="tl.umap"/> 392 <param name="method" value="tl.umap"/>
300 <param name="adata" location="https://zenodo.org/records/11260316/files/tl.spectral.pbmc_500_chr21.h5ad"/> 393 <param name="adata" location="https://zenodo.org/records/17512085/files/tl.spectral.pbmc_500_chr21.h5ad"/>
301 <param name="n_comps" value="2"/> 394 <param name="n_comps" value="2"/>
302 <param name="use_rep" value="X_spectral"/> 395 <param name="use_rep" value="X_spectral"/>
303 <param name="key_added" value="umap"/> 396 <param name="key_added" value="umap"/>
304 <param name="random_state" value="0"/> 397 <param name="random_state" value="0"/>
305 </conditional> 398 </conditional>
306 <section name="advanced_common"> 399 <section name="advanced_common">
307 <param name="show_log" value="true"/> 400 <param name="show_log" value="true"/>
308 </section> 401 </section>
309 <output name="hidden_output"> 402 <output name="hidden_output">
310 <assert_contents> 403 <assert_contents>
311 <has_text_matching expression="sa.tl.umap"/> 404 <has_text_matching expression="snap.tl.umap"/>
312 <has_text_matching expression="n_comps = 2"/> 405 <has_text_matching expression="n_comps = 2"/>
313 <has_text_matching expression="use_rep = 'X_spectral'"/> 406 <has_text_matching expression="use_rep = 'X_spectral'"/>
314 <has_text_matching expression="key_added = 'umap'"/> 407 <has_text_matching expression="key_added = 'umap'"/>
315 <has_text_matching expression="random_state = 0"/> 408 <has_text_matching expression="random_state = 0"/>
316 </assert_contents> 409 </assert_contents>
317 </output> 410 </output>
318 <output name="anndata_out" ftype="h5ad" compare="sim_size" delta_frac="0.1" location="https://zenodo.org/records/11260316/files/tl.umap.pbmc_500_chr21.h5ad"/> 411 <output name="anndata_out" ftype="h5ad">
412 <assert_contents>
413 <has_h5_keys keys="obsm/X_umap"/>
414 </assert_contents>
415 </output>
319 </test> 416 </test>
320 <test expect_num_outputs="2"> 417 <test expect_num_outputs="2">
321 <!-- pp.knn --> 418 <!-- pp.knn -->
322 <conditional name="method"> 419 <conditional name="method">
323 <param name="method" value="pp.knn"/> 420 <param name="method" value="pp.knn"/>
324 <param name="adata" location="https://zenodo.org/records/11260316/files/tl.umap.pbmc_500_chr21.h5ad"/> 421 <param name="adata" location="https://zenodo.org/records/17512085/files/tl.umap.pbmc_500_chr21.h5ad"/>
325 <param name="n_neighbors" value="50"/> 422 <param name="n_neighbors" value="50"/>
326 <param name="use_rep" value="X_spectral"/> 423 <param name="use_rep" value="X_spectral"/>
327 <param name="method_" value="kdtree"/> 424 <param name="algorithm" value="kdtree"/>
328 <param name="inplace" value="True"/> 425 <param name="random_state" value="0"/>
329 <param name="random_state" value="0"/> 426 </conditional>
330 </conditional> 427 <section name="advanced_common">
331 <section name="advanced_common"> 428 <param name="show_log" value="true"/>
332 <param name="show_log" value="true"/> 429 </section>
333 </section> 430 <output name="hidden_output">
334 <output name="hidden_output"> 431 <assert_contents>
335 <assert_contents> 432 <has_text_matching expression="snap.pp.knn"/>
336 <has_text_matching expression="sa.pp.knn"/>
337 <has_text_matching expression="n_neighbors = 50"/> 433 <has_text_matching expression="n_neighbors = 50"/>
338 <has_text_matching expression="use_rep = 'X_spectral'"/> 434 <has_text_matching expression="use_rep = 'X_spectral'"/>
339 <has_text_matching expression="method = 'kdtree'"/> 435 <has_text_matching expression="method = 'kdtree'"/>
340 <has_text_matching expression="inplace = True"/> 436 <has_text_matching expression="inplace = True"/>
341 <has_text_matching expression="random_state = 0"/> 437 <has_text_matching expression="random_state = 0"/>
342 </assert_contents> 438 </assert_contents>
343 </output> 439 </output>
344 <output name="anndata_out" ftype="h5ad" compare="sim_size" delta_frac="0.1" location="https://zenodo.org/records/11260316/files/pp.knn.pbmc_500_chr21.h5ad"/> 440 <output name="anndata_out" ftype="h5ad">
441 <assert_contents>
442 <has_h5_keys keys="obsp/distances"/>
443 </assert_contents>
444 </output>
345 </test> 445 </test>
346 <test expect_num_outputs="2"> 446 <test expect_num_outputs="2">
347 <!-- tl.leiden --> 447 <!-- tl.leiden -->
348 <conditional name="method"> 448 <conditional name="method">
349 <param name="method" value="tl.leiden"/> 449 <param name="method" value="tl.leiden"/>
350 <param name="adata" location="https://zenodo.org/records/11260316/files/pp.knn.pbmc_500_chr21.h5ad"/> 450 <param name="adata" location="https://zenodo.org/records/17512085/files/pp.knn.pbmc_500_chr21.h5ad"/>
351 <param name="resolution" value="2"/> 451 <param name="resolution" value="2"/>
352 <param name="objective_function" value="modularity"/> 452 <param name="objective_function" value="modularity"/>
353 <param name="min_cluster_size" value="3"/> 453 <param name="min_cluster_size" value="3"/>
354 <param name="n_iterations" value="-1"/> 454 <param name="n_iterations" value="-1"/>
355 <param name="random_state" value="0"/> 455 <param name="random_state" value="0"/>
359 <section name="advanced_common"> 459 <section name="advanced_common">
360 <param name="show_log" value="true"/> 460 <param name="show_log" value="true"/>
361 </section> 461 </section>
362 <output name="hidden_output"> 462 <output name="hidden_output">
363 <assert_contents> 463 <assert_contents>
364 <has_text_matching expression="sa.tl.leiden"/> 464 <has_text_matching expression="snap.tl.leiden"/>
365 <has_text_matching expression="resolution = 2"/> 465 <has_text_matching expression="resolution = 2"/>
366 <has_text_matching expression="objective_function = 'modularity'"/> 466 <has_text_matching expression="objective_function = 'modularity'"/>
367 <has_text_matching expression="min_cluster_size = 3"/> 467 <has_text_matching expression="min_cluster_size = 3"/>
368 <has_text_matching expression="n_iterations = -1"/> 468 <has_text_matching expression="n_iterations = -1"/>
369 <has_text_matching expression="random_state = 0"/> 469 <has_text_matching expression="random_state = 0"/>
370 <has_text_matching expression="key_added = 'leiden'"/> 470 <has_text_matching expression="key_added = 'leiden'"/>
371 <has_text_matching expression="weighted = False"/> 471 <has_text_matching expression="weighted = False"/>
372 </assert_contents> 472 </assert_contents>
373 </output> 473 </output>
374 <output name="anndata_out" ftype="h5ad" compare="sim_size" delta_frac="0.1" location="https://zenodo.org/records/11260316/files/tl.leiden.modularity.pbmc_500_chr21.h5ad"/> 474 <output name="anndata_out" ftype="h5ad">
475 <assert_contents>
476 <has_h5_keys keys="obs/leiden"/>
477 </assert_contents>
478 </output>
375 </test> 479 </test>
376 <test expect_num_outputs="2"> 480 <test expect_num_outputs="2">
377 <!-- tl.leiden --> 481 <!-- tl.leiden -->
378 <conditional name="method"> 482 <conditional name="method">
379 <param name="method" value="tl.leiden"/> 483 <param name="method" value="tl.leiden"/>
380 <param name="adata" location="https://zenodo.org/records/11260316/files/pp.knn.pbmc_500_chr21.h5ad"/> 484 <param name="adata" location="https://zenodo.org/records/17512085/files/pp.knn.pbmc_500_chr21.h5ad"/>
381 <param name="resolution" value="2"/> 485 <param name="resolution" value="2"/>
382 <param name="objective_function" value="RBConfiguration"/> 486 <param name="objective_function" value="RBConfiguration"/>
383 <param name="min_cluster_size" value="3"/> 487 <param name="min_cluster_size" value="3"/>
384 <param name="n_iterations" value="-1"/> 488 <param name="n_iterations" value="-1"/>
385 <param name="random_state" value="0"/> 489 <param name="random_state" value="0"/>
389 <section name="advanced_common"> 493 <section name="advanced_common">
390 <param name="show_log" value="true"/> 494 <param name="show_log" value="true"/>
391 </section> 495 </section>
392 <output name="hidden_output"> 496 <output name="hidden_output">
393 <assert_contents> 497 <assert_contents>
394 <has_text_matching expression="sa.tl.leiden"/> 498 <has_text_matching expression="snap.tl.leiden"/>
395 <has_text_matching expression="resolution = 2"/> 499 <has_text_matching expression="resolution = 2"/>
396 <has_text_matching expression="objective_function = 'RBConfiguration'"/> 500 <has_text_matching expression="objective_function = 'RBConfiguration'"/>
397 <has_text_matching expression="min_cluster_size = 3"/> 501 <has_text_matching expression="min_cluster_size = 3"/>
398 <has_text_matching expression="n_iterations = -1"/> 502 <has_text_matching expression="n_iterations = -1"/>
399 <has_text_matching expression="random_state = 0"/> 503 <has_text_matching expression="random_state = 0"/>
400 <has_text_matching expression="key_added = 'leiden'"/> 504 <has_text_matching expression="key_added = 'leiden'"/>
401 <has_text_matching expression="weighted = False"/> 505 <has_text_matching expression="weighted = False"/>
402 </assert_contents> 506 </assert_contents>
403 </output> 507 </output>
404 <output name="anndata_out" ftype="h5ad" compare="sim_size" delta_frac="0.1" location="https://zenodo.org/records/11260316/files/tl.leiden.RBConfiguration.pbmc_500_chr21.h5ad"/> 508 <output name="anndata_out" ftype="h5ad">
509 <assert_contents>
510 <has_h5_keys keys="obs/leiden"/>
511 </assert_contents>
512 </output>
405 </test> 513 </test>
406 <test expect_num_outputs="2"> 514 <test expect_num_outputs="2">
407 <!-- tl.kmeans --> 515 <!-- tl.kmeans -->
408 <conditional name="method"> 516 <conditional name="method">
409 <param name="method" value="tl.kmeans"/> 517 <param name="method" value="tl.kmeans"/>
410 <param name="adata" location="https://zenodo.org/records/11260316/files/tl.spectral.pbmc_500_chr21.h5ad"/> 518 <param name="adata" location="https://zenodo.org/records/17512085/files/tl.spectral.pbmc_500_chr21.h5ad"/>
411 <param name="n_iterations" value="-1"/> 519 <param name="n_iterations" value="-1"/>
412 <param name="random_state" value="0"/> 520 <param name="random_state" value="0"/>
413 <param name="use_rep" value="X_spectral"/> 521 <param name="use_rep" value="X_spectral"/>
414 <param name="key_added" value="kmeans"/> 522 <param name="key_added" value="kmeans"/>
415 </conditional> 523 </conditional>
416 <section name="advanced_common"> 524 <section name="advanced_common">
417 <param name="show_log" value="true"/> 525 <param name="show_log" value="true"/>
418 </section> 526 </section>
419 <output name="hidden_output"> 527 <output name="hidden_output">
420 <assert_contents> 528 <assert_contents>
421 <has_text_matching expression="sa.tl.kmeans"/> 529 <has_text_matching expression="snap.tl.kmeans"/>
422 <has_text_matching expression="n_iterations = -1"/> 530 <has_text_matching expression="n_iterations = -1"/>
423 <has_text_matching expression="random_state = 0"/> 531 <has_text_matching expression="random_state = 0"/>
424 <has_text_matching expression="use_rep = 'X_spectral'"/> 532 <has_text_matching expression="use_rep = 'X_spectral'"/>
425 <has_text_matching expression="key_added = 'kmeans'"/> 533 <has_text_matching expression="key_added = 'kmeans'"/>
426 </assert_contents> 534 </assert_contents>
427 </output> 535 </output>
428 <output name="anndata_out" ftype="h5ad" compare="sim_size" delta_frac="0.1" location="https://zenodo.org/records/11260316/files/tl.kmeans.pbmc_500_chr21.h5ad"/> 536 <output name="anndata_out" ftype="h5ad">
537 <assert_contents>
538 <has_h5_keys keys="obs/kmeans"/>
539 </assert_contents>
540 </output>
429 </test> 541 </test>
430 <test expect_num_outputs="2"> 542 <test expect_num_outputs="2">
431 <!-- tl.dbscan --> 543 <!-- tl.dbscan -->
432 <conditional name="method"> 544 <conditional name="method">
433 <param name="method" value="tl.dbscan"/> 545 <param name="method" value="tl.dbscan"/>
434 <param name="adata" location="https://zenodo.org/records/11260316/files/tl.spectral.pbmc_500_chr21.h5ad"/> 546 <param name="adata" location="https://zenodo.org/records/17512085/files/tl.spectral.pbmc_500_chr21.h5ad"/>
435 <param name="eps" value="0.5"/> 547 <param name="eps" value="0.5"/>
436 <param name="min_samples" value="3"/> 548 <param name="min_samples" value="3"/>
437 <param name="leaf_size" value="5"/> 549 <param name="leaf_size" value="5"/>
438 <param name="use_rep" value="X_spectral"/> 550 <param name="use_rep" value="X_spectral"/>
439 <param name="key_added" value="dbscan"/> 551 <param name="key_added" value="dbscan"/>
441 <section name="advanced_common"> 553 <section name="advanced_common">
442 <param name="show_log" value="true"/> 554 <param name="show_log" value="true"/>
443 </section> 555 </section>
444 <output name="hidden_output"> 556 <output name="hidden_output">
445 <assert_contents> 557 <assert_contents>
446 <has_text_matching expression="sa.tl.dbscan"/> 558 <has_text_matching expression="snap.tl.dbscan"/>
447 <has_text_matching expression="eps = 0.5"/> 559 <has_text_matching expression="eps = 0.5"/>
448 <has_text_matching expression="min_samples = 3"/> 560 <has_text_matching expression="min_samples = 3"/>
449 <has_text_matching expression="leaf_size = 5"/> 561 <has_text_matching expression="leaf_size = 5"/>
450 <has_text_matching expression="use_rep = 'X_spectral'"/> 562 <has_text_matching expression="use_rep = 'X_spectral'"/>
451 <has_text_matching expression="key_added = 'dbscan'"/> 563 <has_text_matching expression="key_added = 'dbscan'"/>
452 </assert_contents> 564 </assert_contents>
453 </output> 565 </output>
454 <output name="anndata_out" ftype="h5ad" compare="sim_size" delta_frac="0.1" location="https://zenodo.org/records/11260316/files/tl.dbscan.pbmc_500_chr21.h5ad"/> 566 <output name="anndata_out" ftype="h5ad">
567 <assert_contents>
568 <has_h5_keys keys="obs/dbscan"/>
569 </assert_contents>
570 </output>
455 </test> 571 </test>
456 <test expect_num_outputs="2"> 572 <test expect_num_outputs="2">
457 <!-- tl.hdbscan --> 573 <!-- tl.hdbscan -->
458 <conditional name="method"> 574 <conditional name="method">
459 <param name="method" value="tl.hdbscan"/> 575 <param name="method" value="tl.hdbscan"/>
460 <param name="adata" location="https://zenodo.org/records/11260316/files/tl.spectral.pbmc_500_chr21.h5ad"/> 576 <param name="adata" location="https://zenodo.org/records/17512085/files/tl.spectral.pbmc_500_chr21.h5ad"/>
461 <param name="min_cluster_size" value="3"/> 577 <param name="min_cluster_size" value="3"/>
462 <param name="min_samples" value="3"/> 578 <param name="min_samples" value="3"/>
463 <param name="cluster_selection_method" value="eom"/> 579 <param name="cluster_selection_method" value="eom"/>
464 <param name="random_state" value="0"/> 580 <param name="random_state" value="0"/>
465 <param name="use_rep" value="X_spectral"/> 581 <param name="use_rep" value="X_spectral"/>
468 <section name="advanced_common"> 584 <section name="advanced_common">
469 <param name="show_log" value="true"/> 585 <param name="show_log" value="true"/>
470 </section> 586 </section>
471 <output name="hidden_output"> 587 <output name="hidden_output">
472 <assert_contents> 588 <assert_contents>
473 <has_text_matching expression="sa.tl.hdbscan"/> 589 <has_text_matching expression="snap.tl.hdbscan"/>
474 <has_text_matching expression="min_cluster_size = 3"/> 590 <has_text_matching expression="min_cluster_size = 3"/>
475 <has_text_matching expression="min_samples = 3"/> 591 <has_text_matching expression="min_samples = 3"/>
476 <has_text_matching expression="cluster_selection_method = 'eom'"/> 592 <has_text_matching expression="cluster_selection_method = 'eom'"/>
477 <has_text_matching expression="random_state = 0"/> 593 <has_text_matching expression="random_state = 0"/>
478 <has_text_matching expression="use_rep = 'X_spectral'"/> 594 <has_text_matching expression="use_rep = 'X_spectral'"/>
479 <has_text_matching expression="key_added = 'hdbscan'"/> 595 <has_text_matching expression="key_added = 'hdbscan'"/>
480 </assert_contents> 596 </assert_contents>
481 </output> 597 </output>
482 <output name="anndata_out" ftype="h5ad" compare="sim_size" delta_frac="0.1" location="https://zenodo.org/records/11260316/files/tl.hdbscan.pbmc_500_chr21.h5ad"/> 598 <output name="anndata_out" ftype="h5ad">
483 </test> 599 <assert_contents>
484 <test expect_num_outputs="2"> 600 <has_h5_keys keys="obs/hdbscan"/>
485 <!-- tl.aggregate_X --> 601 </assert_contents>
602 </output>
603 </test>
604 <!-- <test expect_num_outputs="2">
605 tl.aggregate_X
486 <conditional name="method"> 606 <conditional name="method">
487 <param name="method" value="tl.aggregate_X"/> 607 <param name="method" value="tl.aggregate_X"/>
488 <param name="adata" location="https://zenodo.org/records/11260316/files/tl.spectral.pbmc_500_chr21.h5ad"/> 608 <param name="adata" location="https://zenodo.org/records/17512085/files/tl.spectral.pbmc_500_chr21.h5ad"/>
489 <param name="normalize" value="RPKM"/> 609 <param name="normalize" value="RPKM"/>
490 </conditional> 610 </conditional>
491 <section name="advanced_common"> 611 <section name="advanced_common">
492 <param name="show_log" value="true"/> 612 <param name="show_log" value="true"/>
493 </section> 613 </section>
494 <output name="hidden_output"> 614 <output name="hidden_output">
495 <assert_contents> 615 <assert_contents>
496 <has_text_matching expression="sa.tl.aggregate_X"/> 616 <has_text_matching expression="snap.tl.aggregate_X"/>
497 <has_text_matching expression="normalize = 'RPKM'"/> 617 <has_text_matching expression="normalize = 'RPKM'"/>
498 </assert_contents> 618 </assert_contents>
499 </output> 619 </output>
500 <output name="anndata_out" ftype="h5ad" compare="sim_size" delta_frac="0.1" location="https://zenodo.org/records/11260316/files/tl.aggregate_X.pbmc_500_chr21.h5ad"/> 620 <output name="anndata_out" ftype="h5ad">
501 </test> 621 <assert_contents>
622 <has_h5_keys keys="obs/n_fragment"/>
623 </assert_contents>
624 </output>
625 </test> -->
502 <test expect_num_outputs="2"> 626 <test expect_num_outputs="2">
503 <!-- tl.aggregate_cells --> 627 <!-- tl.aggregate_cells -->
504 <conditional name="method"> 628 <conditional name="method">
505 <param name="method" value="tl.aggregate_cells"/> 629 <param name="method" value="tl.aggregate_cells"/>
506 <param name="adata" location="https://zenodo.org/records/11260316/files/tl.spectral.pbmc_500_chr21.h5ad"/> 630 <param name="adata" location="https://zenodo.org/records/17512085/files/tl.spectral.pbmc_500_chr21.h5ad"/>
507 <param name="use_rep" value="X_spectral"/> 631 <param name="use_rep" value="X_spectral"/>
508 <param name="target_num_cells" value="5"/> 632 <param name="target_num_cells" value="5"/>
509 <param name="min_cluster_size" value="3"/> 633 <param name="min_cluster_size" value="3"/>
510 <param name="random_state" value="0"/> 634 <param name="random_state" value="0"/>
511 <param name="key_added" value="pseudo_cell"/> 635 <param name="key_added" value="pseudo_cell"/>
513 <section name="advanced_common"> 637 <section name="advanced_common">
514 <param name="show_log" value="true"/> 638 <param name="show_log" value="true"/>
515 </section> 639 </section>
516 <output name="hidden_output"> 640 <output name="hidden_output">
517 <assert_contents> 641 <assert_contents>
518 <has_text_matching expression="sa.tl.aggregate_cells"/> 642 <has_text_matching expression="snap.tl.aggregate_cells"/>
519 <has_text_matching expression="use_rep = 'X_spectral'"/> 643 <has_text_matching expression="use_rep = 'X_spectral'"/>
520 <has_text_matching expression="target_num_cells = 5"/> 644 <has_text_matching expression="target_num_cells = 5"/>
521 <has_text_matching expression="min_cluster_size = 3"/> 645 <has_text_matching expression="min_cluster_size = 3"/>
522 <has_text_matching expression="random_state = 0"/> 646 <has_text_matching expression="random_state = 0"/>
523 <has_text_matching expression="key_added = 'pseudo_cell'"/> 647 <has_text_matching expression="key_added = 'pseudo_cell'"/>
524 </assert_contents> 648 </assert_contents>
525 </output> 649 </output>
526 <output name="anndata_out" ftype="h5ad" compare="sim_size" delta_frac="0.1" location="https://zenodo.org/records/11260316/files/tl.aggregate_cells.pbmc_500_chr21.h5ad"/> 650 <output name="anndata_out" ftype="h5ad">
651 <assert_contents>
652 <has_h5_keys keys="obs/pseudo_cell"/>
653 </assert_contents>
654 </output>
527 </test> 655 </test>
528 </tests> 656 </tests>
529 <help><![CDATA[ 657 <help><![CDATA[
530 Perform dimension reduction using Laplacian Eigenmap, using `tl.spectral` 658 Perform dimension reduction using Laplacian Eigenmap, using `tl.spectral`
531 ========================================================================= 659 =========================================================================
533 Perform dimension reduction using Laplacian Eigenmaps. 661 Perform dimension reduction using Laplacian Eigenmaps.
534 662
535 Convert the cell-by-feature count matrix into lower dimensional representations using the spectrum of the normalized graph Laplacian defined by pairwise similarity between cells. This function utilizes the matrix-free spectral embedding algorithm to compute the embedding when `distance_metric` is “cosine”, which scales linearly with the number of cells. For other types of similarity metrics, the time and space complexity scale quadratically with the number of cells. 663 Convert the cell-by-feature count matrix into lower dimensional representations using the spectrum of the normalized graph Laplacian defined by pairwise similarity between cells. This function utilizes the matrix-free spectral embedding algorithm to compute the embedding when `distance_metric` is “cosine”, which scales linearly with the number of cells. For other types of similarity metrics, the time and space complexity scale quadratically with the number of cells.
536 664
537 More details on the `SnapATAC2 documentation 665 More details on the `SnapATAC2 documentation
538 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.tl.spectral.html>`__ 666 <https://scverse.org/SnapATAC2/api/_autosummary/snapatac2.tl.spectral.html>`__
667
668 Compute Laplacian Eigenmaps simultaneously on multiple modalities, with linear space and time complexity, using `tl.multi_spectral`
669 ===================================================================================================================================
670
671 This is similar to `spectral`, but it can work on multiple modalities.
672
673 More details on the `SnapATAC2 documentation
674 <https://scverse.org/SnapATAC2/api/_autosummary/snapatac2.tl.multi_spectral.html>`__
539 675
540 Compute Umap, using `tl.umap` 676 Compute Umap, using `tl.umap`
541 ============================= 677 =============================
542 678
543 Compute Umap 679 Compute Umap
544 680
545 More details on the `SnapATAC2 documentation 681 More details on the `SnapATAC2 documentation
546 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.tl.umap.html>`__ 682 <https://scverse.org/SnapATAC2/api/_autosummary/snapatac2.tl.umap.html>`__
547 683
548 Compute a neighborhood graph of observations, using `pp.knn` 684 Compute a neighborhood graph of observations, using `pp.knn`
549 ============================================================ 685 ============================================================
550 686
551 Compute a neighborhood graph of observations. 687 Compute a neighborhood graph of observations.
552 688
553 Computes a neighborhood graph of observations stored in adata using the method specified by method. The distance metric used is Euclidean. 689 Computes a neighborhood graph of observations stored in adata using the method specified by method. The distance metric used is Euclidean.
554 690
555 More details on the `SnapATAC2 documentation 691 More details on the `SnapATAC2 documentation
556 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.pp.knn.html>`__ 692 <https://scverse.org/SnapATAC2/api/_autosummary/snapatac2.pp.knn.html>`__
557 693
558 Cluster cells into subgroups, using `tl.leiden` 694 Cluster cells into subgroups, using `tl.leiden`
559 =============================================== 695 ===============================================
560 696
561 Cluster cells into subgroups. 697 Cluster cells into subgroups.
562 698
563 Cluster cells using the Leiden algorithm, an improved version of the Louvain algorithm. It has been proposed for single-cell analysis by. This requires having ran `knn`. 699 Cluster cells using the Leiden algorithm, an improved version of the Louvain algorithm. It has been proposed for single-cell analysis by. This requires having ran `knn`.
564 700
565 More details on the `SnapATAC2 documentation 701 More details on the `SnapATAC2 documentation
566 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.tl.leiden.html>`__ 702 <https://scverse.org/SnapATAC2/api/_autosummary/snapatac2.tl.leiden.html>`__
567 703
568 Cluster cells into subgroups using the K-means algorithm, using `tl.kmeans` 704 Cluster cells into subgroups using the K-means algorithm, using `tl.kmeans`
569 =========================================================================== 705 ===========================================================================
570 706
571 Cluster cells into subgroups using the K-means algorithm, a classical algorithm in data mining. 707 Cluster cells into subgroups using the K-means algorithm, a classical algorithm in data mining.
572 708
573 More details on the `SnapATAC2 documentation 709 More details on the `SnapATAC2 documentation
574 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.tl.kmeans.html>`__ 710 <https://scverse.org/SnapATAC2/api/_autosummary/snapatac2.tl.kmeans.html>`__
575 711
576 Cluster cells into subgroups using the DBSCAN algorithm, using `tl.dbscan` 712 Cluster cells into subgroups using the DBSCAN algorithm, using `tl.dbscan`
577 ========================================================================== 713 ==========================================================================
578 714
579 Cluster cells into subgroups using the DBSCAN algorithm. 715 Cluster cells into subgroups using the DBSCAN algorithm.
580 716
581 More details on the `SnapATAC2 documentation 717 More details on the `SnapATAC2 documentation
582 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.tl.dbscan.html>`__ 718 <https://scverse.org/SnapATAC2/api/_autosummary/snapatac2.tl.dbscan.html>`__
583 719
584 Cluster cells into subgroups using the HDBSCAN algorithm, using `tl.hdbscan` 720 Cluster cells into subgroups using the HDBSCAN algorithm, using `tl.hdbscan`
585 ============================================================================ 721 ============================================================================
586 722
587 Cluster cells into subgroups using the HDBSCAN algorithm. 723 Cluster cells into subgroups using the HDBSCAN algorithm.
588 724
589 More details on the `SnapATAC2 documentation 725 More details on the `SnapATAC2 documentation
590 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.tl.hdbscan.html>`__ 726 <https://scverse.org/SnapATAC2/api/_autosummary/snapatac2.tl.hdbscan.html>`__
591 727
592 Aggregate values in adata.X in a row-wise fashion, using `tl.aggregate_X` 728 .. Aggregate values in adata.X in a row-wise fashion, using `tl.aggregate_X`
593 ========================================================================= 729 .. =========================================================================
594 730
595 Aggregate values in adata.X in a row-wise fashion. 731 .. Aggregate values in adata.X in a row-wise fashion.
596 732
597 Aggregate values in adata.X in a row-wise fashion. This is used to compute RPKM or RPM values stratified by user-provided groupings. 733 .. Aggregate values in adata.X in a row-wise fashion. This is used to compute RPKM or RPM values stratified by user-provided groupings.
598 734
599 More details on the `SnapATAC2 documentation 735 .. More details on the `SnapATAC2 documentation
600 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.tl.aggregate_X.html>`__ 736 .. <https://scverse.org/SnapATAC2/api/_autosummary/snapatac2.tl.aggregate_X.html>`__
601 737
602 Aggregate cells into pseudo-cells, using `tl.aggregate_cells` 738 Aggregate cells into pseudo-cells, using `tl.aggregate_cells`
603 ============================================================= 739 =============================================================
604 740
605 Aggregate cells into pseudo-cells. 741 Aggregate cells into pseudo-cells.
606 742
607 Aggregate cells into pseudo-cells by iterative clustering. 743 Aggregate cells into pseudo-cells by iterative clustering.
608 744
609 More details on the `SnapATAC2 documentation 745 More details on the `SnapATAC2 documentation
610 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.tl.aggregate_cells.html>`__ 746 <https://scverse.org/SnapATAC2/api/_autosummary/snapatac2.tl.aggregate_cells.html>`__
611 ]]></help> 747 ]]></help>
612 <expand macro="citations"/> 748 <expand macro="citations"/>
613 </tool> 749 </tool>