gwasstudio 2.12.1__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 (38) hide show
  1. gwasstudio-2.12.1/PKG-INFO +87 -0
  2. gwasstudio-2.12.1/README.md +51 -0
  3. gwasstudio-2.12.1/pyproject.toml +128 -0
  4. gwasstudio-2.12.1/src/gwasstudio/__init__.py +78 -0
  5. gwasstudio-2.12.1/src/gwasstudio/cli/__init__.py +7 -0
  6. gwasstudio-2.12.1/src/gwasstudio/cli/export.py +422 -0
  7. gwasstudio-2.12.1/src/gwasstudio/cli/info.py +19 -0
  8. gwasstudio-2.12.1/src/gwasstudio/cli/ingest.py +213 -0
  9. gwasstudio-2.12.1/src/gwasstudio/cli/list.py +66 -0
  10. gwasstudio-2.12.1/src/gwasstudio/cli/metadata/__init__.py +0 -0
  11. gwasstudio-2.12.1/src/gwasstudio/cli/metadata/query.py +66 -0
  12. gwasstudio-2.12.1/src/gwasstudio/config/__init__.py +0 -0
  13. gwasstudio-2.12.1/src/gwasstudio/config/config.yaml +51 -0
  14. gwasstudio-2.12.1/src/gwasstudio/config_manager.py +102 -0
  15. gwasstudio-2.12.1/src/gwasstudio/dask_client.py +200 -0
  16. gwasstudio-2.12.1/src/gwasstudio/main.py +200 -0
  17. gwasstudio-2.12.1/src/gwasstudio/methods/__init__.py +0 -0
  18. gwasstudio-2.12.1/src/gwasstudio/methods/compute_pheno_variance.py +9 -0
  19. gwasstudio-2.12.1/src/gwasstudio/methods/dataframe.py +93 -0
  20. gwasstudio-2.12.1/src/gwasstudio/methods/extraction_methods.py +154 -0
  21. gwasstudio-2.12.1/src/gwasstudio/methods/locus_breaker.py +155 -0
  22. gwasstudio-2.12.1/src/gwasstudio/methods/manhattan_plot.py +61 -0
  23. gwasstudio-2.12.1/src/gwasstudio/mongo/__init__.py +0 -0
  24. gwasstudio-2.12.1/src/gwasstudio/mongo/connection_manager.py +33 -0
  25. gwasstudio-2.12.1/src/gwasstudio/mongo/mixin.py +179 -0
  26. gwasstudio-2.12.1/src/gwasstudio/mongo/models.py +147 -0
  27. gwasstudio-2.12.1/src/gwasstudio/utils/__init__.py +193 -0
  28. gwasstudio-2.12.1/src/gwasstudio/utils/cfg.py +90 -0
  29. gwasstudio-2.12.1/src/gwasstudio/utils/datatypes.py +17 -0
  30. gwasstudio-2.12.1/src/gwasstudio/utils/enums.py +84 -0
  31. gwasstudio-2.12.1/src/gwasstudio/utils/hashing.py +92 -0
  32. gwasstudio-2.12.1/src/gwasstudio/utils/io.py +58 -0
  33. gwasstudio-2.12.1/src/gwasstudio/utils/metadata.py +233 -0
  34. gwasstudio-2.12.1/src/gwasstudio/utils/mongo_manager.py +136 -0
  35. gwasstudio-2.12.1/src/gwasstudio/utils/path_joiner.py +128 -0
  36. gwasstudio-2.12.1/src/gwasstudio/utils/s3.py +61 -0
  37. gwasstudio-2.12.1/src/gwasstudio/utils/tdb_schema.py +124 -0
  38. gwasstudio-2.12.1/src/gwasstudio/utils/vault.py +59 -0
