Skip to content

Commit

Permalink
reformatted with yapf
Browse files Browse the repository at this point in the history
  • Loading branch information
reece committed Apr 18, 2019
1 parent f6126f6 commit c90359a
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 40 deletions.
1 change: 0 additions & 1 deletion hgvs/dataproviders/seqfetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def fetch_seq(self, ac, start_i=None, end_i=None):
ac=ac, ex=ex, self=self))



# <LICENSE>
# Copyright 2018 HGVS Contributors (https://github.com/biocommons/hgvs)
#
Expand Down
4 changes: 2 additions & 2 deletions hgvs/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ def validate(self):

def __str__(self):
self.validate()
base_str = ("?" if self.base is None else "*" + str(self.base)
if self.datum == Datum.CDS_END else str(self.base))
base_str = ("?"
if self.base is None else "*" + str(self.base) if self.datum == Datum.CDS_END else str(self.base))
offset_str = ("+?" if self.offset is None else "" if self.offset == 0 else "%+d" % self.offset)
pos = base_str + offset_str
return "(" + pos + ")" if self.uncertain else pos
Expand Down
9 changes: 7 additions & 2 deletions hgvs/utils/altseqbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,13 @@ def _create_alt_equals_ref_noncds(self):

def _create_no_protein(self):
"""Create a no-protein result"""
alt_data = AltTranscriptData(
[], None, None, False, None, self._transcript_data.protein_accession, is_ambiguous=False)
alt_data = AltTranscriptData([],
None,
None,
False,
None,
self._transcript_data.protein_accession,
is_ambiguous=False)
return alt_data

def _get_frameshift_start(self, variant_data):
Expand Down
3 changes: 1 addition & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
def parser():
return hgvs.easy.parser


@pytest.fixture(scope="session")
def am38():
return hgvs.easy.am38


141 changes: 117 additions & 24 deletions tests/issues/test_477.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,127 @@
# {"c": "", "g": "", "rs": "" },

# GPHB5, GRCh37 https://www.ncbi.nlm.nih.gov/gene/122876
{"c": "NM_145171.3:c.-63A>G", "g": "NC_000014.8:g.63785599T>C", "rs": "GPHB5/GRCh37/rs1299953722", "ex": HGVSInvalidIntervalError },
{"c": "NM_145171.3:c.-56G>A", "g": "NC_000014.8:g.63785592C>T", "rs": "GPHB5/GRCh37/rs982881702" },
{"c": "NM_145171.3:c.2T>C", "g": "NC_000014.8:g.63784562A>G", "rs": "GPHB5/GRCh37/rs1221379530" },
{"c": "NM_145171.3:c.388A>G", "g": "NC_000014.8:g.63779647T>C", "rs": "GPHB5/GRCh37/rs1380832691" },
{"c": "NM_145171.3:c.*4C>T", "g": "NC_000014.8:g.63779638G>A", "rs": "GPHB5/GRCh37/rs753041439" },
{"c": "NM_145171.3:c.*84A>G", "g": "NC_000014.8:g.63779558T>C", "rs": "GPHB5/GRCh37/rs1204774077" },
{"c": "NM_145171.3:c.*99G>A", "g": "NC_000014.8:g.63779543C>T", "rs": "GPHB5/GRCh37/rs144659601", "ex": HGVSInvalidIntervalError },
{
"c": "NM_145171.3:c.-63A>G",
"g": "NC_000014.8:g.63785599T>C",
"rs": "GPHB5/GRCh37/rs1299953722",
"ex": HGVSInvalidIntervalError
},
{
"c": "NM_145171.3:c.-56G>A",
"g": "NC_000014.8:g.63785592C>T",
"rs": "GPHB5/GRCh37/rs982881702"
},
{
"c": "NM_145171.3:c.2T>C",
"g": "NC_000014.8:g.63784562A>G",
"rs": "GPHB5/GRCh37/rs1221379530"
},
{
"c": "NM_145171.3:c.388A>G",
"g": "NC_000014.8:g.63779647T>C",
"rs": "GPHB5/GRCh37/rs1380832691"
},
{
"c": "NM_145171.3:c.*4C>T",
"g": "NC_000014.8:g.63779638G>A",
"rs": "GPHB5/GRCh37/rs753041439"
},
{
"c": "NM_145171.3:c.*84A>G",
"g": "NC_000014.8:g.63779558T>C",
"rs": "GPHB5/GRCh37/rs1204774077"
},
{
"c": "NM_145171.3:c.*99G>A",
"g": "NC_000014.8:g.63779543C>T",
"rs": "GPHB5/GRCh37/rs144659601",
"ex": HGVSInvalidIntervalError
},

