Add a function to recursively add IDs to a VRS object and every contained identifiable object
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- bioinformatics
Hướng nghiên cứu
Bắt đầu bằng cách đọc các entry point ga4gh_identify(), vrs_enref() và vrs_deref() rồi so sánh hành vi của chúng với các ví dụ trong issue. Xác định cách recursive_identify hiện đang bù đắp cho chúng, sau đó định nghĩa việc hoàn tất là đệ quy thêm các ID còn thiếu vào đối tượng VRS và các đối tượng có thể định danh được chứa bên trong, mà không thay đổi các ID đúng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
In AnyVar, we want to receive VRS objects, but they need IDs to be stored. We'd like some kind of function that will ensure IDs get added to received objects if they aren't there already. This needs to recurse down through any contained objects.
I had assumed this existed somewhere in VRS-Python, but I haven't found a working solution yet. Granted, this is a very simple problem, and I could just write something that manually checks if an object is an allele or a different type of object and handles each case, but I felt like there should be a better option, especially since we already have some functions that get close:
ga4gh_identify() returns the correct ID, but doesn't completely update the contained object
It'll add the outermost .id property if you set in_place="always", but not a contained object's ID
In [1]: from ga4gh.vrs import models, normalize; from ga4gh.core import ga4gh_identify; from ga4gh.vrs.enderef import vrs_deref, vrs_enref
In [2]: input_data = {"location": {"end": 87894077, "start": 87894076, "sequenceReference": { "refgetAccession": "SQ.ss8r_wB0-b9r44TQTMmVTI92884QvBiB", "type": "SequenceReference"},},"state": {"sequence": "T"}}
In [3]: allele1 = models.Allele(**input_data)
In [4]: ga4gh_identify(allele1, in_place="always")
Out[8]: 'ga4gh:VA.K7akyz9PHB0wg8wBNVlWAAdvMbJUJJfU'
In [5]: allele1.id
Out[5]: 'ga4gh:VA.K7akyz9PHB0wg8wBNVlWAAdvMbJUJJfU'
In [6]: allele1.location.id is None
Out[6]: True
vrs_enref()/vrs_deref() will update IDs in place, but they'll be wrong
This one seems bad. I mean, maybe I don't understand how these methods are supposed to work, but this is troubling. Regardless, this is not a solution for my problem.
In [7]: storage = {}
In [8]: enreffed = vrs_enref(models.Allele(**input_data), storage)
In [9]: dereffed = vrs_deref(enreffed, storage)
In [10]: dereffed.id
Out[11]: 'ga4gh:VA.UBp6cO0u3i286SZhHhfUo1uFft259YyC'
In [12]: dereffed.location.id
Out[12]: 'ga4gh:SL.01EH5o6V6VEyNUq68gpeTwKE7xOo-WAy'
Note -- that location ID is correct, as far as I can tell. I don't understand why the allele ID is wrong.
vrs_enref() -> vrs_deref() -> clear allele ID and digest -> ga4gh_identify() works, but this is way more complicated than it should be
This is what I put into AnyVar as a temporary measure
def recursive_identify(vrs_object: Type_VrsObject) -> Type_VrsObject:
"""Add GA4GH IDs to an object and all GA4GH-identifiable objects contained within.
:param vrs_object: AnyVar-supported variation object
:return: same object, with any missing ID fields filled in
"""
storage = {}
enreffed = vrs_enref(vrs_object, storage)
dereffed = vrs_deref(enreffed, storage)
dereffed.id = None # type: ignore[reportAttributeAccessIssue]
dereffed.digest = None # type: ignore[reportAttributeAccessIssue]
ga4gh_identify(dereffed, in_place="always")
return dereffed # type: ignore[reportReturnType]
I cannot imagine this is the best possible solution to this problem, or that I'm the only person who's ever needed something like this before. I think it'd be nice to either update behavior of the existing functions or add something new that does this efficiently.
- Ngôn ngữ chính
- Python
- Star
- 63
- Fork
- 43
- Merge trung bình
- 1 giờ 2 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ga4gh/vrs-python
-
Update to `pysam>=0.24.0`Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ga4gh/vrs-python#653 · 2 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ga4gh/vrs-python#540 · 8 bình luận ·
-
Update models to reflect new gkm-core and vrs minor releasesCó thể đã có người làm @korikuzma đã nhận 25 ngày trước. Đang mởenhancement
ga4gh/vrs-python#651 · 1 bình luận · 1 người được giao ·
-
Add Relative Allele NormalizationCó thể làm lại được @korikuzma đã nhận 71 ngày trước và không có pull request nào đang mở. Đang mở
ga4gh/vrs-python#641 · 1 người được giao ·
-
Add Adjacency NormalizationĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
ga4gh/vrs-python#640 ·
Tất cả issue của ga4gh/vrs-python
Issue tương tự
-
pydanty:is-working
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
pydantic/pydantic-ai#8843 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
breaking change enhancement server
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
sktime/sktime#11310 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày