Skip to content

Commit 5f14b3e

Browse files
authored
Merge pull request #137 from cancervariants/issue-126-vrsatile
Issue 126 vrsatile
2 parents 79f9d89 + 024fc4b commit 5f14b3e

File tree

10 files changed

+100
-163
lines changed

10 files changed

+100
-163
lines changed

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ pydantic = "*"
3232
uvloop = "*"
3333
httptools = "*"
3434
"ga4gh.vrs" = {version = "==0.7.0rc3", extras = ["extras"]}
35-
gene-normalizer = "*"
35+
gene-normalizer = ">=0.1.17"
3636
pyliftover = "*"
3737
boto3 = "*"

requirements-dev.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ beautifulsoup4==4.9.3
2828
biocommons.seqrepo==0.6.4
2929
bioutils==0.5.5; python_version >= '3.6'
3030
bleach==4.0.0; python_version >= '3.6'
31-
boto3==1.18.17
32-
botocore==1.21.17; python_version >= '3.6'
31+
boto3==1.18.20
32+
botocore==1.21.20; python_version >= '3.6'
3333
bs4==0.0.1
3434
canonicaljson==1.4.0; python_version ~= '3.5'
3535
certifi==2021.5.30
@@ -58,20 +58,20 @@ fastapi==0.68.0
5858
filelock==3.0.12
5959
flake8-docstrings==1.6.0
6060
flake8==3.9.2
61-
frozendict==2.0.4; python_version >= '3.6'
61+
frozendict==2.0.5; python_version >= '3.6'
6262
ga4gh.vrs[extras]==0.7.0rc3
63-
gene-normalizer==0.1.15
63+
gene-normalizer==0.1.17
6464
gffutils==0.10.1
6565
h11==0.12.0; python_version >= '3.6'
6666
hgvs==1.5.1
67-
httptools==0.2.0
67+
httptools==0.3.0
6868
humanfriendly==9.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
6969
identify==2.2.13; python_full_version >= '3.6.1'
7070
idna==3.2; python_version >= '3'
7171
importlib-metadata==4.6.3; python_version >= '3.6'
7272
inflection==0.5.1; python_version >= '3.5'
7373
iniconfig==1.1.1
74-
ipykernel==6.0.3
74+
ipykernel==6.1.0
7575
ipython-genutils==0.2.0
7676
ipython==7.26.0; python_version >= '3.7'
7777
ipywidgets==7.6.3
@@ -86,16 +86,16 @@ jupyter-core==4.7.1; python_version >= '3.6'
8686
jupyter-server==1.10.2; python_version >= '3.6'
8787
jupyter==1.0.0
8888
jupyterlab-pygments==0.1.2
89-
jupyterlab-server==2.6.2; python_version >= '3.6'
89+
jupyterlab-server==2.7.0; python_version >= '3.6'
9090
jupyterlab-widgets==1.0.0; python_version >= '3.6'
91-
jupyterlab==3.1.4
91+
jupyterlab==3.1.6
9292
keyring==23.0.1; python_version >= '3.6'
9393
kiwisolver==1.3.1; python_version >= '3.6'
9494
lxml==4.6.3
9595
markdown==3.3.4; python_version >= '3.6'
9696
markupsafe==2.0.1; python_version >= '3.6'
9797
matplotlib-inline==0.1.2; python_version >= '3.5'
98-
matplotlib==3.4.2
98+
matplotlib==3.4.3
9999
mccabe==0.6.1
100100
mistune==0.8.4
101101
nbclassic==0.3.1; python_version >= '3.6'
@@ -105,7 +105,7 @@ nbformat==5.1.3; python_version >= '3.5'
105105
nest-asyncio==1.5.1; python_version >= '3.5'
106106
networkx==2.6.2; python_version >= '3.7'
107107
nodeenv==1.6.0
108-
notebook==6.4.2; python_version >= '3.6'
108+
notebook==6.4.3; python_version >= '3.6'
109109
numpy==1.21.1; python_version >= '3.7'
110110
obonet==0.3.0; python_version >= '3.5'
111111
packaging==21.0; python_version >= '3.6'
@@ -165,7 +165,7 @@ soupsieve==2.2.1; python_version >= '3'
165165
sqlparse==0.4.1; python_version >= '3.5'
166166
starlette==0.14.2; python_version >= '3.6'
167167
tabulate==0.8.9
168-
terminado==0.10.1; python_version >= '3.6'
168+
terminado==0.11.0; python_version >= '3.6'
169169
testpath==0.5.0; python_version >= '3.5'
170170
toml==0.10.2; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
171171
tornado==6.1; python_version >= '3.5'
@@ -175,13 +175,13 @@ twine==3.4.2
175175
typing-extensions==3.10.0.0
176176
urllib3==1.26.6; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'
177177
uvicorn==0.14.0
178-
uvloop==0.15.3
178+
uvloop==0.16.0
179179
vcfpy==0.13.3
180-
virtualenv==20.7.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
180+
virtualenv==20.7.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
181181
w3lib==1.22.0
182182
wcwidth==0.2.5
183183
webencodings==0.5.1
184-
websocket-client==1.1.1; python_version >= '3.6'
184+
websocket-client==1.2.1; python_version >= '3.6'
185185
websockets==8.1
186186
widgetsnbextension==3.5.1
187187
yoyo-migrations==7.3.2