# GPHB5, GRCh37 https://www.ncbi.nlm.nih.gov/gene/122876
{"c": "NM_145171.3:c.-63A>G", "g": "NC_000014.9:g.63318885T>C", "rs": "GPHB5/GRCh38/rs1299953722", "ex": HGVSInvalidIntervalError },
{"c": "NM_145171.3:c.-56G>A", "g": "NC_000014.9:g.63318878C>T", "rs": "GPHB5/GRCh38/rs982881702" },
{"c": "NM_145171.3:c.2T>C", "g": "NC_000014.9:g.63317848A>G", "rs": "GPHB5/GRCh38/rs1221379530" },
{"c": "NM_145171.3:c.388A>G", "g": "NC_000014.9:g.63312933T>C", "rs": "GPHB5/GRCh38/rs1380832691" },
{"c": "NM_145171.3:c.*4C>T", "g": "NC_000014.9:g.63312924G>A", "rs": "GPHB5/GRCh38/rs753041439" },
{"c": "NM_145171.3:c.*84A>G", "g": "NC_000014.9:g.63312844T>C", "rs": "GPHB5/GRCh38/rs1204774077" },
{"c": "NM_145171.3:c.*99G>A", "g": "NC_000014.9:g.63312829C>T", "rs": "GPHB5/GRCh38/rs144659601", "ex": HGVSInvalidIntervalError },
{
"c": "NM_145171.3:c.-63A>G",
"g": "NC_000014.9:g.63318885T>C",
"rs": "GPHB5/GRCh38/rs1299953722",
"ex": HGVSInvalidIntervalError
},
{
"c": "NM_145171.3:c.-56G>A",
"g": "NC_000014.9:g.63318878C>T",
"rs": "GPHB5/GRCh38/rs982881702"
},
{
"c": "NM_145171.3:c.2T>C",
"g": "NC_000014.9:g.63317848A>G",
"rs": "GPHB5/GRCh38/rs1221379530"
},
{
"c": "NM_145171.3:c.388A>G",
"g": "NC_000014.9:g.63312933T>C",
"rs": "GPHB5/GRCh38/rs1380832691"
},
{
"c": "NM_145171.3:c.*4C>T",
"g": "NC_000014.9:g.63312924G>A",
"rs": "GPHB5/GRCh38/rs753041439"
},
{
"c": "NM_145171.3:c.*84A>G",
"g": "NC_000014.9:g.63312844T>C",
"rs": "GPHB5/GRCh38/rs1204774077"
},
{
"c": "NM_145171.3:c.*99G>A",
"g": "NC_000014.9:g.63312829C>T",
"rs": "GPHB5/GRCh38/rs144659601",
"ex": HGVSInvalidIntervalError
},

