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
|
"""module contains all operating related to traits"""
def compute_sum(rhs_val: int, lhs_val: int) -> int:
"""initial function for trait module"""
return rhs_val + lhs_val
def fetch_trait(dataset, trait_name: str) -> dict:
"""this method creates a trait by\
fetching required data given the\
dataset and trait_name"""
created_trait = {
"dataset": dataset,
"trait_name": trait_name
}
trait_data = get_trait_sample_data(dataset, trait_name)
created_trait["trait_data"] = trait_data
return created_trait
def get_trait_sample_data(trait_dataset, trait_name) -> dict:
"""first try to fetch the traits sample data from redis if that\
try to fetch from the traits dataset redis is only used for\
temp dataset type which is not used in this case """
sample_results = trait_dataset.retrieve_sample_data(trait_name)
trait_data = {}
for (name, sample_value, _variance, _numcase, _name2) in sample_results:
trait_data[name] = sample_value
return trait_data
def get_trait_info_data(trait_dataset,
trait_name: str,
database_instance,
get_qtl_info: bool = False) -> dict:
"""given a dataset and trait_name return a dict containing all info\
regarding the get trait"""
_temp_var_holder = (trait_dataset, trait_name,
database_instance, get_qtl_info)
trait_info_data = {
"description": "",
"chr": "",
"locus": "",
"mb": "",
"abbreviation": "",
"trait_display_name": ""
}
return trait_info_data
|