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

Add SV Genotype Example #463

Draft
wants to merge 4 commits into
base: 2.x
Choose a base branch
from
Draft
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ those implementing tools with VRS.

## Using smoketests

The smoketests require python 3.8+. This is the recommended setup:
The smoketests require python 3.9+. This is the recommended setup:

```
$ python3 -m venv venv
Expand Down
Binary file added docs/source/images/tests/ex_sv_genotype.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions examples/sv_genotype.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
id: sv_genotype
type: Genotype
count: 2
members:
- id: genotype_member1
count: 1
variation:
id: haplotype1
type: Haplotype
members:
- id: ga4gh:AJ.WSHvYBlk-fTVCyCYeDeGuhK6z61cQfB4
type: Adjacency
adjoinedSequences:
- type: SequenceLocation
sequenceReference:
refgetAccession: SQ.S_KjnFVz-FE7M0W6yoaUDgYxLPc1jyWU
residueAlphabet: na
id: NC_000001.10
end: 2000
- type: SequenceLocation
start: 1000
- id: ga4gh:VA.-tOc0wAbtHAU8uIK3t9OQzm95aTD7yOx
type: Allele
location:
type: SequenceLocation
start: 1500
end: 1501
state:
type: LiteralSequenceExpression
sequence: C
- id: genotype_member2
count: 1
variation:
id: ga4gh:AJ.kfptigQUh7Gj7IIYtXiA1talIvXu9w6x
type: Adjacency
adjoinedSequences:
- type: SequenceLocation
sequenceReference:
refgetAccession: SQ.S_KjnFVz-FE7M0W6yoaUDgYxLPc1jyWU
residueAlphabet: na
id: NC_000001.10
end: 850
- type: SequenceLocation
start: 950
2 changes: 2 additions & 0 deletions schema/merged.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ $defs:
MolecularVariation:
description: A variation on a contiguous molecule.
oneOf:
- $ref: '#/$defs/Adjacency'
- $ref: '#/$defs/Allele'
- $ref: '#/$defs/Haplotype'
discriminator:
Expand Down Expand Up @@ -661,6 +662,7 @@ $defs:
description: The number of copies of the `variation` at a Genotype locus.
variation:
oneOf:
- $ref: '#/$defs/Adjacency'
- $ref: '#/$defs/Allele'
- $ref: '#/$defs/Haplotype'
description: A MolecularVariation at a Genotype locus.
Expand Down
2 changes: 2 additions & 0 deletions schema/vrs-source.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ $defs:
oneOf:
- $ref: "#/$defs/Allele"
- $ref: "#/$defs/Haplotype"
- $ref: "#/$defs/Adjacency"
discriminator:
propertyName: type

Expand Down Expand Up @@ -506,6 +507,7 @@ $defs:
oneOf:
- $ref: "#/$defs/Allele"
- $ref: "#/$defs/Haplotype"
- $ref: "#/$defs/Adjacency"
description: >-
A :ref:`MolecularVariation` at a :ref:`Genotype` locus.
required: [ "count", "variation" ]
Expand Down
6 changes: 6 additions & 0 deletions schema/vrs.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
"MolecularVariation": {
"description": "A variation on a contiguous molecule.",
"oneOf": [
{
"$ref": "#/$defs/Adjacency"
},
{
"$ref": "#/$defs/Allele"
},
Expand Down Expand Up @@ -865,6 +868,9 @@
},
"variation": {
"oneOf": [
{
"$ref": "#/$defs/Adjacency"
},
{
"$ref": "#/$defs/Allele"
},
Expand Down
2 changes: 2 additions & 0 deletions schema/vrs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ $defs:
MolecularVariation:
description: A variation on a contiguous molecule.
oneOf:
- $ref: '#/$defs/Adjacency'
- $ref: '#/$defs/Allele'
- $ref: '#/$defs/Haplotype'
discriminator:
Expand Down Expand Up @@ -661,6 +662,7 @@ $defs:
description: The number of copies of the `variation` at a Genotype locus.
variation:
oneOf:
- $ref: '#/$defs/Adjacency'
- $ref: '#/$defs/Allele'
- $ref: '#/$defs/Haplotype'
description: A MolecularVariation at a Genotype locus.
Expand Down
19 changes: 12 additions & 7 deletions tests/test_definitions.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
tests:
- test_file: simple_breakpoint.yaml
description: An adjacency between two sequence locations.
image: ../../docs/images/ex_simple_breakpoint.png
image: ../docs/source/images/tests/ex_simple_breakpoint.png
schema: vrs
definition: Adjacency
- test_file: revcomp_breakpoint.yaml
description: An adjacency between two sequence locations, the 2nd of which is in reverse orientation.
image: ../../docs/images/ex_revcomp_breakpoint.png
image: ../docs/source/images/tests/ex_revcomp_breakpoint.png
schema: vrs
definition: Adjacency
- test_file: terminal_breakend.yaml
description: An adjacency with only the starting sequence location. defining the break at which the adjacency ends or terminates.
image: ../../docs/images/ex_terminal_breakend.png
image: ../docs/source/images/tests/ex_terminal_breakend.png
schema: vrs
definition: Adjacency
- test_file: sequence_homology.yaml
description: An adjacency in which the two sequence locations have a homologous overlapping adjoined sequences.
image: ../../docs/images/ex_sequence_homology.png
image: ../docs/source/images/tests/ex_sequence_homology.png
schema: vrs
definition: Adjacency
- test_file: precise_linker.yaml
description: An adjacency with a literal sequence linking the two sequence locations that make up the adjoined sequences.
image: ../../docs/images/ex_precise_linker.png
image: ../docs/source/images/tests/ex_precise_linker.png
schema: vrs
definition: Adjacency
- test_file: ambiguous_linker.yaml
description: An adjacency with a length expression linking the two sequence locations that make up the adjoined sequences.
image: ../../docs/images/ex_ambiguous_linker.png
image: ../docs/source/images/tests/ex_ambiguous_linker.png
schema: vrs
definition: Adjacency
- test_file: sv_haplotype.yaml
description: A haplotype of 3 members. First an adjacency with a litereal sequence linker followed by an SNV on the 2nd sequence and ending with a simple breakpoint adjacency that ends with the 1st sequence in the haplotype.
image: ../../docs/images/ex_sv_haplotype.png
image: ../docs/source/images/tests/ex_sv_haplotype.png
schema: vrs
definition: Haplotype
- test_file: sv_genotype.yaml
description: A genotype consisting of 2 members. The first member has a tandem duplication with a SNV on the second copy of the duplicated region. The second member has a deletion.
image: ../docs/source/images/tests/ex_sv_genotype.png
schema: vrs
definition: Genotype
- test_file: simple_haplotype.yaml
description: A haplotype of two alleles on a shared chromosome reference sequence.
schema: vrs
Expand Down
6 changes: 3 additions & 3 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from config import test_dir, schema_dir, examples_dir
import yaml
from jsonschema import validate
from jsonschema import validate, ValidationError


def get_schema(schema_file, schema_class, kw="$defs"):
Expand All @@ -22,5 +22,5 @@ def test_examples():
)
try:
assert validate(data, schema) is None
except AssertionError as e:
raise AssertionError(f"AssertionError in {test['test_file']}: {e}")
except ValidationError as e:
raise ValidationError(f"AssertionError in {test['test_file']}: {e}")
Loading