From f01859800f1e10257211af6908a4182dd1fcaad4 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 19 Oct 2023 08:17:56 +0200 Subject: [PATCH 1/4] https://github.com/monarch-initiative/genophenocorr/issues/81 --- src/genophenocorr/preprocessing/_vep.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/genophenocorr/preprocessing/_vep.py b/src/genophenocorr/preprocessing/_vep.py index af254762a..51a023eb2 100644 --- a/src/genophenocorr/preprocessing/_vep.py +++ b/src/genophenocorr/preprocessing/_vep.py @@ -122,7 +122,7 @@ def _query_vep(self, variant_coordinates) -> 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): From be57c45c4feec7b5290a4b673a580dfaa9444993 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 19 Oct 2023 10:05:51 +0200 Subject: [PATCH 2/4] deleting erroneous phenopacket --- .../PMID_35190816_STX_23708187_T23289.json | 123 ------------------ 1 file changed, 123 deletions(-) delete mode 100644 notebooks/STXBP1/input/PMID_35190816_STX_23708187_T23289.json diff --git a/notebooks/STXBP1/input/PMID_35190816_STX_23708187_T23289.json b/notebooks/STXBP1/input/PMID_35190816_STX_23708187_T23289.json deleted file mode 100644 index a07582856..000000000 --- a/notebooks/STXBP1/input/PMID_35190816_STX_23708187_T23289.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "id": "STX_23708187_T23289", - "subject": { - "id": "STX_23708187_T23289" - }, - "phenotypicFeatures": [ - { - "type": { - "id": "HP:0200134", - "label": "Epileptic encephalopathy" - } - }, - { - "type": { - "id": "HP:0001250", - "label": "Seizures" - } - } - ], - "interpretations": [ - { - "id": "STX_23708187_T23289", - "progressStatus": "SOLVED", - "diagnosis": { - "disease": { - "id": "OMIM:602926e", - "label": "Other DEE" - }, - "genomicInterpretations": [ - { - "subjectOrBiosampleId": "STX_23708187_T23289", - "interpretationStatus": "CAUSATIVE", - "variantInterpretation": { - "variationDescriptor": { - "id": "var_SkmnLditqzivDQKXPCZKaeEmI", - "geneContext": { - "valueId": "HGNC:11444", - "symbol": "STXBP1" - }, - "expressions": [ - { - "syntax": "hgvs.c", - "value": "NM_003165.6:c.1708=" - }, - { - "syntax": "hgvs.g", - "value": "NC_000009.12:g.127684373=" - } - ], - "vcfRecord": { - "genomeAssembly": "hg38", - "chrom": "chr9", - "pos": "127684373", - "ref": "A", - "alt": "A" - }, - "moleculeContext": "genomic", - "allelicState": { - "id": "GENO:0000135", - "label": "heterozygous" - } - } - } - } - ] - } - } - ], - "metaData": { - "created": "2023-10-02T22:26:06.164090871Z", - "createdBy": "ORCID:0000-0002-0736-9199", - "resources": [ - { - "id": "geno", - "name": "Genotype Ontology", - "url": "http://purl.obolibrary.org/obo/geno.owl", - "version": "2022-03-05", - "namespacePrefix": "GENO", - "iriPrefix": "http://purl.obolibrary.org/obo/GENO_" - }, - { - "id": "hgnc", - "name": "HUGO Gene Nomenclature Committee", - "url": "https://www.genenames.org", - "version": "06/01/23", - "namespacePrefix": "HGNC", - "iriPrefix": "https://www.genenames.org/data/gene-symbol-report/#!/hgnc_id/" - }, - { - "id": "omim", - "name": "An Online Catalog of Human Genes and Genetic Disorders", - "url": "https://www.omim.org", - "version": "January 4, 2023", - "namespacePrefix": "OMIM", - "iriPrefix": "https://www.omim.org/entry/" - }, - { - "id": "so", - "name": "Sequence types and features ontology", - "url": "http://purl.obolibrary.org/obo/so.obo", - "version": "2021-11-22", - "namespacePrefix": "SO", - "iriPrefix": "http://purl.obolibrary.org/obo/SO_" - }, - { - "id": "hp", - "name": "human phenotype ontology", - "url": "http://purl.obolibrary.org/obo/hp.owl", - "version": "2023-09-01", - "namespacePrefix": "HP", - "iriPrefix": "http://purl.obolibrary.org/obo/HP_" - } - ], - "phenopacketSchemaVersion": "2.0", - "externalReferences": [ - { - "id": "PMID:35190816", - "reference": "https://pubmed.ncbi.nlm.nih.gov/35190816", - "description": "Assessing the landscape of STXBP1-related disorders in 534 individuals" - } - ] - } -} \ No newline at end of file From 3ab0f5527123a5a2e2bc7122a5b3cbd270ce8470 Mon Sep 17 00:00:00 2001 From: Daniel Danis Date: Thu, 19 Oct 2023 09:16:52 -0400 Subject: [PATCH 3/4] Add type annotation. --- src/genophenocorr/preprocessing/_vep.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/genophenocorr/preprocessing/_vep.py b/src/genophenocorr/preprocessing/_vep.py index 51a023eb2..787b0de44 100644 --- a/src/genophenocorr/preprocessing/_vep.py +++ b/src/genophenocorr/preprocessing/_vep.py @@ -118,7 +118,7 @@ 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: From fdbcab49f774b4f42ae68c5329b3107978eade77 Mon Sep 17 00:00:00 2001 From: Daniel Danis Date: Thu, 19 Oct 2023 09:18:00 -0400 Subject: [PATCH 4/4] Fix __eq__ and __str__ in `VariantCoordinates`. --- src/genophenocorr/model/_variant.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/genophenocorr/model/_variant.py b/src/genophenocorr/model/_variant.py index 5c202d1a8..6f711d675 100644 --- a/src/genophenocorr/model/_variant.py +++ b/src/genophenocorr/model/_variant.py @@ -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):