gsMap 1.73.1__tar.gz → 1.73.3__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.
Files changed (79) hide show
  1. {gsmap-1.73.1 → gsmap-1.73.3}/.pre-commit-config.yaml +1 -1
  2. {gsmap-1.73.1 → gsmap-1.73.3}/PKG-INFO +1 -1
  3. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/__init__.py +1 -1
  4. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/diagnosis.py +16 -6
  5. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/generate_ldscore.py +8 -2
  6. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/utils/manhattan_plot.py +15 -7
  7. {gsmap-1.73.1 → gsmap-1.73.3}/.coveragerc +0 -0
  8. {gsmap-1.73.1 → gsmap-1.73.3}/.github/workflows/docs.yml +0 -0
  9. {gsmap-1.73.1 → gsmap-1.73.3}/.github/workflows/publish-to-pypi.yml +0 -0
  10. {gsmap-1.73.1 → gsmap-1.73.3}/.github/workflows/test_linux.yml +0 -0
  11. {gsmap-1.73.1 → gsmap-1.73.3}/.gitignore +0 -0
  12. {gsmap-1.73.1 → gsmap-1.73.3}/.markdownlint.yaml +0 -0
  13. {gsmap-1.73.1 → gsmap-1.73.3}/LICENSE +0 -0
  14. {gsmap-1.73.1 → gsmap-1.73.3}/README.md +0 -0
  15. {gsmap-1.73.1 → gsmap-1.73.3}/codecov.yml +0 -0
  16. {gsmap-1.73.1 → gsmap-1.73.3}/docs/Makefile +0 -0
  17. {gsmap-1.73.1 → gsmap-1.73.3}/docs/make.bat +0 -0
  18. {gsmap-1.73.1 → gsmap-1.73.3}/docs/requirements.txt +0 -0
  19. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/10x.md +0 -0
  20. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/_static/schematic.svg +0 -0
  21. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/advanced_usage.md +0 -0
  22. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/api/cauchy_combination.rst +0 -0
  23. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/api/create_slice_mean.rst +0 -0
  24. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/api/find_latent_representations.rst +0 -0
  25. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/api/format_sumstats.rst +0 -0
  26. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/api/generate_ldscore.rst +0 -0
  27. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/api/latent_to_gene.rst +0 -0
  28. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/api/quick_mode.rst +0 -0
  29. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/api/report.rst +0 -0
  30. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/api/spatial_ldsc.rst +0 -0
  31. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/api.rst +0 -0
  32. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/conf.py +0 -0
  33. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/data.rst +0 -0
  34. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/data_format.md +0 -0
  35. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/index.rst +0 -0
  36. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/install.rst +0 -0
  37. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/quick_mode.md +0 -0
  38. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/release.rst +0 -0
  39. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/step_by_step.md +0 -0
  40. {gsmap-1.73.1 → gsmap-1.73.3}/docs/source/tutorials.rst +0 -0
  41. {gsmap-1.73.1 → gsmap-1.73.3}/pyproject.toml +0 -0
  42. {gsmap-1.73.1 → gsmap-1.73.3}/schematic.png +0 -0
  43. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/GNN/__init__.py +0 -0
  44. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/GNN/adjacency_matrix.py +0 -0
  45. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/GNN/model.py +0 -0
  46. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/GNN/train.py +0 -0
  47. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/__main__.py +0 -0
  48. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/cauchy_combination_test.py +0 -0
  49. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/config.py +0 -0
  50. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/create_slice_mean.py +0 -0
  51. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/find_latent_representation.py +0 -0
  52. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/format_sumstats.py +0 -0
  53. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/latent_to_gene.py +0 -0
  54. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/main.py +0 -0
  55. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/report.py +0 -0
  56. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/run_all_mode.py +0 -0
  57. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/setup.py +0 -0
  58. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/spatial_ldsc_multiple_sumstats.py +0 -0
  59. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/templates/report_template.html +0 -0
  60. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/utils/__init__.py +0 -0
  61. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/utils/generate_r2_matrix.py +0 -0
  62. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/utils/jackknife.py +0 -0
  63. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/utils/regression_read.py +0 -0
  64. {gsmap-1.73.1 → gsmap-1.73.3}/src/gsMap/visualize.py +0 -0
  65. {gsmap-1.73.1 → gsmap-1.73.3}/tests/conftest.py +0 -0
  66. {gsmap-1.73.1 → gsmap-1.73.3}/tests/test_advanced_usage.py +0 -0
  67. {gsmap-1.73.1 → gsmap-1.73.3}/tests/test_cli.py +0 -0
  68. {gsmap-1.73.1 → gsmap-1.73.3}/tests/test_docs_cli_parsing.py +0 -0
  69. {gsmap-1.73.1 → gsmap-1.73.3}/visualization_web_docs/Makefile +0 -0
  70. {gsmap-1.73.1 → gsmap-1.73.3}/visualization_web_docs/make.bat +0 -0
  71. {gsmap-1.73.1 → gsmap-1.73.3}/visualization_web_docs/requirements.txt +0 -0
  72. {gsmap-1.73.1 → gsmap-1.73.3}/visualization_web_docs/source/_static/raw1_add_txt.svg +0 -0
  73. {gsmap-1.73.1 → gsmap-1.73.3}/visualization_web_docs/source/_static/raw2_add_txt.svg +0 -0
  74. {gsmap-1.73.1 → gsmap-1.73.3}/visualization_web_docs/source/_static/raw3_add_txt.svg +0 -0
  75. {gsmap-1.73.1 → gsmap-1.73.3}/visualization_web_docs/source/_static/raw4_add_txt.svg +0 -0
  76. {gsmap-1.73.1 → gsmap-1.73.3}/visualization_web_docs/source/_static/raw5_add_txt.svg +0 -0
  77. {gsmap-1.73.1 → gsmap-1.73.3}/visualization_web_docs/source/_static/schematic.svg +0 -0
  78. {gsmap-1.73.1 → gsmap-1.73.3}/visualization_web_docs/source/conf.py +0 -0
  79. {gsmap-1.73.1 → gsmap-1.73.3}/visualization_web_docs/source/index.rst +0 -0
