Mercurial > repos > iuc > snapatac2_preprocessing
comparison preprocessing.xml @ 0:00a6721e1f81 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/snapatac2 commit be132b56781bede5dc6e020aa80ca315546666cd
author | iuc |
---|---|
date | Thu, 16 May 2024 13:17:14 +0000 |
parents | |
children | cec3e76eaf05 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:00a6721e1f81 |
---|---|
1 <tool id="snapatac2_preprocessing" name="SnapATAC2 Preprocessing" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@"> | |
2 <description>and integration</description> | |
3 <macros> | |
4 <import>macros.xml</import> | |
5 </macros> | |
6 <requirements> | |
7 <expand macro="requirements"/> | |
8 </requirements> | |
9 <command detect_errors="exit_code"><![CDATA[ | |
10 #if $method.method != 'pp.make_fragment_file' and $method.method != 'pp.import_data' | |
11 @PREP_ADATA@ | |
12 #end if | |
13 @CMD@ | |
14 ]]></command> | |
15 <configfiles> | |
16 <configfile name="script_file"><![CDATA[ | |
17 @CMD_imports@ | |
18 | |
19 #if $method.method != 'pp.make_fragment_file' and $method.method != 'pp.import_data' | |
20 @CMD_read_inputs@ | |
21 #end if | |
22 | |
23 #if $method.method == 'pp.make_fragment_file' | |
24 sa.pp.make_fragment_file( | |
25 bam_file = '$method.bam_file', | |
26 is_paired = $method.is_paired, | |
27 #if $method.barcode.extract_type == 'from_tag' | |
28 #if $method.barcode.barcode_tag != '' | |
29 barcode_tag = '$method.barcode.barcode_tag', | |
30 #end if | |
31 #elif $method.barcode.extract_type == 'from_read_names' | |
32 #if $method.barcode.barcode_regex != '' | |
33 barcode_regex = '$method.barcode.barcode_regex', | |
34 #end if | |
35 #end if | |
36 #if $method.umi_tag != '' | |
37 umi_tag = '$method.umi_tag', | |
38 #end if | |
39 #if $method.umi_regex != '' | |
40 umi_regex = '$method.umi_regex', | |
41 #end if | |
42 shift_right = $method.shift_right, | |
43 shift_left = $method.shift_left, | |
44 min_mapq = $method.min_mapq, | |
45 chunk_size = $method.chunk_size, | |
46 compression = 'gzip', | |
47 output_file = '$fragments_out', | |
48 tempdir = "." | |
49 ) | |
50 | |
51 #else if $method.method == 'pp.import_data' | |
52 import csv | |
53 with open('$method.chrom_sizes') as f: | |
54 chr_sizes = {x[0]:int(x[1]) for x in csv.reader(f, delimiter='\t')} | |
55 | |
56 sa.pp.import_data( | |
57 fragment_file = '$method.fragment_file', | |
58 chrom_sizes = chr_sizes, | |
59 min_num_fragments = $method.min_num_fragments, | |
60 sorted_by_barcode = $method.sorted_by_barcode, | |
61 #if str($method.whitelist) != 'None' | |
62 whitelist = '$method.whitelist', | |
63 #end if | |
64 shift_left = $method.shift_left, | |
65 shift_right = $method.shift_right, | |
66 #set $chr_mt = ([x.strip() for x in str($method.chrM).split(',')]) | |
67 chrM = $chr_mt, | |
68 chunk_size = $method.chunk_size, | |
69 file = 'anndata.h5ad', | |
70 n_jobs = os.getenv("GALAXY_SLOTS", 4) | |
71 ) | |
72 | |
73 #else if $method.method == 'pp.add_tile_matrix' | |
74 sa.pp.add_tile_matrix( | |
75 adata, | |
76 bin_size = $method.bin_size, | |
77 inplace = True, | |
78 chunk_size = $method.chunk_size, | |
79 #if $method.exclude_chroms != '' | |
80 #set $excl_chroms = ([x.strip() for x in str($method.exclude_chroms).split(',')]) | |
81 exclude_chroms = $excl_chroms, | |
82 #end if | |
83 #if $method.min_frag_size | |
84 min_frag_size = $method.min_frag_size, | |
85 #end if | |
86 #if $method.max_frag_size | |
87 max_frag_size = $method.max_frag_size, | |
88 #end if | |
89 ##counting_strategy = '$method.counting_strategy', | |
90 count_frag_as_reads = $method.count_frag_as_reads, | |
91 n_jobs = os.getenv("GALAXY_SLOTS", 4) | |
92 ) | |
93 | |
94 #else if $method.method == 'pp.make_gene_matrix' | |
95 sa.pp.make_gene_matrix( | |
96 adata, | |
97 gene_anno = '$method.gene_anno', | |
98 inplace = True, | |
99 chunk_size = $method.chunk_size, | |
100 use_x = $method.use_x, | |
101 id_type = '$method.id_type', | |
102 transcript_name_key = '$method.transcript_name_key', | |
103 transcript_id_key = '$method.transcript_id_key', | |
104 gene_name_key = '$method.gene_name_key', | |
105 gene_id_key = '$method.gene_id_key', | |
106 #if $method.min_frag_size | |
107 min_frag_size = $method.min_frag_size, | |
108 #end if | |
109 #if $method.max_frag_size | |
110 max_frag_size = $method.max_frag_size, | |
111 #end if | |
112 ##counting_strategy = '$method.counting_strategy' | |
113 count_frag_as_reads = $method.count_frag_as_reads | |
114 ) | |
115 | |
116 #else if $method.method == 'pp.filter_cells' | |
117 sa.pp.filter_cells( | |
118 adata, | |
119 min_counts = $method.min_counts, | |
120 min_tsse = $method.min_tsse, | |
121 #if $method.max_counts | |
122 max_counts = $method.max_counts, | |
123 #end if | |
124 #if $method.max_tsse | |
125 max_tsse = $method.max_tsse, | |
126 #end if | |
127 inplace = True, | |
128 n_jobs = os.getenv("GALAXY_SLOTS", 4) | |
129 ) | |
130 | |
131 #else if $method.method == 'pp.select_features' | |
132 sa.pp.select_features( | |
133 adata, | |
134 n_features = $method.n_features, | |
135 filter_lower_quantile = $method.filter_lower_quantile, | |
136 filter_upper_quantile = $method.filter_upper_quantile, | |
137 #if str($method.whitelist) != 'None' | |
138 whitelist = '$method.whitelist', | |
139 #end if | |
140 #if str($method.blacklist) != 'None' | |
141 blacklist = '$method.blacklist', | |
142 #end if | |
143 max_iter = $method.max_iter, | |
144 inplace = True, | |
145 n_jobs = os.getenv("GALAXY_SLOTS", 4) | |
146 ) | |
147 | |
148 #else if $method.method == 'pp.scrublet' | |
149 sa.pp.scrublet( | |
150 adata, | |
151 #if $method.features | |
152 features = '$method.features', | |
153 #end if | |
154 n_comps = $method.n_comps, | |
155 sim_doublet_ratio = $method.sim_doublet_ratio, | |
156 expected_doublet_rate = $method.expected_doublet_rate, | |
157 #if $method.n_neighbors | |
158 n_neighbors = $method.n_neighbors, | |
159 #end if | |
160 use_approx_neighbors = $method.use_approx_neighbors, | |
161 random_state = $method.random_state, | |
162 inplace = True, | |
163 n_jobs = os.getenv("GALAXY_SLOTS", 4) | |
164 ) | |
165 | |
166 #else if $method.method == 'pp.filter_doublets' | |
167 sa.pp.filter_doublets( | |
168 adata, | |
169 #if $method.probability_threshold | |
170 probability_threshold = $method.probability_threshold, | |
171 #end if | |
172 #if $method.score_threshold | |
173 score_threshold = $method.score_threshold, | |
174 #end if | |
175 inplace = True, | |
176 n_jobs = os.getenv("GALAXY_SLOTS", 4) | |
177 ) | |
178 | |
179 #else if $method.method == 'pp.mnc_correct' | |
180 sa.pp.mnc_correct( | |
181 adata, | |
182 batch = '$method.batch', | |
183 n_neighbors = $method.n_neighbors, | |
184 n_clusters = $method.n_clusters, | |
185 n_iter = $method.n_iter, | |
186 @CMD_params_data_integration@ | |
187 inplace = True, | |
188 n_jobs = os.getenv("GALAXY_SLOTS", 4) | |
189 ) | |
190 | |
191 #else if $method.method == 'pp.harmony' | |
192 sa.pp.harmony( | |
193 adata, | |
194 batch = '$method.batch', | |
195 @CMD_params_data_integration@ | |
196 inplace = True | |
197 ) | |
198 | |
199 #else if $method.method == 'pp.scanorama_integrate' | |
200 sa.pp.scanorama_integrate( | |
201 adata, | |
202 batch = '$method.batch', | |
203 n_neighbors = $method.n_neighbors, | |
204 @CMD_params_data_integration@ | |
205 inplace = True | |
206 ) | |
207 | |
208 #else if $method.method == 'metrics.frag_size_distr' | |
209 sa.metrics.frag_size_distr( | |
210 adata, | |
211 max_recorded_size = $method.max_recorded_size, | |
212 add_key = '$method.add_key', | |
213 inplace = True, | |
214 n_jobs = os.getenv("GALAXY_SLOTS", 4) | |
215 ) | |
216 | |
217 #else if $method.method == 'metrics.tsse' | |
218 sa.metrics.tsse( | |
219 adata, | |
220 gene_anno = '$method.gene_anno', | |
221 inplace = True, | |
222 n_jobs = os.getenv("GALAXY_SLOTS", 4) | |
223 ) | |
224 #end if | |
225 | |
226 #if $method.method != 'pp.make_fragment_file' and $method.method != 'pp.import_data' | |
227 @CMD_anndata_write_outputs@ | |
228 #end if | |
229 ]]></configfile> | |
230 </configfiles> | |
231 <inputs> | |
232 <conditional name="method"> | |
233 <param name="method" type="select" label="Method used for preprocessing"> | |
234 <option value="pp.make_fragment_file">Convert a BAM file to a fragment file, using 'pp.make_fragment_file'</option> | |
235 <option value="pp.import_data">Import data fragment files and compute basic QC metrics, using 'pp.import_data'</option> | |
236 <option value="pp.add_tile_matrix">Generate cell by bin count matrix, using 'pp.add_tile_matrix'</option> | |
237 <option value="pp.make_gene_matrix">Generate cell by gene activity matrix, using 'pp.make_gene_matrix'</option> | |
238 <option value="pp.filter_cells">Filter cell outliers based on counts and numbers of genes expressed, using 'pp.filter_cells'</option> | |
239 <option value="pp.select_features">Perform feature selection, using 'pp.select_features'</option> | |
240 <option value="pp.scrublet">Compute probability of being a doublet using the scrublet algorithm, using 'pp.scrublet'</option> | |
241 <option value="pp.filter_doublets">Remove doublets according to the doublet probability or doublet score, using 'pp.filter_doublets'</option> | |
242 <option value="pp.mnc_correct">A modified MNN-Correct algorithm based on cluster centroid, using 'pp.mnc_correct'</option> | |
243 <option value="pp.harmony">Use harmonypy to integrate different experiments,using 'pp.harmony'</option> | |
244 <option value="pp.scanorama_integrate">Use Scanorama [Hie19] to integrate different experiments, using 'pp.scanorama_integrate'</option> | |
245 <option value="metrics.frag_size_distr">Compute the fragment size distribution of the dataset, using 'metrics.frag_size_distr'</option> | |
246 <option value="metrics.tsse">Compute the TSS enrichment score (TSSe) for each cell, using 'metrics.tsse'</option> | |
247 </param> | |
248 <when value="pp.make_fragment_file"> | |
249 <param argument="bam_file" type="data" format="bam" label="File name of the BAM file"/> | |
250 <param argument="is_paired" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Indicate whether the BAM file contain paired-end reads"/> | |
251 <conditional name="barcode"> | |
252 <param name="extract_type" type="select" label="How to extract barcodes from BAM records?"> | |
253 <option value="from_tag">From TAG fileds</option> | |
254 <option value="from_read_names">From read names using regular expressions</option> | |
255 </param> | |
256 <when value="from_tag"> | |
257 <param argument="barcode_tag" type="text" value="CB" optional="true" label="Extract barcodes from TAG fields of BAM records"/> | |
258 </when> | |
259 <when value="from_read_names"> | |
260 <param argument="barcode_regex" type="text" value="" optional="true" label="Extract barcodes from read names of BAM records using regular expressions" help="`(..:..:..:..):w+$` extracts `bd:69:Y6:10` from `A01535:24:HW2MMDSX2:2:1359:8513:3458:bd:69:Y6:10:TGATAGGTT``"/> | |
261 </when> | |
262 </conditional> | |
263 <param argument="umi_tag" type="text" value="" optional="true" label="Extract UMI from TAG fields of BAM records"/> | |
264 <param argument="umi_regex" type="text" value="" optional="true" label="Extract UMI from read names of BAM records using regular expressions"/> | |
265 <expand macro="param_shift"/> | |
266 <param argument="min_mapq" type="integer" min="0" value="30" label="Filter the reads based on MAPQ"/> | |
267 <expand macro="param_chunk_size" size="50000000"/> | |
268 </when> | |
269 <when value="pp.import_data"> | |
270 <param argument="fragment_file" type="data" format="interval" label="Fragment file, optionally compressed with gzip or zstd"/> | |
271 <param argument="chrom_sizes" type="data" format="tabular" label="A tabular file containing chromosome names and sizes"/> | |
272 <param argument="min_num_fragments" type="integer" value="200" label="Number of unique fragments threshold used to filter cells"/> | |
273 <param argument="sorted_by_barcode" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Whether the fragment file has been sorted by cell barcodes"/> | |
274 <param argument="whitelist" type="data" format="txt" optional="True" label="Whitelist file with a list of barcodes" help="Each line must contain a valid barcode. When provided, only barcodes in the whitelist will be retained."/> | |
275 <param argument="chrM" type="text" value="chrM, M" label="A list of chromosome names that are considered mitochondrial DNA"> | |
276 <expand macro="sanitize_query"/> | |
277 </param> | |
278 <param argument="shift_left" type="integer" value="0" label="Insertion site correction for the left end" help="Note this has no effect on single-end reads"/> | |
279 <param argument="shift_right" type="integer" value="0" label="Insertion site correction for the right end" help="Note this has no effect on single-end reads"/> | |
280 <expand macro="param_chunk_size" size="2000"/> | |
281 </when> | |
282 <when value="pp.add_tile_matrix"> | |
283 <expand macro="inputs_anndata"/> | |
284 <param argument="bin_size" type="integer" value="500" label="The size of consecutive genomic regions used to record the counts"/> | |
285 <expand macro="param_chunk_size" size="500"/> | |
286 <param argument="exclude_chroms" type="text" value="chrM, chrY, M, Y" optional="true" label="A list of chromosomes to exclude"> | |
287 <expand macro="sanitize_query"/> | |
288 </param> | |
289 <expand macro="min_max_frag_size"/> | |
290 <!--expand macro="param_counting_strategy"/--> | |
291 <param argument="count_frag_as_reads" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Whether to count fragments as reads"/> | |
292 </when> | |
293 <when value="pp.make_gene_matrix"> | |
294 <expand macro="inputs_anndata"/> | |
295 <param argument="gene_anno" type="data" format="gtf,gff3" label="GTF/GFF file containing the gene annotation"/> | |
296 <expand macro="param_chunk_size" size="500"/> | |
297 <param argument="use_x" type="boolean" truevalue="True" falsevalue="False" checked="false" label="If True, use the matrix stored in .X as raw counts"/> | |
298 <param argument="id_type" type="select" label="Id type, 'gene' or 'transcript'"> | |
299 <option value="gene" selected="true">gene</option> | |
300 <option value="transcript">transcript</option> | |
301 </param> | |
302 <param argument="transcript_name_key" type="text" value="transcript_name" label="The key of the transcript name in the gene annotation file"/> | |
303 <param argument="transcript_id_key" type="text" value="transcript_id" label="The key of the transcript id in the gene annotation file"/> | |
304 <param argument="gene_name_key" type="text" value="gene_name" label="The key of the gene name in the gene annotation file"/> | |
305 <param argument="gene_id_key" type="text" value="gene_id" label="The key of the gene id in the gene annotation file"/> | |
306 <expand macro="min_max_frag_size"/> | |
307 <!--expand macro="param_counting_strategy"/--> | |
308 <param argument="count_frag_as_reads" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Whether to count fragments as reads"/> | |
309 </when> | |
310 <when value="pp.filter_cells"> | |
311 <expand macro="inputs_anndata"/> | |
312 <param argument="min_counts" type="integer" value="1000" label="Minimum number of counts required for a cell to pass filtering"/> | |
313 <param argument="min_tsse" type="float" value="5.0" label="Minimum TSS enrichemnt score required for a cell to pass filtering"/> | |
314 <param argument="max_counts" type="integer" value="" optional="true" label="Maximum number of counts required for a cell to pass filtering"/> | |
315 <param argument="max_tsse" type="float" value="" optional="true" label="Maximum TSS enrichment score expressed required for a cell to pass filtering"/> | |
316 </when> | |
317 <when value="pp.select_features"> | |
318 <expand macro="inputs_anndata"/> | |
319 <param argument="n_features" type="integer" min="1" value="500000" label="Number of features to keep"/> | |
320 <param argument="filter_lower_quantile" type="float" min="0" value="0.005" label="Lower quantile of the feature count distribution to filter out"/> | |
321 <param argument="filter_upper_quantile" type="float" min="0" value="0.005" label="Upper quantile of the feature count distribution to filter out"/> | |
322 <param argument="whitelist" type="data" format="bed" optional="true" label="A user provided bed file containing genome-wide whitelist regions"/> | |
323 <param argument="blacklist" type="data" format="bed" optional="true" label="A user provided bed file containing genome-wide blacklist regions"/> | |
324 <param argument="max_iter" type="integer" value="1" label="If greater than 1, this function will perform iterative clustering and feature selection"/> | |
325 </when> | |
326 <when value="pp.scrublet"> | |
327 <expand macro="inputs_anndata"/> | |
328 <param argument="features" type="text" value="" optional="true" label=" Boolean index mask, where True means that the feature is kept, and False means the feature is removed."/> | |
329 <param argument="n_comps" type="integer" value="15" label="Number of components" help="15 is usually sufficient. The algorithm is not sensitive to this parameter"/> | |
330 <param argument="sim_doublet_ratio" type="float" value="2.0" label="Number of doublets to simulate relative to the number of observed cells"/> | |
331 <param argument="expected_doublet_rate" type="float" value="0.1" label="Expected doublet rate"/> | |
332 <param argument="n_neighbors" type="integer" value="" optional="true" label="Number of neighbors used to construct the KNN graph of observed cells and simulated doublets"/> | |
333 <param argument="use_approx_neighbors" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Whether to use approximate search"/> | |
334 <param argument="random_state" type="integer" value="0" label="Random state"/> | |
335 </when> | |
336 <when value="pp.filter_doublets"> | |
337 <expand macro="inputs_anndata"/> | |
338 <param argument="probability_threshold" type="float" value="0.5" label="Threshold for doublet probability"/> | |
339 <param argument="score_threshold" type="float" value="" optional="true" label="Threshold for doublet score"/> | |
340 </when> | |
341 <when value="pp.mnc_correct"> | |
342 <expand macro="inputs_anndata"/> | |
343 <param argument="batch" type="text" value="batch" label="Batch labels for cells"> | |
344 <expand macro="sanitize_query"/> | |
345 </param> | |
346 <param argument="n_neighbors" type="integer" value="5" label="Number of mutual nearest neighbors"/> | |
347 <param argument="n_clusters" type="integer" value="40" label="Number of clusters"/> | |
348 <param argument="n_iter" type="integer" value="1" label="Number of iterations"/> | |
349 <expand macro="params_data_integration"/> | |
350 </when> | |
351 <when value="pp.harmony"> | |
352 <expand macro="inputs_anndata"/> | |
353 <param argument="batch" type="text" value="batch" label="Batch labels for cells"> | |
354 <expand macro="sanitize_query"/> | |
355 </param> | |
356 <expand macro="params_data_integration"/> | |
357 </when> | |
358 <when value="pp.scanorama_integrate"> | |
359 <expand macro="inputs_anndata"/> | |
360 <param argument="batch" type="text" value="batch" label="Batch labels for cells"> | |
361 <expand macro="sanitize_query"/> | |
362 </param> | |
363 <param argument="n_neighbors" type="integer" value="20" label="Number of mutual nearest neighbors"/> | |
364 <expand macro="params_data_integration"/> | |
365 </when> | |
366 <when value="metrics.frag_size_distr"> | |
367 <!-- TODO move this to plotting --> | |
368 <expand macro="inputs_anndata"/> | |
369 <param argument="max_recorded_size" type="integer" min="1" value="1000" label="The maximum fragment size to record in the result"/> | |
370 <param argument="add_key" type="text" value="frag_size_distr" label="Key used to store the result in `adata.uns`"/> | |
371 </when> | |
372 <when value="metrics.tsse"> | |
373 <!-- TODO move this to plotting --> | |
374 <expand macro="inputs_anndata"/> | |
375 <param argument="gene_anno" type="data" format="gtf,gff3" label="GTF/GFF file containing the gene annotation"/> | |
376 </when> | |
377 </conditional> | |
378 <expand macro="inputs_common_advanced"/> | |
379 </inputs> | |
380 <outputs> | |
381 <data name="fragments_out" format="interval" label="${tool.name} (${method.method}) on ${on_string}: Fragment file"> | |
382 <filter>method['method'] == 'pp.make_fragment_file'</filter> | |
383 </data> | |
384 <data name="anndata_out" format="h5ad" from_work_dir="anndata.h5ad" label="${tool.name} (${method.method}) on ${on_string}: Annotated data matrix"> | |
385 <filter>method['method'] != 'pp.make_fragment_file'</filter> | |
386 </data> | |
387 <data name="hidden_output" format="txt" label="Log file"> | |
388 <filter>advanced_common['show_log']</filter> | |
389 </data> | |
390 </outputs> | |
391 <tests> | |
392 <test expect_num_outputs="1"> | |
393 <!-- pp.make_fragment_file --> | |
394 <conditional name="method"> | |
395 <param name="method" value="pp.make_fragment_file"/> | |
396 <param name="bam_file" location="https://zenodo.org/records/11199963/files/pbmc_500_chr21_subsample.bam"/> | |
397 <param name="is_paired" value="true"/> | |
398 <conditional name="barcode"> | |
399 <param name="extract_type" value="from_tag"/> | |
400 <param name="barcode_tag" value="CB"/> | |
401 </conditional> | |
402 <param name="shift_left" value="4"/> | |
403 <param name="shift_right" value="-5"/> | |
404 <param name="min_mapq" value="10"/> | |
405 <param name="chunk_size" value="50000000"/> | |
406 </conditional> | |
407 <output name="fragments_out" location="https://zenodo.org/records/11199963/files/pp.make_fragment_file.pbmc_500_chr21.tsv.gz" ftype="interval" compare="sim_size" delta_frac="0.1"/> | |
408 </test> | |
409 <test expect_num_outputs="2"> | |
410 <!-- pp.pp.import_data --> | |
411 <conditional name="method"> | |
412 <param name="method" value="pp.import_data"/> | |
413 <param name="fragment_file" location="https://zenodo.org/records/11199963/files/pbmc_500_chr21.tsv.gz"/> | |
414 <param name="chrom_sizes" location="https://zenodo.org/records/11199963/files/chr21_size.tabular"/> | |
415 <param name="min_num_fragments" value="1"/> | |
416 <param name="sorted_by_barcode" value="False"/> | |
417 <param name="shift_left" value="0"/> | |
418 <param name="chrM" value="chrM, M"/> | |
419 <param name="shift_right" value="0"/> | |
420 <param name="chunk_size" value="1000"/> | |
421 </conditional> | |
422 <section name="advanced_common"> | |
423 <param name="show_log" value="true"/> | |
424 </section> | |
425 <output name="hidden_output"> | |
426 <assert_contents> | |
427 <has_text_matching expression="sa.pp.import_data"/> | |
428 <has_text_matching expression="min_num_fragments = 1"/> | |
429 <has_text_matching expression="sorted_by_barcode = False"/> | |
430 <has_text_matching expression="shift_left = 0"/> | |
431 <has_text_matching expression="chrM = \['chrM', 'M'\]"/> | |
432 <has_text_matching expression="shift_right = 0"/> | |
433 <has_text_matching expression="chunk_size = 1000"/> | |
434 </assert_contents> | |
435 </output> | |
436 <output name="anndata_out" location="https://zenodo.org/records/11199963/files/pp.import_data.pbmc_500_chr21.h5ad" ftype="h5ad" compare="sim_size" delta_frac="0.1"/> | |
437 </test> | |
438 </tests> | |
439 <help><![CDATA[ | |
440 Convert a BAM file`to a fragment file, `using pp.make_fragment_file` | |
441 ==================================================================== | |
442 | |
443 Convert a BAM file to a fragment file. | |
444 | |
445 Convert a BAM file to a fragment file by performing the following steps: | |
446 | |
447 - Filtering: remove reads that are unmapped, not primary alignment, mapq < 30, fails platform/vendor quality checks, or optical duplicate. For paired-end sequencing, it also removes reads that are not properly aligned. | |
448 | |
449 - Deduplicate: Sort the reads by cell barcodes and remove duplicated reads for each unique cell barcode. | |
450 | |
451 - Output: Convert BAM records to fragments (if paired-end) or single-end reads. | |
452 | |
453 The bam file needn’t be sorted or filtered. | |
454 | |
455 More details on the `SnapATAC2 documentation | |
456 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.pp.make_fragment_file.html>`__ | |
457 | |
458 Import data fragment file` and compute basic QC metrics, using `pp.import_data` | |
459 =============================================================================== | |
460 | |
461 Import data fragment files and compute basic QC metrics. | |
462 | |
463 A fragment refers to the sequence data originating from a distinct location in the genome. In single-ended sequencing, one read equates to a fragment. However, in paired-ended sequencing, a fragment is defined by a pair of reads. This function is designed to handle, store, and process input files with fragment data, further yielding a range of basic Quality Control (QC) metrics. These metrics include the total number of unique fragments, duplication rates, and the percentage of mitochondrial DNA detected. | |
464 | |
465 How fragments are stored is dependent on the sequencing approach utilized. For single-ended sequencing, fragments are found in `.obsm['fragment_single']`. In contrast, for paired-ended sequencing, they are located in `.obsm['fragment_paired']`. | |
466 | |
467 More details on the `SnapATAC2 documentation | |
468 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.pp.import_data.html>`__ | |
469 | |
470 Generate cell by bin count matrix, using `pp.add_tile_matrix` | |
471 ============================================================= | |
472 | |
473 Generate cell by bin count matrix. | |
474 | |
475 This function is used to generate and add a cell by bin count matrix to the AnnData object. | |
476 | |
477 `import_data` must be ran first in order to use this function. | |
478 | |
479 More details on the `SnapATAC2 documentation | |
480 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.pp.add_tile_matrix.html>`__ | |
481 | |
482 Generate cell by gene activity matrix, using `pp.make_gene_matrix` | |
483 ================================================================== | |
484 | |
485 Generate cell by gene activity matrix. | |
486 | |
487 Generate cell by gene activity matrix by counting the TN5 insertions in gene body regions. The result will be stored in a new file and a new AnnData object will be created. | |
488 | |
489 `import_data` must be ran first in order to use this function. | |
490 | |
491 More details on the `SnapATAC2 documentation | |
492 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.pp.make_gene_matrix.html>`__ | |
493 | |
494 Filter cell outliers based on counts and numbers of genes expressed, using `pp.filter_cells` | |
495 ============================================================================================ | |
496 | |
497 Filter cell outliers based on counts and numbers of genes expressed. For instance, only keep cells with at least `min_counts` counts or `min_ts`` TSS enrichment scores. This is to filter measurement outliers, i.e. “unreliable” observations. | |
498 | |
499 More details on the `SnapATAC2 documentation | |
500 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.pp.filter_cells.html>`__ | |
501 | |
502 Perform feature selection, using `pp.select_features` | |
503 ===================================================== | |
504 | |
505 Perform feature selection by selecting the most accessibile features across all cells unless `max_iter` > 1 | |
506 | |
507 More details on the `SnapATAC2 documentation | |
508 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.pp.select_features.html>`__ | |
509 | |
510 Compute probability of being a doublet using the scrublet algorithm, using `pp.scrublet` | |
511 ======================================================================================== | |
512 | |
513 Compute probability of being a doublet using the scrublet algorithm. | |
514 | |
515 This function identifies doublets by generating simulated doublets using randomly pairing chromatin accessibility profiles of individual cells. The simulated doublets are then embedded alongside the original cells using the spectral embedding algorithm in this package. A k-nearest-neighbor classifier is trained to distinguish between the simulated doublets and the authentic cells. This trained classifier produces a “doublet score” for each cell. The doublet scores are then converted into probabilities using a Gaussian mixture model. | |
516 | |
517 More details on the `SnapATAC2 documentation | |
518 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.pp.scrublet.html>`__ | |
519 | |
520 Remove doublets according to the doublet probability or doublet score, using `pp.filter_doublets` | |
521 ================================================================================================= | |
522 | |
523 Remove doublets according to the doublet probability or doublet score. | |
524 | |
525 The user can choose to remove doublets by either the doublet probability or the doublet score. `scrublet` must be ran first in order to use this function. | |
526 | |
527 More details on the `SnapATAC2 documentation | |
528 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.pp.filter_doublets.html>`__ | |
529 | |
530 A modified MNN-Correct algorithm based on cluster centroid, using `pp.mnc_correct` | |
531 ================================================================================== | |
532 | |
533 A modified MNN-Correct algorithm based on cluster centroid. | |
534 | |
535 More details on the `SnapATAC2 documentation | |
536 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.pp.mnc_correct.html>`__ | |
537 | |
538 Use harmonypy to integrate different experiments,using `pp.harmony` | |
539 =================================================================== | |
540 | |
541 Use harmonypy to integrate different experiments. | |
542 | |
543 Harmony is an algorithm for integrating single-cell data from multiple experiments. This function uses the python port of Harmony, `harmonypy`, to integrate single-cell data stored in an AnnData object. This function should be run after performing dimension reduction. | |
544 | |
545 More details on the `SnapATAC2 documentation | |
546 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.pp.harmony.html>`__ | |
547 | |
548 Use Scanorama to integrate different experiments, using `pp.scanorama_integrate` | |
549 ======================================================================================== | |
550 | |
551 Use Scanorama to integrate different experiments. | |
552 | |
553 Scanorama is an algorithm for integrating single-cell data from multiple experiments stored in an AnnData object. This function should be run after performing `tl.spectral` but before computing the neighbor graph. | |
554 | |
555 More details on the `SnapATAC2 documentation | |
556 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.pp.scanorama_integrate.html>`__ | |
557 | |
558 Compute the fragment size distribution of the dataset, using `metrics.frag_size_distr` | |
559 ====================================================================================== | |
560 | |
561 Compute the fragment size distribution of the dataset. | |
562 | |
563 This function computes the fragment size distribution of the dataset. Note that it does not operate at the single-cell level. The result is stored in a vector where each element represents the number of fragments and the index represents the fragment length. The first posision of the vector is reserved for fragments with size larger than the `max_recorded_size` parameter. `import_data` must be ran first in order to use this function. | |
564 | |
565 More details on the `SnapATAC2 documentation | |
566 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.metrics.frag_size_distr.html>`__ | |
567 | |
568 Compute the TSS enrichment score (TSSe) for each cell, using `metrics.tsse` | |
569 =========================================================================== | |
570 | |
571 Compute the TSS enrichment score (TSSe) for each cell. | |
572 | |
573 `import_data` must be ran first in order to use this function. | |
574 | |
575 More details on the `SnapATAC2 documentation | |
576 <https://kzhang.org/SnapATAC2/api/_autosummary/snapatac2.metrics.tsse.html>`__ | |
577 | |
578 ]]></help> | |
579 <expand macro="citations"/> | |
580 </tool> |