Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move VariationNormalizerRESTDataProxy to notebooks #374

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion notebooks/Extras.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
}
],
"source": [
"from ga4gh.vrs.extras.variation_normalizer_rest_dp import VariationNormalizerRESTDataProxy\n",
"from variation_normalizer_rest_dp import VariationNormalizerRESTDataProxy\n",
"vnorm = VariationNormalizerRESTDataProxy()\n",
"vnorm.to_hgvs(a)"
]
Expand Down
6 changes: 3 additions & 3 deletions notebooks/HGVS Translation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
"metadata": {},
"outputs": [],
"source": [
"from ga4gh.vrs.extras.variation_normalizer_rest_dp import VariationNormalizerRESTDataProxy\n",
"from variation_normalizer_rest_dp import VariationNormalizerRESTDataProxy\n",
"vnorm = VariationNormalizerRESTDataProxy()"
]
},
Expand Down Expand Up @@ -423,10 +423,10 @@
"source": [
"import tabulate\n",
"from ga4gh.vrs.normalize import normalize\n",
"from ga4gh.vrs.extras.variation_normalizer_rest_dp import VariationNormalizerRESTDataProxy\n",
"from variation_normalizer_rest_dp import VariationNormalizerRESTDataProxy\n",
"vnorm = VariationNormalizerRESTDataProxy()\n",
"\n",
"#The postgres default port of 5432 is blocked outbound by binder and potentially other institutions. \n",
"#The postgres default port of 5432 is blocked outbound by binder and potentially other institutions.\n",
"#To circumvent users having to install UTA themsleves we created a rest data proxy for variation normalizer for the to_hgvs endpoint.\n",
"\n",
"# todo: this example should get changed to use normalized hgvs_g as input.\n",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import requests

class VariationNormalizerRESTDataProxy:
"""
Rest data proxy for Variation Normalizer API
"""
"""Rest data proxy for Variation Normalizer API"""
def __init__(self) -> None:
"""
Initialize class with the API URL
"""
self.api = "https://normalize.cancervariants.org/variation"

def to_hgvs(self, vo, namespace="refseq"):
"""
tranlsate vrs allele object (vo) to hgvs format
def to_hgvs(self, vo, namespace="refseq") -> list[str]:
"""Translate vrs allele object (vo) to hgvs format

Use this method if you don't have UTA installed locally or are unable
to reach the public UTA database due to port issues.
"""
Expand All @@ -29,5 +27,5 @@ def to_hgvs(self, vo, namespace="refseq"):
if r.status_code == 200:
return r.json().get("variations", [])
else:
raise requests.HTTPError(f"Variation normalizer returned the status code: {r.status_code}.")

err_msg = f"Variation normalizer returned the status code: {r.status_code}."
raise requests.HTTPError(err_msg)
18 changes: 0 additions & 18 deletions tests/extras/test_variation_normalizer_rest_dp.py

This file was deleted.

Loading