Skip to content

Commit

Permalink
Merge pull request #82 from monarch-initiative/to_string
Browse files Browse the repository at this point in the history
  • Loading branch information
pnrobinson authored Oct 19, 2023
2 parents 4b7a714 + fdbcab4 commit 7e891cb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 134 deletions.
123 changes: 0 additions & 123 deletions notebooks/STXBP1/input/PMID_35190816_STX_23708187_T23289.json

This file was deleted.

15 changes: 6 additions & 9 deletions src/genophenocorr/model/_variant.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,25 +307,22 @@ def __len__(self):

def __eq__(self, other) -> bool:
return isinstance(other, VariantCoordinates) \
and self.alt == other.alt \
and self.region == other.region \
and self.ref == other.ref \
and self.chrom == other.chrom \
and self.start == other.start \
and self.end == other.end \
and self.alt == other.alt \
and self.change_length == other.change_length

def __hash__(self) -> int:
return hash((self._region, self._ref, self._alt, self._change_length))

def __str__(self) -> str:
return f"VariantCoordinates(chrom={self.chrom}, " \
f"start={self.start}, end={self.end}, " \
return f"VariantCoordinates(region={self.region}, " \
f"ref={self.ref}, alt={self.alt}, " \
f"change_length={self.change_length})"

def __repr__(self) -> str:
return str(self)

def __hash__(self) -> int:
return hash((self._region, self._ref, self._alt, self._change_length))


class VariantCoordinateAware(metaclass=abc.ABCMeta):

Expand Down
4 changes: 2 additions & 2 deletions src/genophenocorr/preprocessing/_vep.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ def _process_item(self, item) -> typing.Optional[TranscriptAnnotation]:
protein_effect_start,
protein_effect_end)

def _query_vep(self, variant_coordinates) -> dict:
def _query_vep(self, variant_coordinates: VariantCoordinates) -> dict:
api_url = self._url % (verify_start_end_coordinates(variant_coordinates))
r = requests.get(api_url, headers={'Content-Type': 'application/json'})
if not r.ok:
self._logging.error(f"Expected a result but got an Error for variant: {variant_coordinates.as_string()}")
self._logging.error(f"Expected a result but got an Error for variant: {variant_coordinates}")
r.raise_for_status()
results = r.json()
if not isinstance(results, list):
Expand Down

0 comments on commit 7e891cb

Please sign in to comment.