Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit 94163f0

Browse files
Alan Rubinfowler-mavedb
authored andcommitted
Removed incorrect HGVS validation and removed internal accessions from variant model.
1 parent 6e37304 commit 94163f0

File tree

2 files changed

+28
-27
lines changed

2 files changed

+28
-27
lines changed

scoreset/models.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ class Meta:
390390
# Methods
391391
# ---------------------------------------------------------------------- #
392392
def __str__(self):
393-
return str(self.accession)
393+
return 'ID: {}, HGVS: {}'.format(str(self.pk), str(self.hgvs))
394394

395395
@property
396396
def scores_columns(self):
@@ -413,18 +413,18 @@ def get_ordered_counts_data(self):
413413
def save(self, *args, **kwargs):
414414
with transaction.atomic():
415415
super(Variant, self).save(*args, **kwargs)
416-
if not self.accession:
417-
parent = self.scoreset
418-
digit_suffix = parent.next_variant_suffix()
419-
accession = '{}.{}'.format(
420-
parent.accession.replace(
421-
parent.ACCESSION_PREFIX, self.ACCESSION_PREFIX),
422-
digit_suffix
423-
)
424-
parent.last_used_suffix = digit_suffix
425-
parent.save()
426-
self.accession = accession
427-
self.save()
416+
# if not self.accession:
417+
# parent = self.scoreset
418+
# digit_suffix = parent.next_variant_suffix()
419+
# accession = '{}.{}'.format(
420+
# parent.accession.replace(
421+
# parent.ACCESSION_PREFIX, self.ACCESSION_PREFIX),
422+
# digit_suffix
423+
# )
424+
# parent.last_used_suffix = digit_suffix
425+
# parent.save()
426+
# self.accession = accession
427+
# self.save()
428428

429429

430430
@receiver(post_save, sender=ScoreSet)

scoreset/validators.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,21 @@ def valid_var_accession(accession):
5858

5959

6060
def valid_hgvs_string(string):
61-
variants = [v.strip() for v in string.strip().split(',')]
62-
63-
protein_matches = all([re_protein.match(v) for v in variants])
64-
nucleotide_matches = all([re_nucleotide.match(v) for v in variants])
65-
coding_matches = all([re_coding.match(v) for v in variants])
66-
noncoding_matches = all([re_noncoding.match(v) for v in variants])
67-
wt_or_sy = all([v in ["_wt", "_sy"] for v in variants])
68-
69-
if not (protein_matches or nucleotide_matches or
70-
coding_matches or noncoding_matches or wt_or_sy):
71-
raise ValidationError(
72-
_("Variant '%(variant)s' is not a valid HGVS string."),
73-
params={'variant': string}
74-
)
61+
# variants = [v.strip() for v in string.strip().split(',')]
62+
#
63+
# protein_matches = all([re_protein.match(v) for v in variants])
64+
# nucleotide_matches = all([re_nucleotide.match(v) for v in variants])
65+
# coding_matches = all([re_coding.match(v) for v in variants])
66+
# noncoding_matches = all([re_noncoding.match(v) for v in variants])
67+
# wt_or_sy = all([v in ["_wt", "_sy"] for v in variants])
68+
#
69+
# if not (protein_matches or nucleotide_matches or
70+
# coding_matches or noncoding_matches or wt_or_sy):
71+
# raise ValidationError(
72+
# _("Variant '%(variant)s' is not a valid HGVS string."),
73+
# params={'variant': string}
74+
# )
75+
return
7576

7677

7778
def valid_scoreset_score_data_input(file):

0 commit comments

Comments
 (0)