pycmplot 0.2.2__tar.gz → 0.2.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 (36) hide show
  1. {pycmplot-0.2.2/pycmplot.egg-info → pycmplot-0.2.3}/PKG-INFO +1 -1
  2. {pycmplot-0.2.2 → pycmplot-0.2.3}/docs/conf.py +1 -1
  3. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot/__init__.py +1 -1
  4. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot/_core.py +4 -4
  5. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot/io.py +18 -5
  6. {pycmplot-0.2.2 → pycmplot-0.2.3/pycmplot.egg-info}/PKG-INFO +1 -1
  7. {pycmplot-0.2.2 → pycmplot-0.2.3}/pyproject.toml +2 -2
  8. {pycmplot-0.2.2 → pycmplot-0.2.3}/setup.cfg +1 -1
  9. {pycmplot-0.2.2 → pycmplot-0.2.3}/LICENSE +0 -0
  10. {pycmplot-0.2.2 → pycmplot-0.2.3}/README.md +0 -0
  11. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot/annotation.py +0 -0
  12. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot/cli.py +0 -0
  13. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot/constants.py +0 -0
  14. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot/data/Homo_sapiens.GRCh37.geneinfo.tsv.gz +0 -0
  15. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot/data/Homo_sapiens.GRCh38.geneinfo.tsv.gz +0 -0
  16. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot/data/hg19ToHg38.over.chain +0 -0
  17. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot/liftover.py +0 -0
  18. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot/plotting/circular.py +0 -0
  19. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot/plotting/linear.py +0 -0
  20. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot/plotting/qq.py +0 -0
  21. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot/resources.py +0 -0
  22. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot/stats.py +0 -0
  23. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot.egg-info/SOURCES.txt +0 -0
  24. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot.egg-info/dependency_links.txt +0 -0
  25. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot.egg-info/entry_points.txt +0 -0
  26. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot.egg-info/requires.txt +0 -0
  27. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot.egg-info/top_level.txt +0 -0
  28. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot_docs/docs/conf.py +0 -0
  29. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot_docs/docstrings_annotation.py +0 -0
  30. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot_docs/docstrings_core_cli.py +0 -0
  31. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot_docs/docstrings_io.py +0 -0
  32. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot_docs/docstrings_liftover.py +0 -0
  33. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot_docs/docstrings_plotting.py +0 -0
  34. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot_docs/docstrings_resources_constants.py +0 -0
  35. {pycmplot-0.2.2 → pycmplot-0.2.3}/pycmplot_docs/docstrings_stats.py +0 -0
  36. {pycmplot-0.2.2 → pycmplot-0.2.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycmplot
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Multi-track circular and linear Manhattan plot generation for GWAS summary statistics
5
5
  Author: Kevin Esoh
6
6
  Author-email: Kevin Esoh <kesohku1@jh.edu>
@@ -12,7 +12,7 @@ sys.path.insert(0, os.path.abspath(".."))
12
12
  project = "pycmplot"
13
13
  copyright = "2026, Kevin Esoh"
14
14
  author = "Kevin Esoh"
15
- release = "0.2.2" # update to match PyPI version
15
+ release = "0.2.3" # update to match PyPI version
16
16
 
17
17
  # -- General configuration -----------------------------------------------------
18
18
  extensions = [
@@ -42,4 +42,4 @@ __all__ = [
42
42
  "ResourceConfig",
43
43
  ]
44
44
 
45
- __version__ = "0.2.1"
45
+ __version__ = "0.2.3"
@@ -229,13 +229,13 @@ def main() -> None:
229
229
  # ------------------------------------------------------------------
230
230
  # ANNOTATE BY
231
231
  # ------------------------------------------------------------------
232
+ label_col = 'SNP'
232
233
  if annotate:
233
- if str(annotate).upper() == "GENE":
234
+ if str(annotate).upper() == "GENE" and 'top_gene' in hits_table.columns:
234
235
  label_col = 'top_gene'
235
- elif str(annotate).upper() == "SNP":
236
- label_col = 'SNP'
237
- else:
236
+ elif label_col in hits_table.columns:
238
237
  label_col = annotate
238
+
239
239
 
240
240
  logger.info(f"Anotate by: {label_col}")
241
241
 
@@ -39,6 +39,7 @@ import pandas as pd
39
39
  from pycmplot.stats import get_lead_snps, get_highlight_snps
40
40
  from pycmplot.annotation import get_hits_summary_table
41
41
  from pycmplot.resources import ResourceConfig, default_resources
42
+ from pycmplot.constants import hg38_chr_lengths
42
43
 
43
44
  logger = logging.getLogger(__name__)
44
45
 
@@ -563,8 +564,9 @@ def prep_pycmplot_input_info(
563
564
  snp_candidates = [c for c in snp_candidates if c]
564
565
  pvl_candidates = [c for c in pvl_candidates if c]
565
566
 
566
- bld_candidates = []
567
- if buildc:
567
+ #if buildc:
568
+ bld_candidates = buildc
569
+ if not bld_candidates:
568
570
  bld_candidates = ["BUILD", "Genome", "Genome_Build", "Genome-build"]
569
571
  bld_candidates_l = [x.lower() for x in bld_candidates]
570
572
  bld_candidates_u = [x.upper() for x in bld_candidates]
@@ -635,7 +637,7 @@ def prep_pycmplot_input_info(
635
637
  }
636
638
  col_dtypes = {
637
639
  chrom_col: str,
638
- pos_col: int,
640
+ pos_col: object,
639
641
  snp_col: str,
640
642
  pcol: float,
641
643
  bcol: str,
@@ -682,6 +684,7 @@ def get_sumstats_and_merged_sector_list(
682
684
  signif_line: Optional[float] = None,
683
685
  suggest_threshold: Optional[float] = None,
684
686
  resources: Optional[ResourceConfig] = None,
687
+ hg38_chr_lengths = hg38_chr_lengths,
685
688
  ):
686
689
  GET_SUMSTATS = """Load summary statistics, run liftover, extract lead SNPs, and compute
687
690
  merged Circos sector sizes.
@@ -824,7 +827,7 @@ def get_sumstats_and_merged_sector_list(
824
827
  ).rename(columns=sumstat_newcols)
825
828
 
826
829
  # Get dict of p-values for qq-plotting before applying trim_pval
827
- logger.info("Extracting raw p-values for qq-plotting ...")
830
+ logger.info("Extracting raw p-values for QQ-plotting ...")
828
831
  pval_dict[label] = df["P"].dropna().astype(float).values
829
832
 
830
833
 
@@ -834,7 +837,7 @@ def get_sumstats_and_merged_sector_list(
834
837
 
835
838
  # Trim insignificant variants for faster plotting
836
839
  if trim_pval:
837
- logger.info("Excluding variants with p-value less than %s ...", trim_pval)
840
+ logger.info("Excluding variants with p-value less than %s to speed up Manhattan plotting ...", trim_pval)
838
841
  df = df[df["P"].astype(float) <= float(trim_pval)]
839
842
  else:
840
843
  df = df[df["P"].astype(float) <= 1]
@@ -863,6 +866,7 @@ def get_sumstats_and_merged_sector_list(
863
866
  if "BUILD" in df.columns and "hg19" in df["BUILD"].unique():
864
867
  logger.info("Converting hg19 coordinates to hg38 ...")
865
868
  sumstats_loaded[label][0] = liftover_position(df, resources=resources)
869
+ liftover = True
866
870
 
867
871
  # Lead SNPs
868
872
  logger.info("Extracting variants to highlight ...")
@@ -959,6 +963,15 @@ def get_sumstats_and_merged_sector_list(
959
963
  sub = assoc[assoc["CHR"] == chrom]
960
964
  lo_val = max(sub["POS"].min() - 1_000_000, 0)
961
965
  hi_val = sub["POS"].max()
966
+ chrom_max = hi_val
967
+
968
+ # Ensure sector sizes are within chrom ranges if liftover
969
+ if liftover:
970
+ logger.info("Limiting sector sizes to chromosome ranges for liftover sumstats ...")
971
+ hg38_chr_lengths = {k.replace("chr",""): v for k, v in hg38_chr_lengths.items()}
972
+ chrom_max = hg38_chr_lengths[chrom]
973
+
974
+ hi_val = min(hi_val, chrom_max)
962
975
  assoc_dic[str(chrom)] = [lo_val, hi_val]
963
976
 
964
977
  min_dic_val = min(assoc_dic.values())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycmplot
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Multi-track circular and linear Manhattan plot generation for GWAS summary statistics
5
5
  Author: Kevin Esoh
6
6
  Author-email: Kevin Esoh <kesohku1@jh.edu>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pycmplot"
7
- version = "0.2.2"
7
+ version = "0.2.3"
8
8
  description = "Multi-track circular and linear Manhattan plot generation for GWAS summary statistics"
9
9
  readme = "README.md"
10
10
  license = "CC-BY-NC-SA-4.0"
@@ -36,7 +36,7 @@ where = ["."]
36
36
  exclude = [
37
37
  "dist*", "changelog.d*", "build-pypi-package.md",
38
38
  "pycmplot_python_api.ipynb", "mit-license.txt",
39
- "pycmplot_docs", "docs"
39
+ "pycmplot_docs", "docs", "CHANGELOG.rst"
40
40
  ]
41
41
 
42
42
 
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = pycmplot
3
- version = 0.2.2
3
+ version = 0.2.3
4
4
  author = Kevin Esoh
5
5
  author_email = kesohku1@jh.edu
6
6
  description = Multi-track circular and linear Manhattan plot generation for GWAS summary statistics
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes