scanpex 0.2.2__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scanpex-0.2.4/AUTHORS.rst +13 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/PKG-INFO +7 -3
- {scanpex-0.2.2 → scanpex-0.2.4}/pyproject.toml +3 -3
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/sq/_gene_query.py +26 -15
- {scanpex-0.2.2 → scanpex-0.2.4}/LICENSE +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/README.md +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/__init__.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/ft/__init__.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/ft/_gene_list.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/ml/__init__.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/ml/lightgbm_args/__init__.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/pl/__init__.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/pl/_curate_phase.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/pl/_gene_list.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/pl/_scrublet.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/pl/_subplots.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/pl/_umap.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/pl/ml_evaluation/__init__.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/pl/ml_evaluation/_pr.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/pl/ml_evaluation/_roc.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/pl/preferences/__init__.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/pp/__init__.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/pp/_metrics.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/pp/_scrublet.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/sns/__init__.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/sns/_catlollipop.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/sns/_lollipop.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/sns/_vinswarm.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/sq/__init__.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/sq/_gene_cache_mgr.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/sq/_xor.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/tl/__init__.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/tl/_gene_score.py +0 -0
- {scanpex-0.2.2 → scanpex-0.2.4}/src/scanpex/tl/_seacells.py +0 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: scanpex
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: ScanPy Extension and kwarg Preferences
|
|
5
|
+
License-File: AUTHORS.rst
|
|
6
|
+
License-File: LICENSE
|
|
5
7
|
Author: yo-aka-gene
|
|
6
8
|
Author-email: yujiokano@keio.jp
|
|
7
9
|
Requires-Python: >=3.10,<4.0
|
|
@@ -9,7 +11,9 @@ Classifier: Programming Language :: Python :: 3
|
|
|
9
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
10
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
11
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
-
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Requires-Dist: anndata (>=0.10.0)
|
|
13
17
|
Requires-Dist: fastcluster (<1.3.0)
|
|
14
18
|
Requires-Dist: jax (<0.5.0)
|
|
15
19
|
Requires-Dist: jaxlib (<0.5.0)
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "scanpex"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.4"
|
|
4
4
|
description = "ScanPy Extension and kwarg Preferences"
|
|
5
5
|
authors = ["yo-aka-gene <yujiokano@keio.jp>"]
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
|
|
8
8
|
[tool.poetry.dependencies]
|
|
9
|
-
python = "
|
|
9
|
+
python = ">=3.10,<4.0"
|
|
10
10
|
numba = "0.60.0"
|
|
11
11
|
matplotlib = "^3.10.8"
|
|
12
12
|
pandas = ">=1.5.3"
|
|
13
13
|
scanpy = "^1.11.5"
|
|
14
|
-
anndata = "
|
|
14
|
+
anndata = ">=0.10.0"
|
|
15
15
|
scipy = "<1.16"
|
|
16
16
|
mygene = "^3.2.2"
|
|
17
17
|
scikit-learn = "<1.8"
|
|
@@ -10,6 +10,8 @@ def gene_query(
|
|
|
10
10
|
species: str = "human",
|
|
11
11
|
logging: bool = True,
|
|
12
12
|
unique: bool = True,
|
|
13
|
+
sort: bool = False,
|
|
14
|
+
keep_unmapped: bool = False,
|
|
13
15
|
) -> List[str]:
|
|
14
16
|
"""
|
|
15
17
|
Map gene names (symbols or aliases) to a target source list (e.g., `adata.var_names`).
|
|
@@ -31,7 +33,12 @@ def gene_query(
|
|
|
31
33
|
If True, prints the number of mapped genes and missing queries.
|
|
32
34
|
unique : bool, optional (default: True)
|
|
33
35
|
If True, returns a sorted list of unique gene names.
|
|
34
|
-
If False, allows duplicates
|
|
36
|
+
If False, allows duplicates and maintains the original query order.
|
|
37
|
+
sort : bool, optional (default: False)
|
|
38
|
+
If True, sorts the returned list of genes alphanumerically.
|
|
39
|
+
keep_unmapped : bool, optional (default: False)
|
|
40
|
+
If True, includes unmapped gene names in the returned list.
|
|
41
|
+
If False, omits unmapped genes.
|
|
35
42
|
|
|
36
43
|
Returns
|
|
37
44
|
-------
|
|
@@ -49,46 +56,44 @@ def gene_query(
|
|
|
49
56
|
raise ImportError(
|
|
50
57
|
"mygene is not installed. Please install it using `pip install mygene`."
|
|
51
58
|
)
|
|
59
|
+
|
|
52
60
|
mg = mygene.MyGeneInfo()
|
|
53
61
|
res = mg.querymany(
|
|
54
62
|
gene_names,
|
|
55
|
-
scopes="symbol,alias",
|
|
63
|
+
scopes="symbol,alias,ensembl.gene",
|
|
56
64
|
fields="symbol,alias",
|
|
57
65
|
species=species,
|
|
58
66
|
as_dataframe=True,
|
|
59
67
|
)
|
|
60
68
|
|
|
61
69
|
source_set = set(source)
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
mapping_dict = {}
|
|
64
71
|
found_count = 0
|
|
65
72
|
|
|
66
73
|
for query in np.unique(gene_names):
|
|
67
74
|
if query not in res.index:
|
|
75
|
+
mapping_dict[query] = query if keep_unmapped else None
|
|
68
76
|
continue
|
|
69
77
|
|
|
70
78
|
match_rows = res.loc[[query]]
|
|
71
|
-
|
|
72
79
|
candidates = []
|
|
73
80
|
|
|
74
81
|
for _, row in match_rows.iterrows():
|
|
75
82
|
if not pd.isna(row.get("symbol")):
|
|
76
83
|
candidates.append(row["symbol"])
|
|
77
|
-
|
|
78
84
|
aliases = row.get("alias")
|
|
79
85
|
if isinstance(aliases, list):
|
|
80
86
|
candidates.extend(aliases)
|
|
81
87
|
elif isinstance(aliases, str):
|
|
82
88
|
candidates.append(aliases)
|
|
83
|
-
|
|
84
89
|
candidates.append(query)
|
|
85
90
|
|
|
86
91
|
candidates = list(set(candidates))
|
|
87
|
-
|
|
88
92
|
match_found = False
|
|
93
|
+
|
|
89
94
|
for cand in candidates:
|
|
90
95
|
if cand in source_set:
|
|
91
|
-
|
|
96
|
+
mapping_dict[query] = cand
|
|
92
97
|
match_found = True
|
|
93
98
|
found_count += 1
|
|
94
99
|
break
|
|
@@ -96,14 +101,20 @@ def gene_query(
|
|
|
96
101
|
if not match_found:
|
|
97
102
|
if logging:
|
|
98
103
|
print(f"Not found in source: {query} (Candidates: {candidates})")
|
|
99
|
-
|
|
104
|
+
mapping_dict[query] = query if keep_unmapped else None
|
|
100
105
|
|
|
101
106
|
if logging:
|
|
102
107
|
n_total = len(np.unique(gene_names))
|
|
103
108
|
print(f"[{found_count}/{n_total}] queries mapped to the source.")
|
|
104
|
-
if unique:
|
|
105
|
-
print(
|
|
106
|
-
f" -> Returning {len(set(final_genes))} unique genes present in data."
|
|
107
|
-
)
|
|
108
109
|
|
|
109
|
-
|
|
110
|
+
if unique:
|
|
111
|
+
final_genes = list(set([v for v in mapping_dict.values() if v is not None]))
|
|
112
|
+
return sorted(final_genes) if sort else final_genes
|
|
113
|
+
|
|
114
|
+
else:
|
|
115
|
+
final_genes = [
|
|
116
|
+
mapping_dict[query]
|
|
117
|
+
for query in gene_names
|
|
118
|
+
if mapping_dict[query] is not None
|
|
119
|
+
]
|
|
120
|
+
return sorted(final_genes) if sort else final_genes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|