requirements.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ backports-datetime-fromisoformat==1.0.0
1717
beautifulsoup4==4.9.3
1818
biocommons.seqrepo==0.6.4
1919
bioutils==0.5.5; python_version >= '3.6'
20-
boto3==1.18.17
21-
botocore==1.21.17; python_version >= '3.6'
20+
boto3==1.18.20
21+
botocore==1.21.20; python_version >= '3.6'
2222
bs4==0.0.1
2323
canonicaljson==1.4.0; python_version ~= '3.5'
2424
certifi==2021.5.30
@@ -32,13 +32,13 @@ decorator==5.0.9; python_version >= '3.5'
3232
deprecation==2.1.0
3333
fake-useragent==0.1.11
3434
fastapi==0.68.0
35-
frozendict==2.0.4; python_version >= '3.6'
35+
frozendict==2.0.5; python_version >= '3.6'
3636
ga4gh.vrs[extras]==0.7.0rc3
37-
gene-normalizer==0.1.15
37+
gene-normalizer==0.1.17
3838
gffutils==0.10.1
3939
h11==0.12.0; python_version >= '3.6'
4040
hgvs==1.5.1
41-
httptools==0.2.0
41+
httptools==0.3.0
4242
humanfriendly==9.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
4343
idna==3.2; python_version >= '3'
4444
inflection==0.5.1; python_version >= '3.5'
@@ -91,7 +91,7 @@ traitlets==5.0.5; python_version >= '3.7'
9191
typing-extensions==3.10.0.0
9292
urllib3==1.26.6; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'
9393
uvicorn==0.14.0
94-
uvloop==0.15.3
94+
uvloop==0.16.0
9595
vcfpy==0.13.3
9696
w3lib==1.22.0
9797
wcwidth==0.2.5

