From d0792b683b19d039b0e20b8622542248137ab80e Mon Sep 17 00:00:00 2001 From: Christos Kopanos Date: Wed, 11 Apr 2018 16:43:18 +0300 Subject: [PATCH] Fixed cosmic licensed data model and added acmg annotations model --- setup.py | 2 +- varsome_api/models/elements/__init__.py | 1 + varsome_api/models/elements/acmg.py | 42 +++++++++++++++++++++++++ varsome_api/models/elements/sanger.py | 5 ++- varsome_api/models/variant.py | 3 +- 5 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 varsome_api/models/elements/acmg.py diff --git a/setup.py b/setup.py index c599bc5..c77e73f 100755 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ import sys from os import path -VERSION = (1, 0, '0b1') +VERSION = (1, 1, '0b1') __version__ = VERSION __versionstr__ = '.'.join(map(str, VERSION)) diff --git a/varsome_api/models/elements/__init__.py b/varsome_api/models/elements/__init__.py index 276d4c7..b1f5852 100755 --- a/varsome_api/models/elements/__init__.py +++ b/varsome_api/models/elements/__init__.py @@ -15,3 +15,4 @@ from .uniprot import * from .wustl import * from .gwas import * +from .acmg import * diff --git a/varsome_api/models/elements/acmg.py b/varsome_api/models/elements/acmg.py new file mode 100644 index 0000000..7650b8d --- /dev/null +++ b/varsome_api/models/elements/acmg.py @@ -0,0 +1,42 @@ +# Copyright 2018 Saphetor S.A. +# +# 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. + +from jsonmodels import models, fields + +__author__ = "ckopanos" + + +class ACMGClassification(models.Base): + met_criteria = fields.BoolField() + name = fields.StringField(help_text="ACMG Classification Name") + user_explain = fields.ListField(items_types=(str,), help_text="Criteria explanation", required=False, + nullable=True) + + +class ACMGRule(models.Base): + pathogenic_subscore = fields.StringField(required=False, nullable=True) + benign_subscore = fields.StringField(required=False, nullable=True) + verdict = fields.StringField(required=False, nullable=True) + + +class ACMGVerdict(models.Base): + classifications = fields.ListField(items_types=(str,), help_text="Classification names", required=False, + nullable=True) + ACMG_rules = fields.EmbeddedField(ACMGRule) + + +class ACMG(models.Base): + classifications = fields.ListField(required=False, items_types=(ACMGClassification,), + help_text="ACMG Classifications") + verdict = fields.EmbeddedField(ACMGVerdict, nullable=True, required=False, help_text="ACMG Verdict") diff --git a/varsome_api/models/elements/sanger.py b/varsome_api/models/elements/sanger.py index de8a12f..6268da7 100755 --- a/varsome_api/models/elements/sanger.py +++ b/varsome_api/models/elements/sanger.py @@ -40,7 +40,7 @@ class CosmicLicensedDrugEntry(models.Base): class CosmicLicensedDetails(models.Base): entry_type = fields.StringField(help_text="Entry type", required=False, nullable=True) - cosmic_id = fields.ListField(items_types=(str,), help_text="Cosmic ID", required=False, nullable=True) + cosmic_id = fields.ListField(items_types=(str, dict,), help_text="Cosmic ID", required=False, nullable=True) pub_med_references = fields.ListField(items_types=(int,), help_text="PUBMED References", required=False, nullable=True) histology_freq = fields.ListField(items_types=(int, str, float), help_text="Histology frequency", required=False, @@ -84,6 +84,9 @@ class CosmicLicensedDetails(models.Base): class ComsicPublicDetails(models.Base): num_samples = fields.IntField(help_text='Number of samples') id = fields.StringField(help_text='Cosmic ID') + is_consistent = fields.BoolField(help_text='Cosmic ID is consistent across databases') + + class CosmicPublic(models.Base): diff --git a/varsome_api/models/variant.py b/varsome_api/models/variant.py index bdc19a2..fbb02ee 100755 --- a/varsome_api/models/variant.py +++ b/varsome_api/models/variant.py @@ -11,8 +11,6 @@ # 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. - - from .fields import DictField from .elements import * @@ -58,6 +56,7 @@ class AnnotatedVariant(models.Base): uniprot_variants = fields.ListField(required=False, items_types=(UniprotVariants,), help_text="UniProt variants") wustl_civic = fields.ListField(required=False, items_types=(Civic,), help_text="CIViC") gwas = fields.ListField(required=False, items_types=(GWAS,), help_text="GWAS") + acmg_annotation = fields.EmbeddedField(ACMG, required=False, nullable=True, help_text="ACMG Annotations") @property def genes(self):