Add a function to recursively add IDs to a VRS object and every contained identifiable object
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 38/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
まず ga4gh_identify()、vrs_enref()、vrs_deref() のエントリポイントを読み、issue の例とそれらの動作を比較します。recursive_identify が現在どのようにそれらを補っているかを確認し、正しい ID を変更せずに、VRS オブジェクトとその中に含まれる識別可能なオブジェクトへ不足している ID を再帰的に追加することを完了の定義とします。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 63
- フォーク
- 43
- 平均マージ
- 1時間 2分
- マージ済み PR(30日)
- 1
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ga4gh/vrs-python のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ga4gh/vrs-python#653 · リアクション 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ga4gh/vrs-python#540 · コメント 8 件 ·
-
enhancement
ga4gh/vrs-python#651 · コメント 1 件 · 担当者 1 名 ·
-
ga4gh/vrs-python#641 · 担当者 1 名 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
ga4gh/vrs-python#640 ·
ga4gh/vrs-python の issue をすべて見る
似ている issue
-
agent-ready documentation needs-triage
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
-
instance instance add
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
searxng/searx-instances#939 · コメント 1 件 ·
-
area-deployment area-integrations triage:bot-seen
難易度 2/5 半日 初心者へのやさしさ 86/100