Skip to content

Commit

Permalink
Merge branch 'master' into SP-3283-improve-the-python-api-client-to-i…
Browse files Browse the repository at this point in the history
…nclude-more-cases
  • Loading branch information
kchatzikok authored Aug 11, 2022
2 parents 9b882b1 + 62fe591 commit 908275b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ To annotate the VCF file with the annotations that you are interested in, you ne
from varsome_api.vcf import VCFAnnotator
from vcf.parser import _Info, _encode_type
class MyVCFAnnotator(VCFAnnotator):


def annotate_record(self, record, variant_result, original_variant):
"""
:param record: vcf record object
Expand Down
3 changes: 3 additions & 0 deletions varsome_api/models/elements/acmg.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ class ACMG(models.Base):
verdict = fields.EmbeddedField(
ACMGVerdict, nullable=True, required=False, help_text="ACMG Verdict"
)
coding_impact = fields.StringField(required=False, nullable=True)
transcript = fields.StringField(required=False, nullable=True)
transcript_reason = fields.StringField(required=False, nullable=True)
9 changes: 7 additions & 2 deletions varsome_api/vcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,17 @@ def annotate(self, input_vcf_file, output_vcf_file=None, template=None, **kwargs
input_batch = OrderedDict()
batch_limit = self.max_variants_per_batch * self.max_threads * 2
for record in reader:
reference_sequence = record.REF
if reference_sequence is None or reference_sequence == ".":
reference_sequence = ""
for alt_seq in record.ALT:
if alt_seq is None or alt_seq == ".":
alt_seq = ""
requested_variant = "%s:%s:%s:%s" % (
record.CHROM,
record.POS,
record.REF or "",
alt_seq or "",
reference_sequence,
alt_seq,
)
input_batch[requested_variant] = record
self.total_variants += 1
Expand Down

0 comments on commit 908275b

Please sign in to comment.