Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
assert hgnc_name is not None
# See if we can get a Uniprot ID from the HGNC symbol--if there is
# a RefSeq ID we wil also try to use it to get an isoform specific
# UP ID, but we will have this one to fall back on. But if we can't
# get one here, then we skip the Statement
up_id_from_hgnc = hgnc_client.get_uniprot_id(hgnc_id)
if not up_id_from_hgnc:
self.no_up_for_hgnc.append((egid, hgnc_name, hgnc_id))
return None
# If we have provided the RefSeq ID, it's because we need to make
# sure that we are getting the right isoform-specific ID (for sequence
# positions of PTMs). Here we try to get the Uniprot ID from the
# Refseq->UP mappings in the protmapper.uniprot_client.
if refseq_id is not None:
# Get the Uniprot IDs from the uniprot client
up_ids = uniprot_client.get_ids_from_refseq(refseq_id,
reviewed_only=True)
# Nothing for this RefSeq ID (quite likely because the RefSeq ID
# is obsolete; take the UP ID from HGNC
if len(up_ids) == 0:
self.no_up_for_refseq.append(refseq_id)
up_id = up_id_from_hgnc
# More than one reviewed entry--no thanks, we'll take the one from
# HGNC instead
elif len(up_ids) > 1:
self.many_ups_for_refseq.append(refseq_id)
up_id = up_id_from_hgnc
# We got a unique, reviewed UP entry for the RefSeq ID
else:
up_id = up_ids[0]
# If it's the canonical isoform, strip off the '-1'
if up_id.endswith('-1'):