Mercurial > repos > ebi-gxa > decoupler_pseudobulk
annotate decoupler_pseudobulk.py @ 0:59a7f3f83aec draft
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
author | ebi-gxa |
---|---|
date | Sun, 24 Sep 2023 08:44:24 +0000 |
parents | |
children | 046d8ff974ff |
rev | line source |
---|---|
0
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
1 import argparse |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
2 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
3 import anndata |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
4 import decoupler |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
5 import pandas as pd |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
6 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
7 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
8 def get_pseudobulk( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
9 adata, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
10 sample_col, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
11 groups_col, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
12 layer=None, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
13 mode="sum", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
14 min_cells=10, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
15 min_counts=1000, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
16 use_raw=False, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
17 ): |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
18 """ |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
19 >>> import scanpy as sc |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
20 >>> adata = sc.datasets.pbmc68k_reduced() |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
21 >>> adata.X = abs(adata.X).astype(int) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
22 >>> pseudobulk = get_pseudobulk(adata, "bulk_labels", "louvain") |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
23 """ |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
24 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
25 return decoupler.get_pseudobulk( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
26 adata, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
27 sample_col=sample_col, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
28 groups_col=groups_col, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
29 layer=layer, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
30 mode=mode, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
31 use_raw=use_raw, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
32 min_cells=min_cells, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
33 min_counts=min_counts, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
34 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
35 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
36 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
37 def prepend_c_to_index(index_value): |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
38 if index_value and index_value[0].isdigit(): |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
39 return "C" + index_value |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
40 return index_value |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
41 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
42 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
43 # write results for loading into DESeq2 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
44 def write_DESeq2_inputs(pdata, layer=None, output_dir="", factor_fields=None): |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
45 """ |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
46 >>> import scanpy as sc |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
47 >>> adata = sc.datasets.pbmc68k_reduced() |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
48 >>> adata.X = abs(adata.X).astype(int) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
49 >>> pseudobulk = get_pseudobulk(adata, "bulk_labels", "louvain") |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
50 >>> write_DESeq2_inputs(pseudobulk) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
51 """ |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
52 # add / to output_dir if is not empty or if it doesn't end with / |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
53 if output_dir != "" and not output_dir.endswith("/"): |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
54 output_dir = output_dir + "/" |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
55 obs_for_deseq = pdata.obs.copy() |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
56 # replace any index starting with digits to start with C instead. |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
57 obs_for_deseq.rename(index=prepend_c_to_index, inplace=True) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
58 # avoid dash that is read as point on R colnames. |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
59 obs_for_deseq.index = obs_for_deseq.index.str.replace("-", "_") |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
60 obs_for_deseq.index = obs_for_deseq.index.str.replace(" ", "_") |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
61 col_metadata_file = f"{output_dir}col_metadata.csv" |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
62 # write obs to a col_metadata file |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
63 if factor_fields: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
64 # only output the index plus the columns in factor_fields in that order |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
65 obs_for_deseq[factor_fields].to_csv(col_metadata_file, sep=",", index=True) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
66 else: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
67 obs_for_deseq.to_csv(col_metadata_file, sep=",", index=True) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
68 # write var to a gene_metadata file |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
69 pdata.var.to_csv(f"{output_dir}gene_metadata.csv", sep=",", index=True) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
70 # write the counts matrix of a specified layer to file |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
71 if layer is None: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
72 # write the X numpy matrix transposed to file |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
73 df = pd.DataFrame(pdata.X.T, index=pdata.var.index, columns=obs_for_deseq.index) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
74 else: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
75 df = pd.DataFrame( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
76 pdata.layers[layer].T, index=pdata.var.index, columns=obs_for_deseq.index |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
77 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
78 df.to_csv(f"{output_dir}counts_matrix.csv", sep=",", index_label="") |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
79 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
80 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
81 def plot_pseudobulk_samples( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
82 pseudobulk_data, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
83 groupby, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
84 figsize=(10, 10), |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
85 save_path=None, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
86 ): |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
87 """ |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
88 >>> import scanpy as sc |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
89 >>> adata = sc.datasets.pbmc68k_reduced() |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
90 >>> adata.X = abs(adata.X).astype(int) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
91 >>> pseudobulk = get_pseudobulk(adata, "bulk_labels", "louvain") |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
92 >>> plot_pseudobulk_samples(pseudobulk, groupby=["bulk_labels", "louvain"], figsize=(10, 10)) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
93 """ |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
94 fig = decoupler.plot_psbulk_samples( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
95 pseudobulk_data, groupby=groupby, figsize=figsize, return_fig=True |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
96 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
97 if save_path: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
98 fig.savefig(f"{save_path}/pseudobulk_samples.png") |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
99 else: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
100 fig.show() |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
101 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
102 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
103 def plot_filter_by_expr( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
104 pseudobulk_data, group, min_count=None, min_total_count=None, save_path=None |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
105 ): |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
106 """ |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
107 >>> import scanpy as sc |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
108 >>> adata = sc.datasets.pbmc68k_reduced() |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
109 >>> adata.X = abs(adata.X).astype(int) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
110 >>> pseudobulk = get_pseudobulk(adata, "bulk_labels", "louvain") |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
111 >>> plot_filter_by_expr(pseudobulk, group="bulk_labels", min_count=10, min_total_count=200) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
112 """ |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
113 fig = decoupler.plot_filter_by_expr( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
114 pseudobulk_data, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
115 group=group, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
116 min_count=min_count, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
117 min_total_count=min_total_count, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
118 return_fig=True, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
119 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
120 if save_path: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
121 fig.savefig(f"{save_path}/filter_by_expr.png") |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
122 else: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
123 fig.show() |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
124 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
125 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
126 def filter_by_expr(pdata, min_count=None, min_total_count=None): |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
127 """ |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
128 >>> import scanpy as sc |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
129 >>> adata = sc.datasets.pbmc68k_reduced() |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
130 >>> adata.X = abs(adata.X).astype(int) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
131 >>> pseudobulk = get_pseudobulk(adata, "bulk_labels", "louvain") |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
132 >>> pdata_filt = filter_by_expr(pseudobulk, min_count=10, min_total_count=200) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
133 """ |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
134 genes = decoupler.filter_by_expr( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
135 pdata, min_count=min_count, min_total_count=min_total_count |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
136 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
137 return pdata[:, genes].copy() |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
138 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
139 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
140 def check_fields(fields, adata, obs=True, context=None): |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
141 """ |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
142 >>> import scanpy as sc |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
143 >>> adata = sc.datasets.pbmc68k_reduced() |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
144 >>> check_fields(["bulk_labels", "louvain"], adata, obs=True) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
145 """ |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
146 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
147 legend = "" |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
148 if context: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
149 legend = f", passed in {context}," |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
150 if obs: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
151 if not set(fields).issubset(set(adata.obs.columns)): |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
152 raise ValueError( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
153 f"Some of the following fields {legend} are not present in adata.obs: {fields}. Possible fields are: {list(set(adata.obs.columns))}" |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
154 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
155 else: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
156 if not set(fields).issubset(set(adata.var.columns)): |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
157 raise ValueError( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
158 f"Some of the following fields {legend} are not present in adata.var: {fields}. Possible fields are: {list(set(adata.var.columns))}" |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
159 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
160 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
161 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
162 def main(args): |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
163 # Load AnnData object from file |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
164 adata = anndata.read_h5ad(args.adata_file) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
165 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
166 # Merge adata.obs fields specified in args.adata_obs_fields_to_merge |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
167 if args.adata_obs_fields_to_merge: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
168 fields = args.adata_obs_fields_to_merge.split(",") |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
169 check_fields(fields, adata) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
170 adata = merge_adata_obs_fields(fields, adata) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
171 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
172 check_fields([args.groupby, args.sample_key], adata) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
173 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
174 factor_fields = None |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
175 if args.factor_fields: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
176 factor_fields = args.factor_fields.split(",") |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
177 check_fields(factor_fields, adata) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
178 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
179 print(f"Using mode: {args.mode}") |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
180 # Perform pseudobulk analysis |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
181 pseudobulk_data = get_pseudobulk( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
182 adata, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
183 sample_col=args.sample_key, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
184 groups_col=args.groupby, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
185 layer=args.layer, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
186 mode=args.mode, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
187 use_raw=args.use_raw, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
188 min_cells=args.min_cells, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
189 min_counts=args.min_counts, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
190 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
191 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
192 # Plot pseudobulk samples |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
193 plot_pseudobulk_samples( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
194 pseudobulk_data, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
195 args.groupby, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
196 save_path=args.save_path, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
197 figsize=args.plot_samples_figsize, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
198 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
199 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
200 plot_filter_by_expr( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
201 pseudobulk_data, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
202 group=args.groupby, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
203 min_count=args.min_counts, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
204 min_total_count=args.min_total_counts, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
205 save_path=args.save_path, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
206 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
207 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
208 # Filter by expression if enabled |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
209 if args.filter_expr: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
210 filtered_adata = filter_by_expr( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
211 pseudobulk_data, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
212 min_count=args.min_counts, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
213 min_total_count=args.min_total_counts, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
214 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
215 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
216 pseudobulk_data = filtered_adata |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
217 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
218 # Save the pseudobulk data |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
219 if args.anndata_output_path: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
220 pseudobulk_data.write_h5ad(args.anndata_output_path, compression="gzip") |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
221 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
222 write_DESeq2_inputs( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
223 pseudobulk_data, output_dir=args.deseq2_output_path, factor_fields=factor_fields |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
224 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
225 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
226 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
227 def merge_adata_obs_fields(obs_fields_to_merge, adata): |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
228 """ |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
229 Merge adata.obs fields specified in args.adata_obs_fields_to_merge |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
230 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
231 Parameters |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
232 ---------- |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
233 obs_fields_to_merge : str |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
234 Fields in adata.obs to merge, comma separated |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
235 adata : anndata.AnnData |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
236 The AnnData object |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
237 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
238 Returns |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
239 ------- |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
240 anndata.AnnData |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
241 The merged AnnData object |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
242 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
243 docstring tests: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
244 >>> import scanpy as sc |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
245 >>> ad = sc.datasets.pbmc68k_reduced() |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
246 >>> ad = merge_adata_obs_fields(["bulk_labels","louvain"], ad) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
247 >>> ad.obs.columns |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
248 Index(['bulk_labels', 'n_genes', 'percent_mito', 'n_counts', 'S_score', |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
249 'G2M_score', 'phase', 'louvain', 'bulk_labels_louvain'], |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
250 dtype='object') |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
251 """ |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
252 field_name = "_".join(obs_fields_to_merge) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
253 for field in obs_fields_to_merge: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
254 if field not in adata.obs.columns: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
255 raise ValueError(f"The '{field}' column is not present in adata.obs.") |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
256 if field_name not in adata.obs.columns: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
257 adata.obs[field_name] = adata.obs[field].astype(str) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
258 else: |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
259 adata.obs[field_name] = ( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
260 adata.obs[field_name] + "_" + adata.obs[field].astype(str) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
261 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
262 return adata |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
263 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
264 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
265 if __name__ == "__main__": |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
266 # Create argument parser |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
267 parser = argparse.ArgumentParser( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
268 description="Perform pseudobulk analysis on an AnnData object" |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
269 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
270 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
271 # Add arguments |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
272 parser.add_argument("adata_file", type=str, help="Path to the AnnData file") |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
273 parser.add_argument( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
274 "-m", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
275 "--adata_obs_fields_to_merge", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
276 type=str, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
277 help="Fields in adata.obs to merge, comma separated", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
278 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
279 parser.add_argument( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
280 "--groupby", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
281 type=str, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
282 required=True, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
283 help="The column in adata.obs that defines the groups", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
284 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
285 parser.add_argument( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
286 "--sample_key", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
287 required=True, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
288 type=str, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
289 help="The column in adata.obs that defines the samples", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
290 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
291 # add argument for layer |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
292 parser.add_argument( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
293 "--layer", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
294 type=str, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
295 default=None, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
296 help="The name of the layer of the AnnData object to use", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
297 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
298 # add argument for mode |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
299 parser.add_argument( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
300 "--mode", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
301 type=str, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
302 default="sum", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
303 help="The mode for Decoupler pseudobulk analysis", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
304 choices=["sum", "mean", "median"], |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
305 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
306 # add boolean argument for use_raw |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
307 parser.add_argument( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
308 "--use_raw", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
309 action="store_true", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
310 default=False, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
311 help="Whether to use the raw part of the AnnData object", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
312 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
313 # add argument for min_cells |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
314 parser.add_argument( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
315 "--min_cells", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
316 type=int, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
317 default=10, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
318 help="Minimum number of cells for pseudobulk analysis", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
319 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
320 parser.add_argument( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
321 "--save_path", type=str, help="Path to save the plot (optional)" |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
322 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
323 parser.add_argument( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
324 "--min_counts", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
325 type=int, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
326 help="Minimum count threshold for filtering by expression", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
327 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
328 parser.add_argument( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
329 "--min_total_counts", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
330 type=int, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
331 help="Minimum total count threshold for filtering by expression", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
332 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
333 parser.add_argument( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
334 "--anndata_output_path", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
335 type=str, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
336 help="Path to save the filtered AnnData object or pseudobulk data", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
337 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
338 parser.add_argument( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
339 "--filter_expr", action="store_true", help="Enable filtering by expression" |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
340 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
341 parser.add_argument( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
342 "--factor_fields", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
343 type=str, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
344 help="Comma separated list of fields for the factors", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
345 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
346 parser.add_argument( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
347 "--deseq2_output_path", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
348 type=str, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
349 help="Path to save the DESeq2 inputs", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
350 required=True, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
351 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
352 parser.add_argument( |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
353 "--plot_samples_figsize", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
354 type=int, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
355 default=[10, 10], |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
356 nargs=2, |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
357 help="Size of the samples plot as a tuple (two arguments)", |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
358 ) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
359 parser.add_argument("--plot_filtering_figsize", type=int, default=[10, 10], nargs=2) |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
360 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
361 # Parse the command line arguments |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
362 args = parser.parse_args() |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
363 |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
364 # Call the main function |
59a7f3f83aec
planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit 20f4a739092bd05106d5de170523ad61d66e41fc
ebi-gxa
parents:
diff
changeset
|
365 main(args) |