Repository navigation
Enforce sequence coordinate bounds #663
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
9a46409
fix(translator): look up VRS model class by type in _from_vrs
theferrit32 da9a058
fix(translator): reject out-of-bounds sequence locations
theferrit32 965684a
fix(normalize): reject out-of-bounds allele locations before fetching
theferrit32 1d8e654
test: cover out-of-bounds location validation
theferrit32 6c81988
cleanup: trim location bounds validation
theferrit32 3fb4abc
cleanup: inline single-use bounds helpers
theferrit32 0c6ea81
cleanup: validate bounds against the refget accession
theferrit32 4b3684f
cleanup: address review of location bounds validation
theferrit32 e3790a4
cleanup: name both input and refget ids in bounds errors
theferrit32 31ba35e
cleanup: use dict test cases to match existing parametrize style
theferrit32 dd353c8
revert: drop _from_vrs fix from location bounds branch
theferrit32 40e6dc1
cleanup: check location bounds inside validate_ref_seq
theferrit32 17bb4bd
fix: reject locations and fetches whose start is after their end
theferrit32 24271bb
fix: check HGVS identity and dup locations before fetching the reference
theferrit32 96666fe
Merge branch 'main' into kf/location-bounds
theferrit32 d6f5059
cleanup: trim start-after-end docstrings, comments and error message
theferrit32 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
tests/extras/cassettes/test_in_bounds[spdi-insertion-at-end].yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| interactions: | ||
| - request: | ||
| body: null | ||
| headers: {} | ||
| method: GET | ||
| uri: http://localhost:5000/seqrepo/1/metadata/refseq:NM_000551.3 | ||
| response: | ||
| body: | ||
| string: "{\n \"added\": \"2016-08-24T05:03:11Z\",\n \"aliases\": [\n \"MD5:215137b1973c1a5afcf86be7d999574a\",\n | ||
| \ \"NCBI:NM_000551.3\",\n \"refseq:NM_000551.3\",\n \"SEGUID:T12L0p2X5E8DbnL0+SwI4Wc1S6g\",\n | ||
| \ \"SHA1:4f5d8bd29d97e44f036e72f4f92c08e167354ba8\",\n \"VMC:GS_v_QTc1p-MUYdgrRv4LMT6ByXIOsdw3C_\",\n | ||
| \ \"sha512t24u:v_QTc1p-MUYdgrRv4LMT6ByXIOsdw3C_\",\n \"ga4gh:SQ.v_QTc1p-MUYdgrRv4LMT6ByXIOsdw3C_\"\n | ||
| \ ],\n \"alphabet\": \"ACGT\",\n \"length\": 4560\n}\n" | ||
| headers: {} | ||
| status: | ||
| code: 200 | ||
| message: OK | ||
| - request: | ||
| body: null | ||
| headers: {} | ||
| method: GET | ||
| uri: http://localhost:5000/seqrepo/1/metadata/ga4gh:SQ.v_QTc1p-MUYdgrRv4LMT6ByXIOsdw3C_ | ||
| response: | ||
| body: | ||
| string: "{\n \"added\": \"2016-08-24T05:03:11Z\",\n \"aliases\": [\n \"MD5:215137b1973c1a5afcf86be7d999574a\",\n | ||
| \ \"NCBI:NM_000551.3\",\n \"refseq:NM_000551.3\",\n \"SEGUID:T12L0p2X5E8DbnL0+SwI4Wc1S6g\",\n | ||
| \ \"SHA1:4f5d8bd29d97e44f036e72f4f92c08e167354ba8\",\n \"VMC:GS_v_QTc1p-MUYdgrRv4LMT6ByXIOsdw3C_\",\n | ||
| \ \"sha512t24u:v_QTc1p-MUYdgrRv4LMT6ByXIOsdw3C_\",\n \"ga4gh:SQ.v_QTc1p-MUYdgrRv4LMT6ByXIOsdw3C_\"\n | ||
| \ ],\n \"alphabet\": \"ACGT\",\n \"length\": 4560\n}\n" | ||
| headers: {} | ||
| status: | ||
| code: 200 | ||
| message: OK | ||
| - request: | ||
| body: null | ||
| headers: {} | ||
| method: GET | ||
| uri: http://localhost:5000/seqrepo/1/sequence/ga4gh:SQ.v_QTc1p-MUYdgrRv4LMT6ByXIOsdw3C_?start=4560&end=4560 | ||
| response: | ||
| body: | ||
| string: '' | ||
| headers: {} | ||
| status: | ||
| code: 200 | ||
| message: OK | ||
| - request: | ||
| body: null | ||
| headers: {} | ||
| method: GET | ||
| uri: http://localhost:5000/seqrepo/1/sequence/ga4gh:SQ.v_QTc1p-MUYdgrRv4LMT6ByXIOsdw3C_?start=4559&end=4560 | ||
| response: | ||
| body: | ||
| string: G | ||
| headers: {} | ||
| status: | ||
| code: 200 | ||
| message: OK | ||
| version: 1 |
25 changes: 25 additions & 0 deletions
25
tests/extras/cassettes/test_out_of_bounds[beacon-past-end].yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| interactions: | ||
| - request: | ||
| body: null | ||
| headers: {} | ||
| method: GET | ||
| uri: http://localhost:5000/seqrepo/1/metadata/GRCh38:1 | ||
| response: | ||
| body: | ||
| string: "{\n \"added\": \"2016-08-27T21:17:00Z\",\n \"aliases\": [\n \"GRCh38:1\",\n | ||
| \ \"GRCh38:chr1\",\n \"GRCh38.p1:1\",\n \"GRCh38.p1:chr1\",\n \"GRCh38.p10:1\",\n | ||
| \ \"GRCh38.p10:chr1\",\n \"GRCh38.p11:1\",\n \"GRCh38.p11:chr1\",\n | ||
| \ \"GRCh38.p12:1\",\n \"GRCh38.p12:chr1\",\n \"GRCh38.p2:1\",\n \"GRCh38.p2:chr1\",\n | ||
| \ \"GRCh38.p3:1\",\n \"GRCh38.p3:chr1\",\n \"GRCh38.p4:1\",\n \"GRCh38.p4:chr1\",\n | ||
| \ \"GRCh38.p5:1\",\n \"GRCh38.p5:chr1\",\n \"GRCh38.p6:1\",\n \"GRCh38.p6:chr1\",\n | ||
| \ \"GRCh38.p7:1\",\n \"GRCh38.p7:chr1\",\n \"GRCh38.p8:1\",\n \"GRCh38.p8:chr1\",\n | ||
| \ \"GRCh38.p9:1\",\n \"GRCh38.p9:chr1\",\n \"MD5:6aef897c3d6ff0c78aff06ac189178dd\",\n | ||
| \ \"NCBI:NC_000001.11\",\n \"refseq:NC_000001.11\",\n \"SEGUID:FCUd6VJ6uikS/VWLbhGdVmj2rOA\",\n | ||
| \ \"SHA1:14251de9527aba2912fd558b6e119d5668f6ace0\",\n \"VMC:GS_Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO\",\n | ||
| \ \"sha512t24u:Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO\",\n \"ga4gh:SQ.Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO\"\n | ||
| \ ],\n \"alphabet\": \"ACGMNRT\",\n \"length\": 248956422\n}\n" | ||
| headers: {} | ||
| status: | ||
| code: 200 | ||
| message: OK | ||
| version: 1 |
25 changes: 25 additions & 0 deletions
25
tests/extras/cassettes/test_out_of_bounds[cnv-hgvs-copy-number-change-past-end].yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| interactions: | ||
| - request: | ||
| body: null | ||
| headers: {} | ||
| method: GET | ||
| uri: http://localhost:5000/seqrepo/1/metadata/refseq:NC_000007.14 | ||
| response: | ||
| body: | ||
| string: "{\n \"added\": \"2016-08-27T21:23:35Z\",\n \"aliases\": [\n \"GRCh38:7\",\n | ||
| \ \"GRCh38:chr7\",\n \"GRCh38.p1:7\",\n \"GRCh38.p1:chr7\",\n \"GRCh38.p10:7\",\n | ||
| \ \"GRCh38.p10:chr7\",\n \"GRCh38.p11:7\",\n \"GRCh38.p11:chr7\",\n | ||
| \ \"GRCh38.p12:7\",\n \"GRCh38.p12:chr7\",\n \"GRCh38.p2:7\",\n \"GRCh38.p2:chr7\",\n | ||
| \ \"GRCh38.p3:7\",\n \"GRCh38.p3:chr7\",\n \"GRCh38.p4:7\",\n \"GRCh38.p4:chr7\",\n | ||
| \ \"GRCh38.p5:7\",\n \"GRCh38.p5:chr7\",\n \"GRCh38.p6:7\",\n \"GRCh38.p6:chr7\",\n | ||
| \ \"GRCh38.p7:7\",\n \"GRCh38.p7:chr7\",\n \"GRCh38.p8:7\",\n \"GRCh38.p8:chr7\",\n | ||
| \ \"GRCh38.p9:7\",\n \"GRCh38.p9:chr7\",\n \"MD5:cc044cc2256a1141212660fb07b6171e\",\n | ||
| \ \"NCBI:NC_000007.14\",\n \"refseq:NC_000007.14\",\n \"SEGUID:4+JjCcBVhPCr8vdIhUKFycPv8bY\",\n | ||
| \ \"SHA1:e3e26309c05584f0abf2f748854285c9c3eff1b6\",\n \"VMC:GS_F-LrLMe1SRpfUZHkQmvkVKFEGaoDeHul\",\n | ||
| \ \"sha512t24u:F-LrLMe1SRpfUZHkQmvkVKFEGaoDeHul\",\n \"ga4gh:SQ.F-LrLMe1SRpfUZHkQmvkVKFEGaoDeHul\"\n | ||
| \ ],\n \"alphabet\": \"ACGNRSTY\",\n \"length\": 159345973\n}\n" | ||
| headers: {} | ||
| status: | ||
| code: 200 | ||
| message: OK | ||
| version: 1 |
25 changes: 25 additions & 0 deletions
25
tests/extras/cassettes/test_out_of_bounds[gnomad-negative-start].yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| interactions: | ||
| - request: | ||
| body: null | ||
| headers: {} | ||
| method: GET | ||
| uri: http://localhost:5000/seqrepo/1/metadata/GRCh38:1 | ||
| response: | ||
| body: | ||
| string: "{\n \"added\": \"2016-08-27T21:17:00Z\",\n \"aliases\": [\n \"GRCh38:1\",\n | ||
| \ \"GRCh38:chr1\",\n \"GRCh38.p1:1\",\n \"GRCh38.p1:chr1\",\n \"GRCh38.p10:1\",\n | ||
| \ \"GRCh38.p10:chr1\",\n \"GRCh38.p11:1\",\n \"GRCh38.p11:chr1\",\n | ||
| \ \"GRCh38.p12:1\",\n \"GRCh38.p12:chr1\",\n \"GRCh38.p2:1\",\n \"GRCh38.p2:chr1\",\n | ||
| \ \"GRCh38.p3:1\",\n \"GRCh38.p3:chr1\",\n \"GRCh38.p4:1\",\n \"GRCh38.p4:chr1\",\n | ||
| \ \"GRCh38.p5:1\",\n \"GRCh38.p5:chr1\",\n \"GRCh38.p6:1\",\n \"GRCh38.p6:chr1\",\n | ||
| \ \"GRCh38.p7:1\",\n \"GRCh38.p7:chr1\",\n \"GRCh38.p8:1\",\n \"GRCh38.p8:chr1\",\n | ||
| \ \"GRCh38.p9:1\",\n \"GRCh38.p9:chr1\",\n \"MD5:6aef897c3d6ff0c78aff06ac189178dd\",\n | ||
| \ \"NCBI:NC_000001.11\",\n \"refseq:NC_000001.11\",\n \"SEGUID:FCUd6VJ6uikS/VWLbhGdVmj2rOA\",\n | ||
| \ \"SHA1:14251de9527aba2912fd558b6e119d5668f6ace0\",\n \"VMC:GS_Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO\",\n | ||
| \ \"sha512t24u:Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO\",\n \"ga4gh:SQ.Ya6Rs7DHhDeg7YaOSg1EoNi3U_nQ9SvO\"\n | ||
| \ ],\n \"alphabet\": \"ACGMNRT\",\n \"length\": 248956422\n}\n" | ||
| headers: {} | ||
| status: | ||
| code: 200 | ||
| message: OK | ||
| version: 1 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.