cool-seq-tool 0.6.0__tar.gz → 0.7.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.
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/PKG-INFO +8 -8
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/README.md +6 -6
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/docs/source/conf.py +4 -4
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/docs/source/usage.rst +3 -8
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/pyproject.toml +1 -1
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/__init__.py +6 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/app.py +1 -2
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/handlers/seqrepo_access.py +5 -5
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/mappers/alignment.py +16 -16
- cool_seq_tool-0.7.0/src/cool_seq_tool/mappers/exon_genomic_coords.py +1203 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/mappers/mane_transcript.py +109 -104
- cool_seq_tool-0.7.0/src/cool_seq_tool/schemas.py +161 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/sources/uta_database.py +149 -229
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/utils.py +9 -9
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool.egg-info/PKG-INFO +8 -8
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool.egg-info/requires.txt +1 -1
- cool_seq_tool-0.7.0/tests/conftest.py +334 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/tests/handlers/test_seqrepo_access.py +2 -2
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/tests/mappers/test_alignment.py +85 -61
- cool_seq_tool-0.7.0/tests/mappers/test_exon_genomic_coords.py +1462 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/tests/mappers/test_mane_transcript.py +24 -23
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/tests/sources/test_uta_database.py +55 -79
- cool_seq_tool-0.7.0/tests/test_utils.py +21 -0
- cool_seq_tool-0.6.0/src/cool_seq_tool/mappers/exon_genomic_coords.py +0 -986
- cool_seq_tool-0.6.0/src/cool_seq_tool/schemas.py +0 -296
- cool_seq_tool-0.6.0/tests/conftest.py +0 -135
- cool_seq_tool-0.6.0/tests/mappers/test_exon_genomic_coords.py +0 -1161
- cool_seq_tool-0.6.0/tests/test_utils.py +0 -27
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/.coveragerc +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/.github/ISSUE_TEMPLATE/bug-report.yaml +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/.github/ISSUE_TEMPLATE/feature-request.yaml +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/.github/workflows/checks.yaml +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/.github/workflows/close_issue.yml +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/.github/workflows/pr-priority-label.yaml +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/.github/workflows/release.yml +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/.github/workflows/stale.yaml +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/.gitignore +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/.pre-commit-config.yaml +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/.readthedocs.yaml +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/CITATION.cff +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/LICENSE +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/docs/Makefile +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/docs/make.bat +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/docs/source/_static/img/biomart.png +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/docs/source/_templates/module_summary.rst +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/docs/source/changelog.rst +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/docs/source/contributing.rst +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/docs/source/index.rst +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/docs/source/install.rst +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/docs/source/license.rst +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/docs/source/reference/index.rst +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/docs/source/transcript_selection.rst +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/setup.cfg +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/handlers/__init__.py +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/mappers/__init__.py +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/mappers/liftover.py +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/resources/__init__.py +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/resources/data_files.py +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/resources/status.py +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/resources/transcript_mapping.tsv +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/sources/__init__.py +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/sources/mane_transcript_mappings.py +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool/sources/transcript_mappings.py +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool.egg-info/SOURCES.txt +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool.egg-info/dependency_links.txt +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/src/cool_seq_tool.egg-info/top_level.txt +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/tests/mappers/test_liftover.py +0 -0
- {cool_seq_tool-0.6.0 → cool_seq_tool-0.7.0}/tests/sources/test_mane_transcript_mappings.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: cool_seq_tool
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.7.0
|
4
4
|
Summary: Common Operation on Lots of Sequences Tool
|
5
5
|
Author: Kori Kuzma, James Stevenson, Katie Stahl, Alex Wagner
|
6
6
|
License: MIT License
|
@@ -52,7 +52,7 @@ Requires-Dist: polars~=1.0
|
|
52
52
|
Requires-Dist: hgvs
|
53
53
|
Requires-Dist: biocommons.seqrepo
|
54
54
|
Requires-Dist: pydantic==2.*
|
55
|
-
Requires-Dist: ga4gh.vrs
|
55
|
+
Requires-Dist: ga4gh.vrs~=2.0.0a10
|
56
56
|
Requires-Dist: wags-tails~=0.1.3
|
57
57
|
Requires-Dist: bioutils
|
58
58
|
Provides-Extra: dev
|
@@ -83,7 +83,7 @@ CoolSeqTool
|
|
83
83
|
|
84
84
|
---
|
85
85
|
|
86
|
-
**[Documentation](https://coolseqtool.readthedocs.io/
|
86
|
+
**[Documentation](https://coolseqtool.readthedocs.io/stable/)** · [Installation](https://coolseqtool.readthedocs.io/stable/install.html) · [Usage](https://coolseqtool.readthedocs.io/stable/usage.html) · [API reference](https://coolseqtool.readthedocs.io/stable/reference/index.html)
|
87
87
|
|
88
88
|
---
|
89
89
|
|
@@ -107,7 +107,7 @@ CoolSeqTool is available on [PyPI](https://pypi.org/project/cool-seq-tool)
|
|
107
107
|
python3 -m pip install cool-seq-tool
|
108
108
|
```
|
109
109
|
|
110
|
-
See the [installation instructions](https://coolseqtool.readthedocs.io/
|
110
|
+
See the [installation instructions](https://coolseqtool.readthedocs.io/stable/install.html) in the documentation for a description of dependency setup requirements.
|
111
111
|
|
112
112
|
---
|
113
113
|
|
@@ -116,14 +116,14 @@ See the [installation instructions](https://coolseqtool.readthedocs.io/latest/in
|
|
116
116
|
All CoolSeqTool resources can be initialized by way of a top-level class instance:
|
117
117
|
|
118
118
|
```pycon
|
119
|
-
>>> from cool_seq_tool
|
120
|
-
>>> from cool_seq_tool.schemas import AnnotationLayer,
|
119
|
+
>>> from cool_seq_tool import CoolSeqTool
|
120
|
+
>>> from cool_seq_tool.schemas import AnnotationLayer, CoordinateType
|
121
121
|
>>> cst = CoolSeqTool()
|
122
122
|
>>> result = await cst.mane_transcript.get_mane_transcript(
|
123
123
|
... "NP_004324.2",
|
124
124
|
... 599,
|
125
125
|
... AnnotationLayer.PROTEIN,
|
126
|
-
...
|
126
|
+
... coordinate_type=CoordinateType.INTER_RESIDUE,
|
127
127
|
... )
|
128
128
|
>>> result.gene, result.refseq, result.status
|
129
129
|
('EGFR', 'NM_005228.5', <TranscriptPriority.MANE_SELECT: 'mane_select'>)
|
@@ -133,4 +133,4 @@ All CoolSeqTool resources can be initialized by way of a top-level class instanc
|
|
133
133
|
|
134
134
|
## Feedback and contributing
|
135
135
|
|
136
|
-
We welcome bug reports, feature requests, and code contributions from users and interested collaborators. The [documentation](https://coolseqtool.readthedocs.io/
|
136
|
+
We welcome bug reports, feature requests, and code contributions from users and interested collaborators. The [documentation](https://coolseqtool.readthedocs.io/stable/contributing.html) contains guidance for submitting feedback and contributing new code.
|
@@ -6,7 +6,7 @@ CoolSeqTool
|
|
6
6
|
|
7
7
|
---
|
8
8
|
|
9
|
-
**[Documentation](https://coolseqtool.readthedocs.io/
|
9
|
+
**[Documentation](https://coolseqtool.readthedocs.io/stable/)** · [Installation](https://coolseqtool.readthedocs.io/stable/install.html) · [Usage](https://coolseqtool.readthedocs.io/stable/usage.html) · [API reference](https://coolseqtool.readthedocs.io/stable/reference/index.html)
|
10
10
|
|
11
11
|
---
|
12
12
|
|
@@ -30,7 +30,7 @@ CoolSeqTool is available on [PyPI](https://pypi.org/project/cool-seq-tool)
|
|
30
30
|
python3 -m pip install cool-seq-tool
|
31
31
|
```
|
32
32
|
|
33
|
-
See the [installation instructions](https://coolseqtool.readthedocs.io/
|
33
|
+
See the [installation instructions](https://coolseqtool.readthedocs.io/stable/install.html) in the documentation for a description of dependency setup requirements.
|
34
34
|
|
35
35
|
---
|
36
36
|
|
@@ -39,14 +39,14 @@ See the [installation instructions](https://coolseqtool.readthedocs.io/latest/in
|
|
39
39
|
All CoolSeqTool resources can be initialized by way of a top-level class instance:
|
40
40
|
|
41
41
|
```pycon
|
42
|
-
>>> from cool_seq_tool
|
43
|
-
>>> from cool_seq_tool.schemas import AnnotationLayer,
|
42
|
+
>>> from cool_seq_tool import CoolSeqTool
|
43
|
+
>>> from cool_seq_tool.schemas import AnnotationLayer, CoordinateType
|
44
44
|
>>> cst = CoolSeqTool()
|
45
45
|
>>> result = await cst.mane_transcript.get_mane_transcript(
|
46
46
|
... "NP_004324.2",
|
47
47
|
... 599,
|
48
48
|
... AnnotationLayer.PROTEIN,
|
49
|
-
...
|
49
|
+
... coordinate_type=CoordinateType.INTER_RESIDUE,
|
50
50
|
... )
|
51
51
|
>>> result.gene, result.refseq, result.status
|
52
52
|
('EGFR', 'NM_005228.5', <TranscriptPriority.MANE_SELECT: 'mane_select'>)
|
@@ -56,4 +56,4 @@ All CoolSeqTool resources can be initialized by way of a top-level class instanc
|
|
56
56
|
|
57
57
|
## Feedback and contributing
|
58
58
|
|
59
|
-
We welcome bug reports, feature requests, and code contributions from users and interested collaborators. The [documentation](https://coolseqtool.readthedocs.io/
|
59
|
+
We welcome bug reports, feature requests, and code contributions from users and interested collaborators. The [documentation](https://coolseqtool.readthedocs.io/stable/contributing.html) contains guidance for submitting feedback and contributing new code.
|
@@ -72,7 +72,7 @@ def linkcode_resolve(domain, info):
|
|
72
72
|
if not info["module"]:
|
73
73
|
return None
|
74
74
|
filename = info["module"].replace(".", "/")
|
75
|
-
return f"https://github.com/genomicmedlab/cool-seq-tool/blob/main/{filename}.py"
|
75
|
+
return f"https://github.com/genomicmedlab/cool-seq-tool/blob/main/src/{filename}.py"
|
76
76
|
|
77
77
|
|
78
78
|
# -- code block style --------------------------------------------------------
|
@@ -87,16 +87,16 @@ from sphinx.ext.autodoc import Options
|
|
87
87
|
|
88
88
|
|
89
89
|
def _clip_rst_tables(app: Sphinx, what: str, name: str, obj: ModuleType, options: Options, lines: List[str]):
|
90
|
-
"""The
|
90
|
+
"""The CoordinateType docstring contains an RST table and an ASCII table because
|
91
91
|
the former gets omitted in IDEs like VSCode and the latter won't render properly in
|
92
92
|
Sphinx docs. This chops out the ASCII table when rendering autodocs.
|
93
93
|
"""
|
94
|
-
if what == "class" and name == "cool_seq_tool.schemas.
|
94
|
+
if what == "class" and name == "cool_seq_tool.schemas.CoordinateType":
|
95
95
|
for i in range(len(lines) -1, -1, -1):
|
96
96
|
line = lines[i]
|
97
97
|
if line.count("|") >= 8:
|
98
98
|
del lines[i]
|
99
|
-
print("Running preprocessing on
|
99
|
+
print("Running preprocessing on CoordinateType docstring...")
|
100
100
|
|
101
101
|
def setup(app: Sphinx):
|
102
102
|
app.connect("autodoc-process-docstring", _clip_rst_tables)
|
@@ -15,7 +15,7 @@ The core :py:class:`CoolSeqTool <cool_seq_tool.app.CoolSeqTool>` class encapsula
|
|
15
15
|
|
16
16
|
.. code-block:: pycon
|
17
17
|
|
18
|
-
>>> from cool_seq_tool
|
18
|
+
>>> from cool_seq_tool import CoolSeqTool
|
19
19
|
>>> cst = CoolSeqTool()
|
20
20
|
>>> cst.seqrepo_access.translate_alias("NM_002529.3")[0][-1]
|
21
21
|
'ga4gh:SQ.RSkww1aYmsMiWbNdNnOTnVDAM3ZWp1uA'
|
@@ -34,7 +34,7 @@ Descriptions and examples of functions can be found in the :ref:`API Reference <
|
|
34
34
|
|
35
35
|
.. code-block:: python
|
36
36
|
|
37
|
-
from cool_seq_tool
|
37
|
+
from cool_seq_tool import CoolSeqTool
|
38
38
|
|
39
39
|
async def do_thing():
|
40
40
|
mane_mapper = CoolSeqTool().mane_transcript
|
@@ -50,7 +50,7 @@ Descriptions and examples of functions can be found in the :ref:`API Reference <
|
|
50
50
|
.. code-block:: pycon
|
51
51
|
|
52
52
|
>>> import asyncio
|
53
|
-
>>> from cool_seq_tool
|
53
|
+
>>> from cool_seq_tool import cool_seq_tool
|
54
54
|
>>> mane_mapper = CoolSeqTool().mane_transcript
|
55
55
|
>>> result = asyncio.run(mane_mapper.g_to_grch38("NC_000001.11", 100, 200))
|
56
56
|
>>> print(result)
|
@@ -85,8 +85,3 @@ Individual classes will accept arguments upon initialization to set parameters r
|
|
85
85
|
- A path to a `chainfile <https://genome.ucsc.edu/goldenPath/help/chain.html>`_ for lifting from GRCh37 to GRCh38. Used by the :py:class:`LiftOver <cool_seq_tool.mappers.liftover.LiftOver>` class as input to `agct <https://pypi.org/project/agct/>`_. If not provided, agct will fetch it automatically from UCSC.
|
86
86
|
* - ``LIFTOVER_CHAIN_38_TO_37``
|
87
87
|
- A path to a `chainfile <https://genome.ucsc.edu/goldenPath/help/chain.html>`_ for lifting from GRCh38 to GRCh37. Used by the :py:class:`LiftOver <cool_seq_tool.mappers.liftover.LiftOver>` class as input to `agct <https://pypi.org/project/agct/>`_. If not provided, agct will fetch it automatically from UCSC.
|
88
|
-
|
89
|
-
Schema support
|
90
|
-
--------------
|
91
|
-
|
92
|
-
Many genomic data objects produced by Cool-Seq-Tool are structured in conformance with the `Variation Representation Specification <https://vrs.ga4gh.org/en/stable/>`_, courtesy of the `VRS-Python <https://github.com/ga4gh/vrs-python>`_ library.
|
@@ -8,3 +8,9 @@ except PackageNotFoundError:
|
|
8
8
|
__version__ = "unknown"
|
9
9
|
finally:
|
10
10
|
del version, PackageNotFoundError
|
11
|
+
|
12
|
+
|
13
|
+
# must import after __version__ declaration to prevent ImportError
|
14
|
+
from cool_seq_tool.app import CoolSeqTool
|
15
|
+
|
16
|
+
__all__ = ["CoolSeqTool", "__version__"]
|
@@ -48,7 +48,7 @@ class CoolSeqTool:
|
|
48
48
|
|
49
49
|
Initialization with default resource locations is straightforward:
|
50
50
|
|
51
|
-
>>> from cool_seq_tool
|
51
|
+
>>> from cool_seq_tool import CoolSeqTool
|
52
52
|
>>> cst = CoolSeqTool()
|
53
53
|
|
54
54
|
By default, this will attempt to fetch the latest versions of static resources,
|
@@ -107,7 +107,6 @@ class CoolSeqTool:
|
|
107
107
|
self.ex_g_coords_mapper = ExonGenomicCoordsMapper(
|
108
108
|
self.seqrepo_access,
|
109
109
|
self.uta_db,
|
110
|
-
self.mane_transcript,
|
111
110
|
self.mane_transcript_mappings,
|
112
111
|
self.liftover,
|
113
112
|
)
|
@@ -8,7 +8,7 @@ from pathlib import Path
|
|
8
8
|
|
9
9
|
from ga4gh.vrs.dataproxy import SeqRepoDataProxy
|
10
10
|
|
11
|
-
from cool_seq_tool.schemas import Assembly,
|
11
|
+
from cool_seq_tool.schemas import Assembly, CoordinateType
|
12
12
|
from cool_seq_tool.utils import get_inter_residue_pos, process_chromosome_input
|
13
13
|
|
14
14
|
_logger = logging.getLogger(__name__)
|
@@ -29,7 +29,7 @@ class SeqRepoAccess(SeqRepoDataProxy):
|
|
29
29
|
ac: str,
|
30
30
|
start: int | None = None,
|
31
31
|
end: int | None = None,
|
32
|
-
|
32
|
+
coordinate_type: CoordinateType = CoordinateType.RESIDUE,
|
33
33
|
) -> tuple[str, str | None]:
|
34
34
|
"""Get reference sequence for an accession given a start and end position. If
|
35
35
|
``start`` and ``end`` are not given, returns the entire reference sequence.
|
@@ -46,7 +46,7 @@ class SeqRepoAccess(SeqRepoDataProxy):
|
|
46
46
|
:param start: Start pos change
|
47
47
|
:param end: End pos change. If ``None`` assumes both ``start`` and ``end`` have
|
48
48
|
same values, if ``start`` exists.
|
49
|
-
:param
|
49
|
+
:param coordinate_type: Coordinate type for ``start`` and ``end``
|
50
50
|
:return: Sequence at position (if accession and positions actually
|
51
51
|
exist, else return empty string), warning if any
|
52
52
|
"""
|
@@ -55,11 +55,11 @@ class SeqRepoAccess(SeqRepoDataProxy):
|
|
55
55
|
msg = f"start ({start}) cannot be greater than end ({end})"
|
56
56
|
return "", msg
|
57
57
|
|
58
|
-
start, end = get_inter_residue_pos(start, end,
|
58
|
+
start, end = get_inter_residue_pos(start, end, coordinate_type)
|
59
59
|
if start == end:
|
60
60
|
end += 1
|
61
61
|
else:
|
62
|
-
if start is not None and
|
62
|
+
if start is not None and coordinate_type == CoordinateType.RESIDUE:
|
63
63
|
start -= 1
|
64
64
|
|
65
65
|
try:
|
@@ -3,7 +3,7 @@ reference sequences.
|
|
3
3
|
"""
|
4
4
|
|
5
5
|
from cool_seq_tool.handlers.seqrepo_access import SeqRepoAccess
|
6
|
-
from cool_seq_tool.schemas import AnnotationLayer, Assembly,
|
6
|
+
from cool_seq_tool.schemas import AnnotationLayer, Assembly, CoordinateType
|
7
7
|
from cool_seq_tool.sources import TranscriptMappings, UtaDatabase
|
8
8
|
|
9
9
|
|
@@ -32,14 +32,14 @@ class AlignmentMapper:
|
|
32
32
|
p_ac: str,
|
33
33
|
p_start_pos: int,
|
34
34
|
p_end_pos: int,
|
35
|
-
|
35
|
+
coordinate_type: CoordinateType = CoordinateType.RESIDUE,
|
36
36
|
) -> tuple[dict | None, str | None]:
|
37
37
|
"""Translate protein representation to cDNA representation.
|
38
38
|
|
39
39
|
:param p_ac: Protein RefSeq accession
|
40
40
|
:param p_start_pos: Protein start position
|
41
41
|
:param p_end_pos: Protein end position
|
42
|
-
:param
|
42
|
+
:param coordinate_type: Coordinate type for ``p_start_pos`` and ``p_end_pos``
|
43
43
|
:return: Tuple containing:
|
44
44
|
|
45
45
|
* cDNA representation (accession, codon range positions for corresponding
|
@@ -66,7 +66,7 @@ class AlignmentMapper:
|
|
66
66
|
# 1 amino acid maps to 3 nucleotides in the codon
|
67
67
|
# Since we have the end of the codon, we will subtract 2 to get the start of the
|
68
68
|
# codon. We want to return inter-residue (0-based), so we subtract 1 from this.
|
69
|
-
if
|
69
|
+
if coordinate_type == CoordinateType.RESIDUE:
|
70
70
|
c_pos = (p_start_pos * 3) - 3, p_end_pos * 3
|
71
71
|
else:
|
72
72
|
if p_start_pos == p_end_pos:
|
@@ -79,7 +79,7 @@ class AlignmentMapper:
|
|
79
79
|
"c_start_pos": c_pos[0],
|
80
80
|
"c_end_pos": c_pos[1],
|
81
81
|
"cds_start": cds_start,
|
82
|
-
"
|
82
|
+
"coordinate_type": CoordinateType.INTER_RESIDUE.value,
|
83
83
|
}, None
|
84
84
|
|
85
85
|
async def _get_cds_start(self, c_ac: str) -> tuple[int | None, str | None]:
|
@@ -105,7 +105,7 @@ class AlignmentMapper:
|
|
105
105
|
c_start_pos: int,
|
106
106
|
c_end_pos: int,
|
107
107
|
cds_start: int | None = None,
|
108
|
-
|
108
|
+
coordinate_type: CoordinateType = CoordinateType.RESIDUE,
|
109
109
|
target_genome_assembly: bool = Assembly.GRCH38,
|
110
110
|
) -> tuple[dict | None, str | None]:
|
111
111
|
"""Translate cDNA representation to genomic representation
|
@@ -125,9 +125,9 @@ class AlignmentMapper:
|
|
125
125
|
if any(
|
126
126
|
(
|
127
127
|
c_start_pos == c_end_pos,
|
128
|
-
(
|
128
|
+
(coordinate_type == CoordinateType.INTER_RESIDUE)
|
129
129
|
and ((c_end_pos - c_start_pos) % 3 != 0),
|
130
|
-
(
|
130
|
+
(coordinate_type == CoordinateType.RESIDUE)
|
131
131
|
and ((c_end_pos - (c_start_pos - 1)) % 3 != 0),
|
132
132
|
)
|
133
133
|
):
|
@@ -146,7 +146,7 @@ class AlignmentMapper:
|
|
146
146
|
return None, warning
|
147
147
|
|
148
148
|
# Change to inter-residue
|
149
|
-
if
|
149
|
+
if coordinate_type == CoordinateType.RESIDUE:
|
150
150
|
c_start_pos -= 1
|
151
151
|
|
152
152
|
# Get aligned genomic and transcript data
|
@@ -163,7 +163,7 @@ class AlignmentMapper:
|
|
163
163
|
f"position ({c_start_pos}, {c_end_pos})"
|
164
164
|
)
|
165
165
|
else:
|
166
|
-
alt_ac = genomic_tx_data
|
166
|
+
alt_ac = genomic_tx_data.alt_ac
|
167
167
|
|
168
168
|
# Validate that genomic accession assembly == target_genome_assembly
|
169
169
|
aliases, _ = self.seqrepo_access.translate_identifier(alt_ac)
|
@@ -180,7 +180,7 @@ class AlignmentMapper:
|
|
180
180
|
f"{target_genome_assembly}"
|
181
181
|
)
|
182
182
|
else:
|
183
|
-
g_pos = genomic_tx_data
|
183
|
+
g_pos = genomic_tx_data.alt_pos_change_range
|
184
184
|
|
185
185
|
# start pos should be less than end pos in response
|
186
186
|
if g_pos[0] > g_pos[1]:
|
@@ -194,7 +194,7 @@ class AlignmentMapper:
|
|
194
194
|
"g_ac": alt_ac,
|
195
195
|
"g_start_pos": g_start_pos,
|
196
196
|
"g_end_pos": g_end_pos,
|
197
|
-
"
|
197
|
+
"coordinate_type": CoordinateType.INTER_RESIDUE.value,
|
198
198
|
}
|
199
199
|
else:
|
200
200
|
warning = (
|
@@ -209,7 +209,7 @@ class AlignmentMapper:
|
|
209
209
|
p_ac: str,
|
210
210
|
p_start_pos: int,
|
211
211
|
p_end_pos: int,
|
212
|
-
|
212
|
+
coordinate_type: CoordinateType = CoordinateType.INTER_RESIDUE,
|
213
213
|
target_genome_assembly: Assembly = Assembly.GRCH38,
|
214
214
|
) -> tuple[dict | None, str | None]:
|
215
215
|
"""Translate protein representation to genomic representation, by way of
|
@@ -218,7 +218,7 @@ class AlignmentMapper:
|
|
218
218
|
:param p_ac: Protein RefSeq accession
|
219
219
|
:param p_start_pos: Protein start position
|
220
220
|
:param p_end_pos: Protein end position
|
221
|
-
:param
|
221
|
+
:param coordinate_type: Coordinate type for ``p_start_pos`` and ``p_end_pos``.
|
222
222
|
:param target_genome_assembly: Genome assembly to get genomic data for
|
223
223
|
:return: Tuple containing:
|
224
224
|
|
@@ -227,7 +227,7 @@ class AlignmentMapper:
|
|
227
227
|
* Warnings, if conversion to cDNA or genomic coordinates fails.
|
228
228
|
"""
|
229
229
|
c_data, warning = await self.p_to_c(
|
230
|
-
p_ac, p_start_pos, p_end_pos,
|
230
|
+
p_ac, p_start_pos, p_end_pos, coordinate_type=coordinate_type
|
231
231
|
)
|
232
232
|
if not c_data:
|
233
233
|
return None, warning
|
@@ -238,7 +238,7 @@ class AlignmentMapper:
|
|
238
238
|
c_data["c_start_pos"],
|
239
239
|
c_data["c_end_pos"],
|
240
240
|
c_data["cds_start"],
|
241
|
-
|
241
|
+
coordinate_type=CoordinateType.INTER_RESIDUE,
|
242
242
|
target_genome_assembly=target_genome_assembly,
|
243
243
|
)
|
244
244
|
return g_data, warning
|