tests/test_normalize.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ def braf_v600e(braf_gene_context):
464464
},
465465
"molecule_context": "protein",
466466
"structural_type": "SO:0001606",
467-
"ref_allele_seq": "V",
467+
"vrs_ref_allele_seq": "V",
468468
"gene_context": braf_gene_context
469469
}
470470
return VariationDescriptor(**params)
@@ -495,7 +495,7 @@ def vhl(vhl_gene_context):
495495
},
496496
"molecule_context": "protein",
497497
"structural_type": "SO:0001617",
498-
"ref_allele_seq": "Y",
498+
"vrs_ref_allele_seq": "Y",
499499
"gene_context": vhl_gene_context
500500
}
501501
return VariationDescriptor(**params)
@@ -526,7 +526,7 @@ def vhl_silent(vhl_gene_context):
526526
},
527527
"molecule_context": "protein",
528528
"structural_type": "SO:0001017",
529-
"ref_allele_seq": "P",
529+
"vrs_ref_allele_seq": "P",
530530
"gene_context": vhl_gene_context
531531
}
532532
return VariationDescriptor(**params)
@@ -542,7 +542,7 @@ def braf_v600e_nucleotide(braf_gene_context, braf_nuc_value):
542542
"value": braf_nuc_value,
543543
"molecule_context": "transcript",
544544
"structural_type": "SO:0001483",
545-
"ref_allele_seq": "T",
545+
"vrs_ref_allele_seq": "T",
546546
"gene_context": braf_gene_context
547547
}
548548
return VariationDescriptor(**params)
@@ -573,7 +573,7 @@ def nm_004448_coding_dna_delins(erbb2_context):
573573
},
574574
"molecule_context": "transcript",
575575
"structural_type": "SO:1000032",
576-
"ref_allele_seq": "GG",
576+
"vrs_ref_allele_seq": "GG",
577577
"gene_context": erbb2_context
578578
}
579579
return VariationDescriptor(**params)
@@ -604,7 +604,7 @@ def nc_000007_genomic_delins(braf_gene_context):
604604
},
605605
"molecule_context": "transcript",
606606
"structural_type": "SO:1000032",
607-
"ref_allele_seq": "TG",
607+
"vrs_ref_allele_seq": "TG",
608608
"gene_context": braf_gene_context
609609
}
610610
return VariationDescriptor(**params)
@@ -614,7 +614,7 @@ def nc_000007_genomic_delins(braf_gene_context):
614614
def nm_000551(vhl_gene_context):
615615
"""Create test fixture for NM_000551.4:c.615delinsAA."""
616616
params = {
617-
"id": 'temp_id',
617+
"id": 'normalize.variation:temp',
618618
"type": "VariationDescriptor",
619619
"value_id": "ga4gh:VA.SjJnUcJL1EyRFUb6f8PSJA4u3fyin2Wj",
620620
"value": {
@@ -635,7 +635,7 @@ def nm_000551(vhl_gene_context):
635635
},
636636
"molecule_context": "transcript",
637637
"structural_type": "SO:1000032",
638-
"ref_allele_seq": "C",
638+
"vrs_ref_allele_seq": "C",
639639
"gene_context": vhl_gene_context
640640
}
641641
return VariationDescriptor(**params)
@@ -674,7 +674,7 @@ def coding_dna_silent_mutation(braf_gene_context, braf_nuc_value):
674674
"value": value,
675675
"molecule_context": "transcript",
676676
"structural_type": "SO:0002073",
677-
"ref_allele_seq": "T",
677+
"vrs_ref_allele_seq": "T",
678678
"gene_context": braf_gene_context
679679
}
680680
return VariationDescriptor(**params)
@@ -692,7 +692,7 @@ def nc_000007_silent_mutation(braf_gene_context, braf_nuc_value):
692692
"value": value,
693693
"molecule_context": "transcript",
694694
"structural_type": "SO:0002073",
695-
"ref_allele_seq": "T",
695+
"vrs_ref_allele_seq": "T",
696696
"gene_context": braf_gene_context
697697
}
698698
return VariationDescriptor(**params)
@@ -723,7 +723,7 @@ def amino_acid_delins(egfr_context):
723723
},
724724
"molecule_context": "protein",
725725
"structural_type": "SO:1000032",
726-
"ref_allele_seq": "LREAT",
726+
"vrs_ref_allele_seq": "LREAT",
727727
"gene_context": egfr_context
728728
}
729729
return VariationDescriptor(**params)
@@ -756,7 +756,7 @@ def amino_acid_deletion_np_range(erbb2_context):
756756
},
757757
"molecule_context": "protein",
758758
"structural_type": "SO:0001604",
759-
"ref_allele_seq": "LRENT",
759+
"vrs_ref_allele_seq": "LRENT",
760760
"gene_context": erbb2_context
761761
}
762762
return VariationDescriptor(**params)
@@ -789,7 +789,7 @@ def coding_dna_deletion(erbb2_context):
789789
},
790790
"molecule_context": "transcript",
791791
"structural_type": "SO:0000159",
792-
"ref_allele_seq": "TTGAGGGAAAACACAT",
792+
"vrs_ref_allele_seq": "TTGAGGGAAAACACAT",
793793
"gene_context": erbb2_context
794794
}
795795
return VariationDescriptor(**params)
@@ -820,7 +820,7 @@ def genomic_deletion(vhl_gene_context):
820820
},
821821
"molecule_context": "transcript",
822822
"structural_type": "SO:0000159",
823-
"ref_allele_seq": "ATGTTGACGGACAGCCTAT",
823+
"vrs_ref_allele_seq": "ATGTTGACGGACAGCCTAT",
824824
"gene_context": vhl_gene_context
825825
}
826826
return VariationDescriptor(**params)
@@ -911,7 +911,7 @@ def genomic_insertion(erbb2_context):
911911
},
912912
"molecule_context": "transcript",
913913
"structural_type": "SO:0000667",
914-
"ref_allele_seq": "TACGTGATGGCT",
914+
"vrs_ref_allele_seq": "TACGTGATGGCT",
915915
"gene_context": erbb2_context
916916
}
917917
return VariationDescriptor(**params)
@@ -942,7 +942,7 @@ def genomic_substitution(egfr_context):
942942
},
943943
"molecule_context": "transcript",
944944
"structural_type": "SO:0001483",
945-
"ref_allele_seq": "C",
945+
"vrs_ref_allele_seq": "C",
946946
"gene_context": egfr_context
947947
}
948948
return VariationDescriptor(**params)
@@ -973,7 +973,7 @@ def genomic_sub_grch38():
973973
},
974974
"molecule_context": "genomic",
975975
"structural_type": "SO:0001483",
976-
"ref_allele_seq": "C"
976+
"vrs_ref_allele_seq": "C"
977977
}
978978
return VariationDescriptor(**params)
979979

