gsMap 1.73.0__py3-none-any.whl → 1.73.2__py3-none-any.whl
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.
- gsMap/GNN/train.py +1 -1
- gsMap/__init__.py +1 -1
- gsMap/config.py +29 -16
- gsMap/create_slice_mean.py +1 -0
- gsMap/diagnosis.py +18 -18
- gsMap/find_latent_representation.py +18 -2
- gsMap/generate_ldscore.py +1068 -441
- gsMap/latent_to_gene.py +15 -5
- gsMap/run_all_mode.py +1 -0
- gsMap/utils/generate_r2_matrix.py +2 -2
- gsMap/utils/manhattan_plot.py +15 -7
- {gsmap-1.73.0.dist-info → gsmap-1.73.2.dist-info}/METADATA +9 -1
- {gsmap-1.73.0.dist-info → gsmap-1.73.2.dist-info}/RECORD +16 -16
- {gsmap-1.73.0.dist-info → gsmap-1.73.2.dist-info}/WHEEL +1 -1
- {gsmap-1.73.0.dist-info → gsmap-1.73.2.dist-info}/entry_points.txt +0 -0
- {gsmap-1.73.0.dist-info → gsmap-1.73.2.dist-info}/licenses/LICENSE +0 -0
gsMap/latent_to_gene.py
CHANGED
@@ -104,6 +104,7 @@ def compute_regional_mkscore(
|
|
104
104
|
ranks,
|
105
105
|
frac_whole,
|
106
106
|
adata_X_bool,
|
107
|
+
pearson_residuals,
|
107
108
|
):
|
108
109
|
"""
|
109
110
|
Compute gmean ranks of a region.
|
@@ -129,7 +130,8 @@ def compute_regional_mkscore(
|
|
129
130
|
# Simultaneously consider the ratio of expression fractions and ranks
|
130
131
|
gene_ranks_region = gene_ranks_region * frac_region
|
131
132
|
|
132
|
-
mkscore = np.exp(gene_ranks_region
|
133
|
+
mkscore = np.exp(gene_ranks_region) - 1 if not pearson_residuals else gene_ranks_region
|
134
|
+
|
133
135
|
return mkscore.astype(np.float16, copy=False)
|
134
136
|
|
135
137
|
|
@@ -246,11 +248,18 @@ def run_latent_to_gene(config: LatentToGeneConfig):
|
|
246
248
|
# Create mappings
|
247
249
|
n_cells = adata.n_obs
|
248
250
|
n_genes = adata.n_vars
|
249
|
-
|
251
|
+
pearson_residuals = True if "pearson_residuals" in adata.layers else False
|
250
252
|
ranks = np.zeros((n_cells, adata.n_vars), dtype=np.float16)
|
251
|
-
|
252
|
-
|
253
|
-
|
253
|
+
|
254
|
+
if pearson_residuals:
|
255
|
+
logger.info("Using pearson residuals for ranking.")
|
256
|
+
data = adata.layers["pearson_residuals"]
|
257
|
+
for i in tqdm(range(n_cells), desc="Computing ranks per cell"):
|
258
|
+
ranks[i, :] = rankdata(data[i, :], method="average")
|
259
|
+
else:
|
260
|
+
for i in tqdm(range(n_cells), desc="Computing ranks per cell"):
|
261
|
+
data = adata_X[i, :].toarray().flatten()
|
262
|
+
ranks[i, :] = rankdata(data, method="average")
|
254
263
|
|
255
264
|
if gM is None:
|
256
265
|
gM = gmean(ranks, axis=0)
|
@@ -280,6 +289,7 @@ def run_latent_to_gene(config: LatentToGeneConfig):
|
|
280
289
|
ranks,
|
281
290
|
frac_whole,
|
282
291
|
adata_X_bool,
|
292
|
+
pearson_residuals,
|
283
293
|
)
|
284
294
|
|
285
295
|
logger.info("------Computing marker scores...")
|
gsMap/run_all_mode.py
CHANGED
@@ -465,7 +465,7 @@ class PlinkBEDFile(GenotypeArrayInMemory):
|
|
465
465
|
return Y
|
466
466
|
|
467
467
|
|
468
|
-
def load_bfile(bfile_chr_prefix):
|
468
|
+
def load_bfile(bfile_chr_prefix, keep_snps=None, keep_indivs=None, mafMin=None):
|
469
469
|
PlinkBIMFile = ID_List_Factory(
|
470
470
|
["CHR", "SNP", "CM", "BP", "A1", "A2"], 1, ".bim", usecols=[0, 1, 2, 3, 4, 5]
|
471
471
|
)
|
@@ -483,7 +483,7 @@ def load_bfile(bfile_chr_prefix):
|
|
483
483
|
# Load genotype array
|
484
484
|
array_file = bfile_chr_prefix + ".bed"
|
485
485
|
geno_array = PlinkBEDFile(
|
486
|
-
array_file, n, array_snps, keep_snps=
|
486
|
+
array_file, n, array_snps, keep_snps=keep_snps, keep_indivs=keep_indivs, mafMin=mafMin
|
487
487
|
)
|
488
488
|
|
489
489
|
return array_snps, array_indivs, geno_array
|
gsMap/utils/manhattan_plot.py
CHANGED
@@ -308,13 +308,21 @@ class _ManhattanPlot:
|
|
308
308
|
self.index = "INDEX"
|
309
309
|
self.pos = "POSITION"
|
310
310
|
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
311
|
+
self.data[self.index] = 0 # Initialize with zeros as default value
|
312
|
+
|
313
|
+
if not self.data.empty and len(self.data[chrm].unique()) > 0:
|
314
|
+
idx = 0
|
315
|
+
for i in self.data[chrm].unique():
|
316
|
+
idx = idx + 1
|
317
|
+
self.data.loc[self.data[chrm] == i, self.index] = int(idx)
|
318
|
+
else:
|
319
|
+
import logging
|
320
|
+
|
321
|
+
logger = logging.getLogger("gsMap.utils.manhattan_plot")
|
322
|
+
logger.warning(
|
323
|
+
"No chromosome data found or empty dataframe when creating Manhattan plot"
|
324
|
+
)
|
325
|
+
|
318
326
|
self.data[self.index] = self.data[self.index].astype(self.data[chrm].dtype)
|
319
327
|
|
320
328
|
# This section sets up positions and ticks. Ticks should be placed in
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: gsMap
|
3
|
-
Version: 1.73.
|
3
|
+
Version: 1.73.2
|
4
4
|
Summary: Genetics-informed pathogenic spatial mapping
|
5
5
|
Author-email: liyang <songliyang@westlake.edu.cn>, wenhao <chenwenhao@westlake.edu.cn>
|
6
6
|
Requires-Python: >=3.10
|
@@ -97,6 +97,14 @@ conda activate gsMap
|
|
97
97
|
pip install gsMap
|
98
98
|
```
|
99
99
|
|
100
|
+
Install using conda:
|
101
|
+
|
102
|
+
```bash
|
103
|
+
conda create -n gsMap python>=3.10
|
104
|
+
conda activate gsMap
|
105
|
+
conda install bioconda::gsmap
|
106
|
+
```
|
107
|
+
|
100
108
|
Install from source:
|
101
109
|
|
102
110
|
```bash
|
@@ -1,31 +1,31 @@
|
|
1
|
-
gsMap/__init__.py,sha256=
|
1
|
+
gsMap/__init__.py,sha256=xjO1mrd3lI32sCY5mQ8rHHD4yyTbUr94E758a72nT4c,77
|
2
2
|
gsMap/__main__.py,sha256=Vdhw8YA1K3wPMlbJQYL5WqvRzAKVeZ16mZQFO9VRmCo,62
|
3
3
|
gsMap/cauchy_combination_test.py,sha256=SiUyqJKr4ATFtRgsCEJ43joGcSagCOnnurkB1FlQiB4,5105
|
4
|
-
gsMap/config.py,sha256=
|
5
|
-
gsMap/create_slice_mean.py,sha256=
|
6
|
-
gsMap/diagnosis.py,sha256=
|
7
|
-
gsMap/find_latent_representation.py,sha256=
|
4
|
+
gsMap/config.py,sha256=LmBVMb0eda6bfrKkQuh7eZnZdvgecjCnozRd_clqvlY,51584
|
5
|
+
gsMap/create_slice_mean.py,sha256=Nnmb7ACtS-9TurW5xQ4TqCinejPsYcvuT5Oxqa5Uges,5723
|
6
|
+
gsMap/diagnosis.py,sha256=YyT_TkPbb3c22DLpRYu9yynbNGrhytcCgxCoPwz9Bpc,12962
|
7
|
+
gsMap/find_latent_representation.py,sha256=aZ5fFY2RhAsNaDeoehd5lN28556d6GGHK9xEUTvo6G4,5365
|
8
8
|
gsMap/format_sumstats.py,sha256=1c9OgbqDQWOgXeSrbAhbJfChv_2IwXIgLE6Pbw2sx0s,13778
|
9
|
-
gsMap/generate_ldscore.py,sha256=
|
10
|
-
gsMap/latent_to_gene.py,sha256=
|
9
|
+
gsMap/generate_ldscore.py,sha256=xxzbaANl638bRvRAowrTPmFA4dEC0zDBv6i8KQTJvJ8,45094
|
10
|
+
gsMap/latent_to_gene.py,sha256=sDPvOU4iF-HkfQY0nnkIVXpjyTQ9-PjQflwEFWrPg-A,12869
|
11
11
|
gsMap/main.py,sha256=SzfAXhrlr4LXnSD4gkvAtUUPYXyra6a_MzVCxDBZjr0,1170
|
12
12
|
gsMap/report.py,sha256=_1FYkzGhVGMnvHgEQ8z51iMrVEVlh48a31jLqbV2o9w,6953
|
13
|
-
gsMap/run_all_mode.py,sha256=
|
13
|
+
gsMap/run_all_mode.py,sha256=LhMTT85B6yoDG9MvKmclQWYdQyNIP0FFdHpYVGTCJTs,9381
|
14
14
|
gsMap/setup.py,sha256=lsIQCChHwR0ojWZs7xay8rukRaLlueuLkc83bp-B2ZE,103
|
15
15
|
gsMap/spatial_ldsc_multiple_sumstats.py,sha256=-mawOBjn8-Y5Irl8mv8ye83hfiEJ1mkLrRIQiI-XaMM,17973
|
16
16
|
gsMap/visualize.py,sha256=N55s-xmzSd_DtIesrGewfDeoytYUcMd2acDsjEpChCA,7242
|
17
17
|
gsMap/GNN/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
18
|
gsMap/GNN/adjacency_matrix.py,sha256=MfkhgpAHJcC-3l_iZDQQYD30w4bpe29-8s6kkGxiwQw,3231
|
19
19
|
gsMap/GNN/model.py,sha256=75In9sxBkaqqpCQSrQEUO-zsQQVQnkXVbKsAgyAZjiQ,2918
|
20
|
-
gsMap/GNN/train.py,sha256=
|
20
|
+
gsMap/GNN/train.py,sha256=4qipaxaz3rQOtlRpTYCfl1Oz4kz_A6vNB1aw8_gGK_k,3076
|
21
21
|
gsMap/templates/report_template.html,sha256=QODZEbVxpW1xsLz7lDrD_DyUfzYoi9E17o2tLJlf8OQ,8016
|
22
22
|
gsMap/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
23
|
-
gsMap/utils/generate_r2_matrix.py,sha256=
|
23
|
+
gsMap/utils/generate_r2_matrix.py,sha256=0zyoJDWUVavlQtR6_XXb7Ah9UhPyT3n0t6XCqlI1HXQ,17354
|
24
24
|
gsMap/utils/jackknife.py,sha256=w_qMj9GlqViouHuOw1U80N6doWuCTXuPoAVU4P-5mm8,17673
|
25
|
-
gsMap/utils/manhattan_plot.py,sha256=
|
25
|
+
gsMap/utils/manhattan_plot.py,sha256=4ok5CHAaT_MadyMPnFZMR_llmE8Vf4-KiEfametgHq0,25480
|
26
26
|
gsMap/utils/regression_read.py,sha256=rKA0nkUpTJf6WuGddhKrsBCExchDNEyojOWu_qddZNw,5474
|
27
|
-
gsmap-1.73.
|
28
|
-
gsmap-1.73.
|
29
|
-
gsmap-1.73.
|
30
|
-
gsmap-1.73.
|
31
|
-
gsmap-1.73.
|
27
|
+
gsmap-1.73.2.dist-info/entry_points.txt,sha256=s_P2Za22O077tc1FPLKMinbdRVXaN_HTcDBgWMYpqA4,41
|
28
|
+
gsmap-1.73.2.dist-info/licenses/LICENSE,sha256=fb5WP6qQytSKO5rM0ZSqQXg_92Fdt0aAeFNwSi3Lpmc,1069
|
29
|
+
gsmap-1.73.2.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
30
|
+
gsmap-1.73.2.dist-info/METADATA,sha256=giDX_EkW5AutmnHHukvC2Kw29fY-q939rA9cWJP5pMY,8196
|
31
|
+
gsmap-1.73.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|