/
test_effect_annotation_errors.py
280 lines (249 loc) · 9.44 KB
/
test_effect_annotation_errors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# Copyright (c) 2016. Mount Sinai School of Medicine
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Any time the effect annotation of a variant is erroneous, add it to this
test suite.
"""
from varcode import Variant
from varcode.effects import (
Silent, PrematureStop, StopLoss, Insertion, Substitution
)
from .common import expect_effect
def test_issue167_insertion_of_stop_codon():
"""
Issue: https://github.com/hammerlab/varcode/issues/167
The coding sequence at chr1/99772765 has transcript ID ENSMUST00000086738
and looks like:
ATG GAT TCT GTA CCA AGA CTG ACC AGC ATT TTG
^ position 99772782
The protein is ENSMUSP00000083944 and looks like:
M D S V P R L T S I L
##fileformat=VCFv4.1
CHROM POS ID REF ALT QUAL FILTER INFO FORMAT
chr1 99772782 . ACTG ATGA 5000 . . .
"""
variant = Variant("chr1", 99772782, "A", "ATGA", ensembl="GRCm38")
expect_effect(
variant=variant,
effect_class=PrematureStop,
protein_sequence="MDSVPR")
def test_issue168_frameshift_creates_silent_stop_codon():
"""
Issue: https://github.com/hammerlab/varcode/issues/168
Using genome GRCm38, over transcript ENSMUST00000086738
The coding sequence at chr1/99772765 has transcript ID ENSMUST00000086738
and the end looks like:
TTC ATC TGA ACT ATT GTG TGG TCA TCT GGT CCT CTT TTT (...)
^ stop codon
Synonymous FrameShift over the stop codon: TGA -> TAG AAC ...
##fileformat=VCFv4.1
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT
chr1 100484699 . T TA 5000 . . .
"""
variant = Variant("chr1", 100484699, "T", "TA", "GRCm38")
expect_effect(
variant,
effect_class=Silent)
def test_issue169_insertion_of_stop_codon():
"""
Issue: https://github.com/hammerlab/varcode/issues/169
The coding sequence at chr1/99772765 looks like:
ATG GAT TCT GTA CCA AGA CTG ACC AGC ATT TTGx
^ 99772782
The protein is ENSMUSP00000083944 and looks like:
M D S V P R L T S I L
The variant causes a stop codon to be introduced at position 21 in the
nucleotide sequence, codon number 7 (with zero based indexing),
so the protein sequence will look like MDSVPRL.
Synonymous Substitution + PrematureStop insertion: CTG/TTA both encode L
# ##fileformat=VCFv4.1
# #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT
# chr1 99772782 . ACTG ATTATGA 5000 . . .
"""
# synonymous substitution followed by stop codon
variant = Variant("chr1", 99772782, "ACTG", "ATTATGA", "GRCm38")
expect_effect(
variant,
effect_class=PrematureStop)
# non-synonymous substitution followed by stop codon
variant = Variant("chr1", 99772782, "ACTG", "AACCTGA", "GRCm38")
expect_effect(
variant,
effect_class=PrematureStop)
def test_issue170_stop_loss_does_not_translate_into_3prime_utr():
"""
Issue: https://github.com/hammerlab/varcode/issues/170
Testcase, using genome GRCm38, over transcript ENSMUST00000086738
The coding sequence at chr1/99772765 has transcript ID ENSMUST00000086738
and the end looks like:
TTC ATC TGA ACT ATT GTG TGG TCA TCT GGT CCT CTT TTT TGC AGA GGT TTC CAT CTC
^ stop codon
TTT TTC TTT TCT TTC TTT TAA
This segment translates as:
F I * T I V W S S G P L F C R G F H L
F F F S F F *
A TGA>TCA stop loss is annotated as:
StopLoss(
variant=chr1 g.100484700G>C,
transcript_name=Cntnap5b-001,
transcript_id=ENSMUST00000086738,
effect_description=p.*1293S (stop-loss))
aa_ref = "*"
aa_alt = "S"
aa_alt should be further extended into the UTR resulting in:
STIVWSSGPLFCRGFHLFFFSFF
##fileformat=VCFv4.1
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT
chr1 100484699 . TG TC 5000 . . .
"""
variant = Variant("chr1", 100484699, "TG", "TC", "GRCm38")
expect_effect(
variant,
transcript_id="ENSMUST00000086738",
effect_class=StopLoss,
aa_alt="STIVWSSGPLFCRGFHLFFFSFF")
def test_issue_171_insertion_into_stop_codon():
"""
Issue: https://github.com/hammerlab/varcode/issues/171
Test using genome GRCm38, on transcript ENSMUST00000086738
Insertion before the stop codon: T_GA -> T_CC T_GA
This is annotated as:
StopLoss(
variant=chr1 g.100484699_100484700insCCT,
transcript_name=Cntnap5b-001,
transcript_id=ENSMUST00000086738,
effect_description=p.*1293S (stop-loss))
This should just be a clean insertion.
##fileformat=VCFv4.1
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT
chr1 100484699 . T TCCT 5000 . . .
"""
variant = Variant("chr1", 100484699, "T", "TCCT", "GRCm38")
expect_effect(
variant,
effect_class=Insertion,
aa_ref="",
aa_alt="S")
def test_issue172_insertion_after_stop_codon():
"""
Issue: https://github.com/hammerlab/varcode/issues/172
Insertion immediately after the stop codon
TGA ACT ATT -> TGA CAG CAG ACT ATT...
##fileformat=VCFv4.1
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT
chr1 100484701 . A ACAGCAG 5000 . . .
"""
variant = Variant("chr1", 100484701, "A", "ACAGCAG", ensembl="GRCm38")
expect_effect(
variant=variant,
effect_class=Silent)
def test_issue174_wrong_aa_ref_for_insertion_of_stop_codon():
"""
Issue: https://github.com/hammerlab/varcode/issues/174
chr1 99772782 . A ATGA 5000 . . .
PrematureStop (OK)
* aa_mutation_start_offset = 6 (OK)
* aa_mutation_end_offset = 6 (OK)
* aa_ref = "L" (FAIL, just insertion, ref should be empty)
* aa_alt = ""
"""
variant = Variant("chr1", 99772782, "A", "ATGA", "GRCm38")
expect_effect(
variant=variant,
effect_class=PrematureStop,
aa_ref="",
aa_alt="")
def test_issue175_wrong_end_offset_for_insertion_with_stop_codon():
"""
Issue: https://github.com/hammerlab/varcode/issues/175
chr1 99772782 . A ACCCTGA 5000 .
# Annotated as
PrematureStop (OK)
* aa_mutation_start_offset = 6 (OK)
* aa_mutation_end_offset = 7 (FAIL, should be 6)
* aa_ref = "L" (FAIL, just insertion, ref should be empty)
* aa_alt = "P"
---
After some thought I disagree with the bug report's interpretation of
aa_mutation_end_offset. I think that these offsets should indicate the
offsets of mutated amino acids in the mutated protein sequence.
Thus the aa_mutation_end_offset=7 should stay as it is.
"""
variant = Variant("chr1", 99772782, "A", "ACCCTGA", "GRCm38")
expect_effect(
variant=variant,
effect_class=PrematureStop,
aa_ref="",
aa_alt="P",
aa_mutation_start_offset=6,
aa_mutation_end_offset=7)
def test_issue176_substitution_before_stop_codon():
"""
Issue: https://github.com/hammerlab/varcode/issues/176
##fileformat=VCFv4.1
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT
# SNP before the stop codon of transcript ENSMUST00000086738
# ATC TGA -> ACC TGA {I -> T}
chr1 100484697 . T C 5000 . . .
This is annotated as a StopLoss. It's a Substitution. VEP gets it right.
"""
variant = Variant("chr1", 100484697, "T", "C", "GRCm38")
expect_effect(
variant=variant,
transcript_id="ENSMUST00000086738",
effect_class=Substitution,
aa_ref="I",
aa_alt="T")
def test_issue193_SNV_stop_gain_in_ZNF45_not_deletion():
"""
Issue: https://github.com/hammerlab/varcode/issues/193
SNV chr19:44417544 G>A was being incorrectly annotated as Deletion
"""
variant = Variant('19', 44417544, 'G', 'A', 'GRCh37')
expect_effect(
variant,
effect_class=PrematureStop,
modifies_coding_sequence=True,
modifies_protein_sequence=True)
def test_issue202_stoploss_deletes_two_amino_acids():
"""
Issue: https://github.com/hammerlab/varcode/issues/202
Variant: chr1 100484693 . TTCATCTGA CCC
Transcript: ENSMUST00000086738
>>>
The end of that transcript looks like:
TTC ATC TGA ACT
F I * T
and this mutation will cause the location plus downstream to become
PTIVWSSGPLF(...)
The annotation that varcode gives is
StopLoss
* aa_mutation_start_offset = 1292
* aa_ref="*"
* aa_alt="PTIVWSS(...)"
It should actually be
StopLoss
* aa_mutation_start_offset = 1290
* aa_ref="FI*"
* aa_alt="PTIVWSS(...)"
"""
variant = Variant('chr1', 100484693, 'TTCATCTGA', 'CCC', 'GRCm38')
expect_effect(
variant,
transcript_id='ENSMUST00000086738',
effect_class=StopLoss,
modifies_coding_sequence=True,
modifies_protein_sequence=True,
aa_ref='FI',
aa_alt='PTIVWSSGPLFCRGFHLFFFSFF')