@@ -1003,7 +1003,7 @@ def egfr_grch38_sub(genomic_sub_grch38, egfr_context):
10031003
},
10041004
"molecule_context": "genomic",
10051005
"structural_type": "SO:0001483",
1006-
"ref_allele_seq": "C",
1006+
"vrs_ref_allele_seq": "C",
10071007
"gene_context": egfr_context
10081008
}
10091009
return VariationDescriptor(**params)
@@ -1017,7 +1017,8 @@ def assertion_checks(normalize_response, test_variation):
10171017
assert normalize_response.molecule_context == \
10181018
test_variation.molecule_context
10191019
assert normalize_response.structural_type == test_variation.structural_type
1020-
assert normalize_response.ref_allele_seq == test_variation.ref_allele_seq
1020+
assert normalize_response.vrs_ref_allele_seq == \
1021+
test_variation.vrs_ref_allele_seq
10211022

10221023
resp_gene_context = normalize_response.gene_context
10231024
test_variation_context = test_variation.gene_context
@@ -1338,11 +1339,11 @@ def test_no_matches(test_normalize):
13381339
for q in queries:
13391340
resp = test_normalize.normalize(q)
13401341
assert resp.type == 'VariationDescriptor'
1341-
assert resp.value['type'] == 'Text'
1342+
assert resp.value.type == 'Text'
13421343

13431344
resp = test_normalize.normalize('clinvar:10')
13441345
assert resp.type == 'VariationDescriptor'
1345-
assert resp.value['definition'] == 'clinvar:10'
1346+
assert resp.value.definition == 'clinvar:10'
13461347

13471348
resp = test_normalize.normalize(' ')
13481349
assert resp is None

tests/translators/translator_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def test_translator(self):
4949
for vr in validation_results:
5050
if vr.is_valid:
5151
loc = (self.translator.translate(vr)).__dict__
52+
loc['location'] = loc['location'].dict()
53+
del loc['location']['id']
5254
if loc not in found:
5355
found.append(loc)
5456
num_valid += 1

variation/normalize.py

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def normalize(self, q, validations, warnings):
4646
allele = valid_result.allele
4747
allele_id = allele.pop('_id')
4848
identifier = valid_result.identifier
49-
ref_allele_seq = self.get_ref_allele_seq(
49+
vrs_ref_allele_seq = self.get_ref_allele_seq(
5050
allele, identifier
5151
)
5252

@@ -62,7 +62,7 @@ def normalize(self, q, validations, warnings):
6262
value=allele,
6363
molecule_context=valid_result.classification_token.molecule_context, # noqa: E501
6464
structural_type=valid_result.classification_token.so_id,
65-
ref_allele_seq=ref_allele_seq,
65+
vrs_ref_allele_seq=vrs_ref_allele_seq,
6666
gene_context=gene_context
6767
)
6868
else:
@@ -102,38 +102,6 @@ def get_gene_descriptor(self, gene_token):
102102
return response['gene_descriptor']
103103
return None
104104

105-
def get_extensions(self, record, record_location):
106-
"""Return a list of ga4gh extensions.
107-
108-
:param gene.schemas.Gene record: The record from the normalization
109-
service
110-
:param gene.schemas.ChromosomeLocation record_location: The record's
111-
location
112-
:return: List of extensions providing additional information
113-
"""
114-
extensions = list()
115-
self.add_extension(extensions, 'strand', record.strand)
116-
self.add_extension(extensions, 'symbol_status', record.symbol_status)
117-
self.add_extension(extensions, 'associated_with',
118-
record.associated_with)
119-
self.add_extension(extensions, 'chromosome_location',
120-
record_location.dict(by_alias=True))
121-
return extensions
122-
123-
def add_extension(self, extensions, name, value):
124-
"""Add extension to list of extensions.
125-
126-
:param list extensions: List of ga4gh extensions
127-
:param str name: name of extension
128-
:param any value: value of extension
129-
"""
130-
if value:
131-
extensions.append({
132-
'type': 'Extension',
133-
'name': name,
134-
'value': value
135-
})
136-
137105
def get_ref_allele_seq(self, allele, identifier) -> Optional[str]:
138106
"""Return ref allele seq for transcript.
139107

0 commit comments

Comments
 (0)