# COX6A2 https://www.ncbi.nlm.nih.gov/gene/1339
{"c": "NM_005205.3:c.-106G>A", "g": "NC_000016.10:g.31428431C>T", "rs": "COX6A2/GRCh38/rs1033792906", "ex": HGVSInvalidIntervalError },
{"c": "NM_005205.3:c.-96C>T", "g": "NC_000016.10:g.31428421G>A", "rs": "COX6A2/GRCh38/rs755670336" },
{"c": "NM_005205.3:c.2T>C", "g": "NC_000016.10:g.31428324A>G", "rs": "COX6A2/GRCh38/rs200780049" },
{"c": "NM_005205.3:c.293G>A", "g": "NC_000016.10:g.31427775C>T", "rs": "COX6A2/GRCh38/rs764753905" },
{"c": "NM_005205.3:c.*3C>T", "g": "NC_000016.10:g.31427771G>A", "rs": "COX6A2/GRCh38/rs909673485" },
{"c": "NM_005205.3:c.*42G>C", "g": "NC_000016.10:g.31427732C>G", "rs": "COX6A2/GRCh38/rs375688325" },
{"c": "NM_005205.3:c.*43A>G", "g": "NC_000016.10:g.31427731T>C", "rs": "COX6A2/GRCh38/rs961248971" },
{"c": "NM_005205.3:c.*44G>A", "g": "NC_000016.10:g.31427730C>T", "rs": "COX6A2/GRCh38/rs756406653", "ex": HGVSInvalidIntervalError },

)
{
"c": "NM_005205.3:c.-106G>A",
"g": "NC_000016.10:g.31428431C>T",
"rs": "COX6A2/GRCh38/rs1033792906",
"ex": HGVSInvalidIntervalError
},
{
"c": "NM_005205.3:c.-96C>T",
"g": "NC_000016.10:g.31428421G>A",
"rs": "COX6A2/GRCh38/rs755670336"
},
{
"c": "NM_005205.3:c.2T>C",
"g": "NC_000016.10:g.31428324A>G",
"rs": "COX6A2/GRCh38/rs200780049"
},
{
"c": "NM_005205.3:c.293G>A",
"g": "NC_000016.10:g.31427775C>T",
"rs": "COX6A2/GRCh38/rs764753905"
},
{
"c": "NM_005205.3:c.*3C>T",
"g": "NC_000016.10:g.31427771G>A",
"rs": "COX6A2/GRCh38/rs909673485"
},
{
"c": "NM_005205.3:c.*42G>C",
"g": "NC_000016.10:g.31427732C>G",
"rs": "COX6A2/GRCh38/rs375688325"
},
{
"c": "NM_005205.3:c.*43A>G",
"g": "NC_000016.10:g.31427731T>C",
"rs": "COX6A2/GRCh38/rs961248971"
},
{
"c": "NM_005205.3:c.*44G>A",
"g": "NC_000016.10:g.31427730C>T",
"rs": "COX6A2/GRCh38/rs756406653",
"ex": HGVSInvalidIntervalError
},
)


@pytest.mark.parametrize("pair", tests, ids=[p["rs"] for p in tests])
Expand Down
3 changes: 1 addition & 2 deletions tests/test_hgvs_assemblymapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_projection_at_alignment_discrepancy(self):
var_g = self.am37.c_to_g(var_c)

self.assertEqual(str(var_g), hgvs_g)

def test_c_to_p_with_stop_gain(self):
# issue-474
hgvs_c = "NM_080877.2:c.1733_1735delinsTTT"
Expand Down Expand Up @@ -200,7 +200,6 @@ def test_c_to_p_with_stop_gain(self):
self.assertEqual(str(var_p), hgvs_p)



class Test_RefReplacement(unittest.TestCase):
test_cases = [
# These casese attempt to test reference update in four dimensions:
Expand Down
6 changes: 2 additions & 4 deletions tests/test_hgvs_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ def test_parser_gauntlet(self):
if var.startswith("#") or var == "":
continue
v = self.parser.parse_hgvs_variant(var)
self.assertEqual(
var,
v.format(conf={'max_ref_length': None}),
"parse-format roundtrip failed:" + pprint.pformat(v.posedit))
self.assertEqual(var, v.format(conf={'max_ref_length': None}),
"parse-format roundtrip failed:" + pprint.pformat(v.posedit))

@pytest.mark.quick
def test_parser_reject(self):
Expand Down
3 changes: 1 addition & 2 deletions tests/test_hgvs_variantmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ def test_map_of_dup_at_cds_end(self):
def test_map_of_c_out_of_reference_bound(self):
hgvs_c = "NM_000249.3:c.-73960_*46597del"
var_c = self.hp.parse_hgvs_variant(hgvs_c)
with pytest.raises(HGVSError,
match='coordinate is outside the bounds'):
with pytest.raises(HGVSError, match='coordinate is outside the bounds'):
self.vm.c_to_p(var_c)


Expand Down
1 change: 0 additions & 1 deletion tests/test_issues_05xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def setUp(self):
self.hdp, replace_reference=True, assembly_name='GRCh38', alt_aln_method='splign')
self.vn = hgvs.normalizer.Normalizer(self.hdp, shuffle_direction=3, cross_boundaries=True)


def test_525(self):
"""https://github.com/biocommons/hgvs/issues/525"""

Expand Down

0 comments on commit c90359a

Please sign in to comment.