genetrek 0.1.0__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.
@@ -0,0 +1,150 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+ */.ipynb_checkpoints/*
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ #Pipfile.lock
97
+
98
+ # poetry
99
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
103
+ #poetry.lock
104
+
105
+ # pdm
106
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
107
+ #pdm.lock
108
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
109
+ # in version control.
110
+ # https://pdm.fming.dev/#use-with-ide
111
+ .pdm.toml
112
+
113
+ # uwsgi
114
+ uwsgi.ini
115
+
116
+ # .env file
117
+ .env
118
+
119
+ # uv
120
+ .uv.toml
121
+
122
+ # GeneTrek database tooling: generated, not source
123
+ resources/processed_data/staging/
124
+ resources/processed_data/.backups/
125
+ resources/processed_data/history.jsonl
126
+
127
+ # Upstream source files: large, re-downloadable, and read only by `genetrek-db`.
128
+ # The webapp never touches them, so they are neither committed nor shipped in the
129
+ # container image (see .dockerignore).
130
+ resources/original_file/
131
+
132
+ # macOS
133
+ .DS_Store
134
+ .AppleDouble
135
+ .LSOverride
136
+ Icon?
137
+ ._*
138
+ .Spotlight-V100
139
+ .Trashes
140
+ AppleClang/
141
+
142
+ # Windows
143
+ Thumbs.db
144
+ ehthumbs.db
145
+ Desktop.ini
146
+ $RECYCLE.BIN/
147
+ Windows/
148
+ # Local tooling
149
+ .claude/
150
+ .vscode/
genetrek-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Institut Pasteur
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,116 @@
1
+ Metadata-Version: 2.5
2
+ Name: genetrek
3
+ Version: 0.1.0
4
+ Summary: Python client and command line for GeneTrek: gene lists and annotations for neurodevelopmental disorders.
5
+ Project-URL: Homepage, https://genetrek.pasteur.fr
6
+ Project-URL: Documentation, https://genetrek.pasteur.fr/api-reference
7
+ Project-URL: Repository, https://github.com/bourgeron-lab/genetrek
8
+ Author-email: "Human Genetics and Cognitive Functions, Institut Pasteur" <ghfcgenetics@pasteur.fr>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: api client,autism,gene lists,genomics,neurodevelopmental disorders
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
14
+ Requires-Python: >=3.10
15
+ Requires-Dist: httpx>=0.27
16
+ Requires-Dist: platformdirs>=3.0
17
+ Requires-Dist: polars>=0.20.0
18
+ Requires-Dist: tomli>=2.0; python_version < '3.11'
19
+ Requires-Dist: typer>=0.12.0
20
+ Provides-Extra: pandas
21
+ Requires-Dist: pandas>=2.0; extra == 'pandas'
22
+ Requires-Dist: pyarrow>=14; extra == 'pandas'
23
+ Description-Content-Type: text/markdown
24
+
25
+ # genetrek
26
+
27
+ Python client and command line for [GeneTrek](https://genetrek.pasteur.fr): curated gene lists
28
+ for neurodevelopmental disorders (NDD) and per-gene annotations (constraint, brain expression,
29
+ rare-variant results) in one versioned table.
30
+
31
+ ```bash
32
+ pip install genetrek # or: uv add genetrek
33
+ pip install "genetrek[pandas]" # to call .to_pandas() on the tables
34
+ ```
35
+
36
+ Python 3.10 or newer. GeneTrek is for research use only, not for diagnostic use.
37
+
38
+ ## From Python
39
+
40
+ ```python
41
+ from genetrek import GeneTrek, Set
42
+
43
+ gt = GeneTrek() # the public instance
44
+
45
+ hc = gt.gene_list("hc_ndd") # a gene list's members
46
+ table = gt.genes(["SHANK3", "KIAA1650", "85358"], # any identifiers, any mix
47
+ columns=["loeuf", "hc_ndd"]) # -> polars DataFrame
48
+ gt.convert(["SHANK3", "ENSG00000100888"], to=["hgnc", "ncbi"])
49
+ gt.search("chr22:50,674,408-50,733,212") # what the search box does
50
+
51
+ result = gt.compare([
52
+ Set.field("hc_ndd"),
53
+ Set.genes(["SHANK3", "CHD8", "SCN2A"], label="my genes"),
54
+ Set.file("candidates.txt"),
55
+ ])
56
+ result.pairs # overlap, odds ratio with exact 95% CI, Fisher p, FDR, adjusted
57
+ result.methods # the methods paragraph, with the database release
58
+ result.to_request_json("request.json") # gt.replay("request.json") later
59
+ ```
60
+
61
+ Tables are [polars](https://pola.rs) DataFrames; with the `pandas` extra, `table.to_pandas()`.
62
+ A null means "not measured" and is never turned into `False`.
63
+
64
+ Errors are exceptions you can catch: `UnknownGene`, `AmbiguousGene`, `UnknownField`,
65
+ `NotAGeneList`, and `ApiError` (with the server's `.code`) for the rest. Identifiers that
66
+ match no gene, or several, are reported in an `UnresolvedWarning` rather than dropped
67
+ silently.
68
+
69
+ ## From the shell
70
+
71
+ ```bash
72
+ genetrek list hc_ndd > hc_ndd.txt # one gene per line
73
+ genetrek genes my_genes.txt --columns loeuf,hc_ndd # TSV to stdout
74
+ genetrek convert - --to hgnc,ensg < ids.txt
75
+ genetrek search SHANK3 chr22:50674408-50733212
76
+ genetrek compare hc_ndd my_genes.txt:mine --out results/
77
+ genetrek replay results/request.json
78
+ genetrek download -o genetrek.parquet
79
+ genetrek --help
80
+ ```
81
+
82
+ Tables go to stdout as TSV (`NA` for null), messages to stderr; `--json` prints JSON.
83
+
84
+ ## Which server
85
+
86
+ The public instance, `https://genetrek.pasteur.fr`, is the default. To use another one,
87
+ name it once:
88
+
89
+ ```bash
90
+ genetrek config add local http://localhost:8000
91
+ genetrek config add dev https://genetrek.dev.example.org --default
92
+ genetrek info # says which server answered, and why it was chosen
93
+ ```
94
+
95
+ The names live in a small TOML file in your configuration directory (`genetrek config list`
96
+ prints where; `$GENETREK_CONFIG` moves it). The first of these that is set wins:
97
+ `GeneTrek(base_url=...)` or `--url`; `GeneTrek(server="dev")` or `--server dev`;
98
+ `$GENETREK_URL`; `$GENETREK_SERVER`; the file's default; the public instance.
99
+
100
+ ## Your genes
101
+
102
+ Your identifiers travel in request bodies only, never in a URL, so they are not written to
103
+ any server's access log, and nothing you send is cached to disk. A My lists share link is
104
+ read locally: only its token is sent.
105
+
106
+ ## Versions
107
+
108
+ Every result carries the database release it was computed on (`result.release`,
109
+ `gt.release()`). The client checks the server's API version: `genes()`, `search()` and the
110
+ error codes need API 1.1, which genetrek.pasteur.fr serves from GeneTrek v8; against an
111
+ older server those methods raise `ServerTooOld`, and everything else works.
112
+
113
+ ## Citing and licences
114
+
115
+ How to cite GeneTrek: <https://genetrek.pasteur.fr/cite>. The code is MIT-licensed; the
116
+ data keep each source's terms, listed per column on <https://genetrek.pasteur.fr/columns>.
@@ -0,0 +1,92 @@
1
+ # genetrek
2
+
3
+ Python client and command line for [GeneTrek](https://genetrek.pasteur.fr): curated gene lists
4
+ for neurodevelopmental disorders (NDD) and per-gene annotations (constraint, brain expression,
5
+ rare-variant results) in one versioned table.
6
+
7
+ ```bash
8
+ pip install genetrek # or: uv add genetrek
9
+ pip install "genetrek[pandas]" # to call .to_pandas() on the tables
10
+ ```
11
+
12
+ Python 3.10 or newer. GeneTrek is for research use only, not for diagnostic use.
13
+
14
+ ## From Python
15
+
16
+ ```python
17
+ from genetrek import GeneTrek, Set
18
+
19
+ gt = GeneTrek() # the public instance
20
+
21
+ hc = gt.gene_list("hc_ndd") # a gene list's members
22
+ table = gt.genes(["SHANK3", "KIAA1650", "85358"], # any identifiers, any mix
23
+ columns=["loeuf", "hc_ndd"]) # -> polars DataFrame
24
+ gt.convert(["SHANK3", "ENSG00000100888"], to=["hgnc", "ncbi"])
25
+ gt.search("chr22:50,674,408-50,733,212") # what the search box does
26
+
27
+ result = gt.compare([
28
+ Set.field("hc_ndd"),
29
+ Set.genes(["SHANK3", "CHD8", "SCN2A"], label="my genes"),
30
+ Set.file("candidates.txt"),
31
+ ])
32
+ result.pairs # overlap, odds ratio with exact 95% CI, Fisher p, FDR, adjusted
33
+ result.methods # the methods paragraph, with the database release
34
+ result.to_request_json("request.json") # gt.replay("request.json") later
35
+ ```
36
+
37
+ Tables are [polars](https://pola.rs) DataFrames; with the `pandas` extra, `table.to_pandas()`.
38
+ A null means "not measured" and is never turned into `False`.
39
+
40
+ Errors are exceptions you can catch: `UnknownGene`, `AmbiguousGene`, `UnknownField`,
41
+ `NotAGeneList`, and `ApiError` (with the server's `.code`) for the rest. Identifiers that
42
+ match no gene, or several, are reported in an `UnresolvedWarning` rather than dropped
43
+ silently.
44
+
45
+ ## From the shell
46
+
47
+ ```bash
48
+ genetrek list hc_ndd > hc_ndd.txt # one gene per line
49
+ genetrek genes my_genes.txt --columns loeuf,hc_ndd # TSV to stdout
50
+ genetrek convert - --to hgnc,ensg < ids.txt
51
+ genetrek search SHANK3 chr22:50674408-50733212
52
+ genetrek compare hc_ndd my_genes.txt:mine --out results/
53
+ genetrek replay results/request.json
54
+ genetrek download -o genetrek.parquet
55
+ genetrek --help
56
+ ```
57
+
58
+ Tables go to stdout as TSV (`NA` for null), messages to stderr; `--json` prints JSON.
59
+
60
+ ## Which server
61
+
62
+ The public instance, `https://genetrek.pasteur.fr`, is the default. To use another one,
63
+ name it once:
64
+
65
+ ```bash
66
+ genetrek config add local http://localhost:8000
67
+ genetrek config add dev https://genetrek.dev.example.org --default
68
+ genetrek info # says which server answered, and why it was chosen
69
+ ```
70
+
71
+ The names live in a small TOML file in your configuration directory (`genetrek config list`
72
+ prints where; `$GENETREK_CONFIG` moves it). The first of these that is set wins:
73
+ `GeneTrek(base_url=...)` or `--url`; `GeneTrek(server="dev")` or `--server dev`;
74
+ `$GENETREK_URL`; `$GENETREK_SERVER`; the file's default; the public instance.
75
+
76
+ ## Your genes
77
+
78
+ Your identifiers travel in request bodies only, never in a URL, so they are not written to
79
+ any server's access log, and nothing you send is cached to disk. A My lists share link is
80
+ read locally: only its token is sent.
81
+
82
+ ## Versions
83
+
84
+ Every result carries the database release it was computed on (`result.release`,
85
+ `gt.release()`). The client checks the server's API version: `genes()`, `search()` and the
86
+ error codes need API 1.1, which genetrek.pasteur.fr serves from GeneTrek v8; against an
87
+ older server those methods raise `ServerTooOld`, and everything else works.
88
+
89
+ ## Citing and licences
90
+
91
+ How to cite GeneTrek: <https://genetrek.pasteur.fr/cite>. The code is MIT-licensed; the
92
+ data keep each source's terms, listed per column on <https://genetrek.pasteur.fr/columns>.
@@ -0,0 +1,55 @@
1
+ [project]
2
+ name = "genetrek"
3
+ version = "0.1.0"
4
+ description = "Python client and command line for GeneTrek: gene lists and annotations for neurodevelopmental disorders."
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = "MIT"
8
+ license-files = ["LICENSE"]
9
+ authors = [
10
+ { name = "Human Genetics and Cognitive Functions, Institut Pasteur", email = "ghfcgenetics@pasteur.fr" },
11
+ ]
12
+ keywords = ["genomics", "neurodevelopmental disorders", "autism", "gene lists", "api client"]
13
+ classifiers = [
14
+ "Programming Language :: Python :: 3",
15
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
16
+ ]
17
+ dependencies = [
18
+ "httpx>=0.27",
19
+ "polars>=0.20.0",
20
+ "typer>=0.12.0",
21
+ "platformdirs>=3.0",
22
+ "tomli>=2.0; python_version < '3.11'",
23
+ ]
24
+
25
+ [project.optional-dependencies]
26
+ pandas = ["pandas>=2.0", "pyarrow>=14"]
27
+
28
+ [project.scripts]
29
+ genetrek = "genetrek.cli:main"
30
+
31
+ [project.urls]
32
+ Homepage = "https://genetrek.pasteur.fr"
33
+ Documentation = "https://genetrek.pasteur.fr/api-reference"
34
+ Repository = "https://github.com/bourgeron-lab/genetrek"
35
+
36
+ [build-system]
37
+ requires = ["hatchling"]
38
+ build-backend = "hatchling.build"
39
+
40
+ [tool.hatch.build.targets.wheel]
41
+ packages = ["src/genetrek"]
42
+
43
+ [tool.ruff]
44
+ extend = "../pyproject.toml"
45
+ target-version = "py310"
46
+
47
+ [tool.ruff.lint]
48
+ # Raised only for a py310 target: exceptions are zero-cost from 3.11, and the
49
+ # loop that skips a damaged stored list is clearer as written.
50
+ extend-ignore = ["PERF203"]
51
+
52
+ [tool.ruff.lint.per-file-ignores]
53
+ # Typer reads each option from a boolean parameter's default.
54
+ "src/genetrek/cli.py" = ["FBT001", "FBT002"]
55
+ "tests/*.py" = ["S101", "ANN001", "ANN201", "ANN202", "PLR2004", "INP001"]
@@ -0,0 +1,49 @@
1
+ """GeneTrek from Python: the client for GeneTrek's API, and the ``genetrek`` command.
2
+
3
+ >>> from genetrek import GeneTrek, Set
4
+ >>> gt = GeneTrek()
5
+ >>> gt.gene_list("hc_ndd")[:3]
6
+ >>> gt.compare([Set.field("hc_ndd"), Set.genes(["SHANK3", "CHD8"], label="mine")])
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from importlib.metadata import PackageNotFoundError, version
12
+
13
+ try:
14
+ __version__ = version("genetrek")
15
+ except PackageNotFoundError: # pragma: no cover - running from a source tree
16
+ __version__ = "0+unknown"
17
+
18
+ # After __version__: the client reads it.
19
+ from genetrek.client import GeneTrek, UnresolvedWarning
20
+ from genetrek.errors import (
21
+ AmbiguousGene,
22
+ ApiError,
23
+ ConfigError,
24
+ ConnectionFailed,
25
+ GeneTrekError,
26
+ NotAGeneList,
27
+ ServerTooOld,
28
+ UnknownField,
29
+ UnknownGene,
30
+ )
31
+ from genetrek.models import Comparison
32
+ from genetrek.sets import Set
33
+
34
+ __all__ = [
35
+ "AmbiguousGene",
36
+ "ApiError",
37
+ "Comparison",
38
+ "ConfigError",
39
+ "ConnectionFailed",
40
+ "GeneTrek",
41
+ "GeneTrekError",
42
+ "NotAGeneList",
43
+ "ServerTooOld",
44
+ "Set",
45
+ "UnknownField",
46
+ "UnknownGene",
47
+ "UnresolvedWarning",
48
+ "__version__",
49
+ ]