@@ -38,7 +38,7 @@ repos:
38
38
  )$
39
39
 
40
40
  - repo: https://github.com/astral-sh/ruff-pre-commit
41
- rev: v0.11.5
41
+ rev: v0.11.6
42
42
  hooks:
43
43
  - id: ruff
44
44
  args: [--fix, --exit-non-zero-on-fix]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gsMap
3
- Version: 1.73.1
3
+ Version: 1.73.3
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
@@ -2,4 +2,4 @@
2
2
  Genetics-informed pathogenic spatial mapping
3
3
  """
4
4
 
5
- __version__ = "1.73.1"
5
+ __version__ = "1.73.3"
@@ -51,8 +51,8 @@ def compute_gene_diagnostic_info(config: DiagnosisConfig):
51
51
  mk_score = mk_score.loc[trait_ldsc_result.index]
52
52
 
53
53
  # Filter out genes with no variation
54
- non_zero_std_cols = mk_score.columns[mk_score.std() > 0]
55
- mk_score = mk_score.loc[:, non_zero_std_cols]
54
+ has_variation = (~mk_score.eq(mk_score.iloc[0], axis=1)).any()
55
+ mk_score = mk_score.loc[:, has_variation]
56
56
 
57
57
  logger.info("Calculating correlation between gene marker scores and trait logp-values...")
58
58
  corr = mk_score.corrwith(trait_ldsc_result["logp"])
@@ -69,10 +69,6 @@ def compute_gene_diagnostic_info(config: DiagnosisConfig):
69
69
  }
70
70
  )
71
71
 
72
- # Filter based on median GSS score
73
- high_GSS_Gene_annotation_pair = high_GSS_Gene_annotation_pair[
74
- high_GSS_Gene_annotation_pair["Median_GSS"] >= 1.0
75
- ]
76
72
  high_GSS_Gene_annotation_pair = high_GSS_Gene_annotation_pair.merge(
77
73
  corr, left_on="Gene", right_index=True
78
74
  )
@@ -161,6 +157,20 @@ def generate_manhattan_plot(config: DiagnosisConfig):
161
157
  + gwas_data_to_plot["Annotation"].astype(str)
162
158
  )
163
159
 
160
+ # Verify data integrity
161
+ if gwas_data_with_gene_annotation_sort.empty:
162
+ logger.error("Filtered GWAS data is empty, cannot create Manhattan plot")
163
+ return
164
+
165
+ if len(gwas_data_to_plot) == 0:
166
+ logger.error("No SNPs passed filtering criteria for Manhattan plot")
167
+ return
168
+
169
+ # Log some diagnostic information
170
+ logger.info(f"Creating Manhattan plot with {len(gwas_data_to_plot)} SNPs")
171
+ logger.info(f"Columns available: {list(gwas_data_to_plot.columns)}")
172
+ logger.info(f"Chromosome column values: {gwas_data_to_plot['CHR'].unique()}")
173
+
164
174
  fig = ManhattanPlot(
165
175
  dataframe=gwas_data_to_plot,
166
176
  title="gsMap Diagnosis Manhattan Plot",
@@ -57,7 +57,8 @@ def load_gtf(
57
57
  gtf = gtf[gtf["Feature"] == "gene"]
58
58
 
59
59
  # Find common genes between GTF and marker scores
60
- common_gene = np.intersect1d(mk_score.index, gtf.gene_name)
60
+ # common_gene = np.intersect1d(mk_score.index, gtf.gene_name)
61
+ common_gene = list(set(mk_score.index) & set(gtf.gene_name))
61
62
  logger.info(f"Found {len(common_gene)} common genes between GTF and marker scores")
62
63
 
63
64
  # Filter GTF and marker scores to common genes
@@ -69,6 +70,9 @@ def load_gtf(
69
70
 
70
71
  # Process the GTF (open window around gene coordinates)
71
72
  gtf_bed = gtf[["Chromosome", "Start", "End", "gene_name", "Strand"]].copy()
73
+ gtf_bed["Chromosome"] = gtf_bed["Chromosome"].apply(
74
+ lambda x: f"chr{x}" if not str(x).startswith("chr") else x
75
+ )
72
76
  gtf_bed.loc[:, "TSS"] = gtf_bed["Start"]
73
77
  gtf_bed.loc[:, "TED"] = gtf_bed["End"]
74
78
 
@@ -128,7 +132,7 @@ def load_bim(bfile_root: str, chrom: int) -> tuple[pd.DataFrame, pr.PyRanges]:
128
132
  - bim_pr is a PyRanges object with BIM data
129
133
  """
130
134
  bim_file = f"{bfile_root}.{chrom}.bim"
131
- logger.debug(f"Loading BIM file: {bim_file}")
135
+ logger.info(f"Loading BIM file: {bim_file}")
132
136
 
133
137
  bim = pd.read_csv(bim_file, sep="\t", header=None)
134
138
  bim.columns = ["CHR", "SNP", "CM", "BP", "A1", "A2"]
@@ -311,6 +315,8 @@ def get_ldscore(
311
315
  bfile_chr_prefix=f"{bfile_root}.{chrom}", keep_snps=keep_snps_index
312
316
  )
313
317
 
318
+ annot_matrix = annot_matrix[geno_array.kept_snps, :]
319
+
314
320
  # Configure LD window based on specified unit
315
321
  if ld_unit == "SNP":
316
322
  max_dist = ld_wind
@@ -308,13 +308,21 @@ class _ManhattanPlot:
308
308
  self.index = "INDEX"
309
309
  self.pos = "POSITION"
310
310
 
311
- # Fixes the bug where one chromosome is missing by adding a sequential
312
- # index column.
313
- idx = 0
314
- for i in self.data[chrm].unique():
315
- idx = idx + 1
316
- self.data.loc[self.data[chrm] == i, self.index] = int(idx)
317
- # Set the type to be the same as provided for chrm column
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
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
File without changes
File without changes