forked from molgenis/VaSeBuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompound_context.py
82 lines (70 loc) · 2.48 KB
/
compound_context.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
"""Object to store linked context."""
class CompoundContext:
"""Stores information about linked variant contexts."""
def __init__(self, first_varcon, second_varcon):
self.variant_contexts = [first_varcon, second_varcon]
self.priority_level = 64
self.priority_label = ""
def get_variant_contexts(self):
"""Return the variant contexts forming a compound context.
Returns
-------
self.variant_contexts : list of VariantContext
Variant contexts forming a
"""
return self.variant_contexts
def get_num_of_variant_contexts(self):
"""Return the number of variant contexts forming a compound context.
Returns
-------
int
The number of variant contexts forming a compound context
"""
return len(self.variant_contexts)
def add_variant_context(self, varcon_toadd):
"""Add a provided VariantContext to the compound context.
Parameters
----------
varcon_toadd : VariantContext
self.variant_contexts.append(varcon_toadd)
"""
if varcon_toadd is not None:
self.variant_contexts.append(varcon_toadd)
def add_variant_contexts(self, varcons_to_add):
"""Add a list of variant contexts to a compound context.
Parameters
----------
varcons_to_add : list of VariantContext
List of variant contexts to add to the compound
"""
if varcons_to_add is not None:
varcons_to_add = [varcon for varcon in varcons_to_add if varcon]
if len(varcons_to_add) >= 1:
self.variant_contexts.extend(varcons_to_add)
# TODO:
# =============================================================================
# def determine_priority_level(self):
# """WIP."""
# print("test")
#
# def remove_variant_context(self):
# """WIP."""
# print("test")
#
#
# def get_variant_context_index(self, variant_context):
# """Determine and return the index in the list of variant contexts.
#
# This can be used to remove the proper variant context from the compound context.
#
# Parameters
# ----------
# variant_context : VariantContext
#
# Returns
# -------
# int
# Index position in list of variant contexts
# """
# print("test")
# =============================================================================