@@ -0,0 +1,87 @@
1
+ Metadata-Version: 2.3
2
+ Name: gwasstudio
3
+ Version: 2.12.1
4
+ Summary:
5
+ Author: Gianmauro Cuccuru
6
+ Author-email: gianmauro.cuccuru@fht.org
7
+ Requires-Python: >=3.10,<3.13
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Provides-Extra: plot
13
+ Requires-Dist: bokeh (>=3.7.3,<4.0.0)
14
+ Requires-Dist: boto3 (>=1.37.11,<2.0.0)
15
+ Requires-Dist: botocore (>=1.37.11,<2.0.0)
16
+ Requires-Dist: click (>=8.1.8,<9.0.0)
17
+ Requires-Dist: cloup (>=3.0.5,<4.0.0)
18
+ Requires-Dist: dash-bio (>=1.0.1,<2.0.0) ; extra == "plot"
19
+ Requires-Dist: dask (>=2024.12.1,<2025.0.0)
20
+ Requires-Dist: dask-gateway (>=2024.1.0,<2025.0.0)
21
+ Requires-Dist: dask-jobqueue (>=0.9.0,<0.10.0)
22
+ Requires-Dist: hvac (>=2.3.0,<3.0.0)
23
+ Requires-Dist: loguru (>=0.7.3,<0.8.0)
24
+ Requires-Dist: mongoengine (>=0.29.1,<0.30.0)
25
+ Requires-Dist: numpy (>=2.2.1,<2.3.0)
26
+ Requires-Dist: pandas (>=2.2.3,<3.0.0)
27
+ Requires-Dist: platformdirs (>=4.3.8,<5.0.0)
28
+ Requires-Dist: plotly (==6.1.0) ; extra == "plot"
29
+ Requires-Dist: polars (>=1.19.0,<2.0.0)
30
+ Requires-Dist: pyarrow (>=18.1.0,<19.0.0)
31
+ Requires-Dist: ruamel-yaml (>=0.18.10,<0.19.0)
32
+ Requires-Dist: scipy (>=1.15.3,<2.0.0)
33
+ Requires-Dist: tiledb (>=0.33.2,<0.34.0)
34
+ Description-Content-Type: text/markdown
35
+
36
+
37
+
38
+ # GWASStudio: A Tool for Genomic Data Management
39
+
40
+ ![alt text](image.png)
41
+
42
+
43
+ ## Overview
44
+
45
+ GWASStudio is a powerful CLI tool designed for efficient storage, retrieval, and querying of genomic summary statistics. It offers a high-performance infrastructure for handling and analyzing large-scale GWAS and QTL datasets, enabling seamless cross-dataset exploration.
46
+
47
+ ## Core Purpose
48
+
49
+ GWASStudio provides a unified interface across the [CDH](https://github.com/ht-diva/cdh_in_a_box) infrastructure, handling the ingestion, storage, querying and export of genomic data using high-performance technologies.
50
+
51
+ ## Key Functionalities
52
+
53
+ GWASStudio consists of several key functionalities:
54
+
55
+ ### 1. Data Ingestion
56
+ - **Data Ingestion**: Imports summary statistics data and its metadata associated.
57
+ - **Support for Multiple Storage Options**: Works with both local filesystems and cloud storage (S3).
58
+
59
+ ### 2. Data Querying
60
+ - **Flexible Search**: Enables searching metadata using template files.
61
+
62
+ ### 3. Data Export
63
+ - **Selective Export**: Extracts subsets of data and its metadata associated based on genomic regions, SNPs, or the entire set of data.
64
+
65
+ ## Technical Architecture
66
+
67
+ GWASStudio leverages several advanced technologies:
68
+
69
+ 1. **TileDB Embedded**: A high-performance array storage engine that enables efficient storage and retrieval of genomic data.
70
+ 2. **MongoDB**: A flexible, scalable NoSQL database used for storing and querying metadata associated with genomic datasets.
71
+ 3. **Dask**: Provides distributed computing capabilities for processing large datasets.
72
+ 4. **Python Ecosystem**: Built on Python with libraries like Click/Cloup for CLI interfaces, Pandas for data manipulation, and various genomics-specific tools.
73
+
74
+ ## Installation
75
+
76
+ For detailed installation instructions, please refer to the documentation at [https://ht-diva.github.io/gwasstudio/](https://ht-diva.github.io/gwasstudio/)
77
+
78
+ ## Usage
79
+
80
+ For detailed instructions on how to use this tool, please refer to the [documentation](https://ht-diva.github.io/gwasstudio/) and check the [cli_test](scripts/) script for a practical guide by examples.
81
+
82
+ ## Citation
83
+
84
+ Example files are derived from:
85
+
86
+ The variant call format provides efficient and robust storage of GWAS summary statistics. Matthew Lyon, Shea J Andrews, Ben Elsworth, Tom R Gaunt, Gibran Hemani, Edoardo Marcora. bioRxiv 2020.05.29.115824; doi: https://doi.org/10.1101/2020.05.29.115824
87
+
@@ -0,0 +1,51 @@
1
+
2
+
3
+ # GWASStudio: A Tool for Genomic Data Management
4
+
5
+ ![alt text](image.png)
6
+
7
+
8
+ ## Overview
9
+
10
+ GWASStudio is a powerful CLI tool designed for efficient storage, retrieval, and querying of genomic summary statistics. It offers a high-performance infrastructure for handling and analyzing large-scale GWAS and QTL datasets, enabling seamless cross-dataset exploration.
11
+
12
+ ## Core Purpose
13
+
14
+ GWASStudio provides a unified interface across the [CDH](https://github.com/ht-diva/cdh_in_a_box) infrastructure, handling the ingestion, storage, querying and export of genomic data using high-performance technologies.
15
+
16
+ ## Key Functionalities
17
+
18
+ GWASStudio consists of several key functionalities:
19
+
20
+ ### 1. Data Ingestion
21
+ - **Data Ingestion**: Imports summary statistics data and its metadata associated.
22
+ - **Support for Multiple Storage Options**: Works with both local filesystems and cloud storage (S3).
23
+
24
+ ### 2. Data Querying
25
+ - **Flexible Search**: Enables searching metadata using template files.
26
+
27
+ ### 3. Data Export
28
+ - **Selective Export**: Extracts subsets of data and its metadata associated based on genomic regions, SNPs, or the entire set of data.
29
+
30
+ ## Technical Architecture
31
+
32
+ GWASStudio leverages several advanced technologies:
33
+
34
+ 1. **TileDB Embedded**: A high-performance array storage engine that enables efficient storage and retrieval of genomic data.
35
+ 2. **MongoDB**: A flexible, scalable NoSQL database used for storing and querying metadata associated with genomic datasets.
36
+ 3. **Dask**: Provides distributed computing capabilities for processing large datasets.
37
+ 4. **Python Ecosystem**: Built on Python with libraries like Click/Cloup for CLI interfaces, Pandas for data manipulation, and various genomics-specific tools.
38
+
39
+ ## Installation
40
+
41
+ For detailed installation instructions, please refer to the documentation at [https://ht-diva.github.io/gwasstudio/](https://ht-diva.github.io/gwasstudio/)
42
+
43
+ ## Usage
44
+
45
+ For detailed instructions on how to use this tool, please refer to the [documentation](https://ht-diva.github.io/gwasstudio/) and check the [cli_test](scripts/) script for a practical guide by examples.
46
+
47
+ ## Citation
48
+
49
+ Example files are derived from:
50
+
51
+ The variant call format provides efficient and robust storage of GWAS summary statistics. Matthew Lyon, Shea J Andrews, Ben Elsworth, Tom R Gaunt, Gibran Hemani, Edoardo Marcora. bioRxiv 2020.05.29.115824; doi: https://doi.org/10.1101/2020.05.29.115824
@@ -0,0 +1,128 @@
1
+ [project]
2
+ name = "gwasstudio"
3
+ version = "2.12.1"
4
+ description = ""
5
+ authors = [
6
+ { name = "Gianmauro Cuccuru", email = "gianmauro.cuccuru@fht.org" },
7
+ { name = "Bruno Ariano", email = "bruno.ariano@fht.org" },
8
+ ]
9
+ readme = "README.md"
10
+ requires-python = ">=3.10,<3.13"
11
+ dependencies = [
12
+ "bokeh (>=3.7.3,<4.0.0)",
13
+ "boto3 (>=1.37.11,<2.0.0)",
14
+ "botocore (>=1.37.11,<2.0.0)",
15
+ "click (>=8.1.8,<9.0.0)",
16
+ "cloup (>=3.0.5,<4.0.0)",
17
+ "dask (>=2024.12.1,<2025.0.0)",
18
+ "dask-gateway (>=2024.1.0,<2025.0.0)",
19
+ "dask-jobqueue (>=0.9.0,<0.10.0)",
20
+ "hvac (>=2.3.0,<3.0.0)",
21
+ "loguru (>=0.7.3,<0.8.0)",
22
+ "mongoengine (>=0.29.1,<0.30.0)",
23
+ "numpy (>=2.2.1,<2.3.0)",
24
+ "pandas (>=2.2.3,<3.0.0)",
25
+ "platformdirs (>=4.3.8,<5.0.0)",
26
+ "polars (>=1.19.0,<2.0.0)",
27
+ "pyarrow (>=18.1.0,<19.0.0)",
28
+ "ruamel-yaml (>=0.18.10,<0.19.0)",
29
+ "scipy (>=1.15.3,<2.0.0)",
30
+ "tiledb (>=0.33.2,<0.34.0)",
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ plot = [
35
+ "plotly (==6.1.0)",
36
+ "dash-bio (>=1.0.1,<2.0.0)",
37
+ ]
38
+
39
+ [project.scripts]
40
+ gwasstudio = "gwasstudio.main:main"
41
+
42
+ [build-system]
43
+ requires = [
44
+ "poetry-core>=2.0.0,<3.0.0",
45
+ ]
46
+ build-backend = "poetry.core.masonry.api"
47
+
48
+ [tool.poetry.group.dev.dependencies]
49
+ pre-commit = "^4.0.1"
50
+ mongomock = "^4.3.0"
51
+ setuptools = "^75.8.0"
52
+ pytest = "^8.3.4"
53
+ pytest-cov = "^6.0.0"
54
+ pytest-randomly = "^3.16.0"
55
+ pandas-stubs = "^2.3.0.250703"
56
+ git-cliff = "^2.10.1"
57
+ deptry = "^0.23.1"
58
+ ruff = "^0.14.0"
59
+
60
+ [tool.poetry.group.docs.dependencies]
61
+ mkdocs-material = "^9.6.20"
62
+ mkdocs-git-revision-date-plugin = "^0.3.2"
63
+ tomli = "^2.3.0"
64
+ tomli-w = "^1.2.0"
65
+
66
+ [tool.ruff]
67
+ line-length = 120
68
+
69
+ [tool.deptry]
70
+ extend_exclude = [
71
+ "scripts",
72
+ ]
73
+
74
+ [tool.deptry.per_rule_ignores]
75
+ DEP003 = [
76
+ "gwasstudio",
77
+ ]
78
+ DEP004 = [
79
+ "mongomock",
80
+ "tomli",
81
+ "tomli_w",
82
+ ]
83
+ DEP002 = [
84
+ "pyarrow",
85
+ "bokeh",
86
+ ]
87
+
88
+ [tool.git-cliff.changelog]
89
+ header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\n[Git history](https://github.com/ht-diva/gwasstudio/commits/main/)\n"
90
+ body = "{% if version %}## [{{ version | trim_start_matches(pat=\"v\") }}] - {{ timestamp | date(format=\"%Y-%m-%d\") }}\n{% else %}## [unreleased]\n{% endif %}{% for group, commits in commits | filter(attribute=\"merge_commit\", value=false) | unique(attribute=\"message\")| group_by(attribute=\"group\") %}\n ### {{ group | striptags | trim | upper_first }}\n {% for commit in commits %}\n - {% if commit.scope %}*({{ commit.scope }})* {% endif %}{% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}{% endfor %}\n{% endfor %}\n\n"
91
+ trim = true
92
+ render_always = true
93
+ postprocessors = [
94
+ { pattern = "\\((\\w+\\s)?#([0-9]+)\\)", replace = "([#${2}](<REPO>/issues/${2}))" },
95
+ { pattern = ".*", replace_command = "typos --write-changes -" },
96
+ ]
97
+
98
+ [tool.git-cliff.git]
99
+ conventional_commits = true
100
+ filter_unconventional = false
101
+ require_conventional = false
102
+ split_commits = false
103
+ commit_preprocessors = []
104
+ protect_breaking_commits = false
105
+ commit_parsers = [
106
+ { message = "^feat", group = "<!-- 0 -->๐Ÿš€ Features" },
107
+ { message = "^fix", group = "<!-- 1 -->๐Ÿ› Bug Fixes" },
108
+ { message = "^doc", group = "<!-- 3 -->๐Ÿ“š Documentation" },
109
+ { message = "^perf", group = "<!-- 4 -->โšก Performance" },
110
+ { message = "^refactor", group = "<!-- 2 -->๐Ÿšœ Refactor" },
111
+ { message = "^style", group = "<!-- 5 -->๐ŸŽจ Styling" },
112
+ { message = "^test", group = "<!-- 6 -->๐Ÿงช Testing" },
113
+ { message = "^chore\\(release\\): prepare for", skip = true },
114
+ { message = "^chore\\(deps.*\\)", skip = true },
115
+ { message = "^chore\\(pr\\)", skip = true },
116
+ { message = "^chore\\(pull\\)", skip = true },
117
+ { message = "^chore|^ci", group = "<!-- 7 -->โš™๏ธ Miscellaneous Tasks" },
118
+ { body = ".*security", group = "<!-- 8 -->๐Ÿ›ก๏ธ Security" },
119
+ { message = "^revert", group = "<!-- 9 -->โ—€๏ธ Revert" },
120
+ { message = ".*", group = "<!-- 10 -->๐Ÿ’ผ Other" },
121
+ ]
122
+ filter_commits = false
123
+ link_parsers = []
124
+ use_branch_tags = false
125
+ topo_order = false
126
+ topo_order_commits = true
127
+ sort_commits = "oldest"
128
+ recurse_submodules = false
@@ -0,0 +1,78 @@
1
+ import importlib.metadata
2
+ import tempfile
3
+ from pathlib import Path
4
+
5
+ import pandas as pd
6
+ from cloup import Context, HelpFormatter, HelpTheme, Style
7
+ from loguru import logger as a_logger
8
+ from platformdirs import user_config_dir, user_data_dir, user_log_dir
9
+
10
+ # https://pandas.pydata.org/pandas-docs/stable/user_guide/copy_on_write.html#
11
+ pd.options.mode.copy_on_write = True
12
+
13
+ __all__ = [
14
+ "__appname__",
15
+ "__version__",
16
+ "context_settings",
17
+ "config_dir",
18
+ "config_filename",
19
+ "data_dir",
20
+ "log_file",
21
+ "logger",
22
+ "mongo_db_path",
23
+ "mongo_db_logpath",
24
+ ]
25
+
26
+ __appname__ = __name__
27
+
28
+ try:
29
+ __version__ = importlib.metadata.version(__appname__)
30
+ except importlib.metadata.PackageNotFoundError:
31
+ __version__ = "unknown"
32
+
33
+ default_log_dir = Path(user_log_dir(__appname__))
34
+ try:
35
+ default_log_dir.mkdir(parents=True, exist_ok=True)
36
+ test_file = default_log_dir / ".write_test"
37
+ test_file.write_text("test")
38
+ test_file.unlink()
39
+ dir_writable = True
40
+ except Exception:
41
+ dir_writable = False
42
+
43
+ if dir_writable:
44
+ log_dir = Path(user_log_dir(__appname__))
45
+ config_dir = Path(user_config_dir(__appname__))
46
+ data_dir = Path(user_data_dir(__appname__)) / "data"
47
+ else:
48
+ tmp_root = Path(tempfile.gettempdir())
49
+ base_dir = tmp_root / f"{__appname__}_tmp"
50
+ log_dir = base_dir / "log"
51
+ config_dir = base_dir / "config"
52
+ data_dir = base_dir / "data"
53
+
54
+ log_dir.mkdir(parents=True, exist_ok=True)
55
+ config_dir.mkdir(parents=True, exist_ok=True)
56
+ data_dir.mkdir(parents=True, exist_ok=True)
57
+
58
+ log_file = log_dir / "gwasstudio.log"
59
+ config_filename = "config.yaml"
60
+ mongo_db_path = data_dir / "mongo_db"
61
+ mongo_db_logpath = log_dir / "mongod.log"
62
+
63
+ mongo_db_path.mkdir(parents=True, exist_ok=True)
64
+
65
+ # Check the docs for all available arguments of HelpFormatter and HelpTheme.
66
+ formatter_settings = HelpFormatter.settings(
67
+ theme=HelpTheme(
68
+ invoked_command=Style(fg="red"),
69
+ heading=Style(fg="bright_white", bold=True),
70
+ constraint=Style(fg="magenta"),
71
+ col1=Style(fg="yellow"),
72
+ )
73
+ )
74
+
75
+ context_settings = Context.settings(formatter_settings=formatter_settings)
76
+
77
+ logger = a_logger
78
+ logger.remove()
@@ -0,0 +1,7 @@
1
+ from .export import export
2
+ from .info import info
3
+ from .ingest import ingest
4
+ from .list import list_projects
5
+ from .metadata.query import query_metadata
6
+
7
+ __all__ = ["export", "info", "ingest", "list_projects", "query_metadata"]