diff options
author | Zachary Sloan | 2012-08-28 16:05:09 -0500 |
---|---|---|
committer | Zachary Sloan | 2012-08-28 16:05:09 -0500 |
commit | 4cc46d84810ca9492e9a38e1a1f88ab36d214791 (patch) | |
tree | 3b67781f4fc241ca9e95bee0d0f2170463edf4a9 /wqflask/base/webqtlCaseData.py | |
parent | 31aa6fb32e4ae4af18e177a3777a19bbde3e063d (diff) | |
download | genenetwork2-4cc46d84810ca9492e9a38e1a1f88ab36d214791.tar.gz |
Various changes related to the webqtlCaseData object and the way values/variances/num_cases are called in DataEditingPage.py
Diffstat (limited to 'wqflask/base/webqtlCaseData.py')
-rwxr-xr-x | wqflask/base/webqtlCaseData.py | 69 |
1 files changed, 50 insertions, 19 deletions
diff --git a/wqflask/base/webqtlCaseData.py b/wqflask/base/webqtlCaseData.py index f68354be..7805df06 100755 --- a/wqflask/base/webqtlCaseData.py +++ b/wqflask/base/webqtlCaseData.py @@ -24,28 +24,59 @@ # # Last updated by GeneNetwork Core Team 2010/10/20 -class webqtlCaseData: - """ - one case data in one trait - """ +print("Mr. Mojo Risin 2") - val = None #Trait Value - var = None #Trait Variance - N = None #Number of individuals +class webqtlCaseData(object): + """one case data in one trait + + """ - def __init__(self, val=val, var=var, N=N): - self.val = val - self.var = var - self.N = N + def __init__(self, name, value=None, variance=None, num_cases=None): + self.name = name + self.value = value # Trait Value + self.variance = variance # Trait Variance + self.num_cases = num_cases # Number of individuals/cases + self.this_id = None # Set a sane default (can't be just "id" cause that's a reserved word) - def __str__(self): + def __repr__(self): str = "" - if self.val != None: - str += "value=%2.3f" % self.val - if self.var != None: - str += " variance=%2.3f" % self.var - if self.N != None: - str += " ndata=%d" % self.N + if self.value != None: + str += "value=%2.3f" % self.value + if self.variance != None: + str += " variance=%2.3f" % self.variance + if self.num_cases != None: + str += " ndata=%d" % self.num_cases return str + + @property + def display_value(self): + if self.value: + return "%2.3f" % self.value + else: + return "x" + + @property + def display_variance(self): + if self.variance: + return "%2.3f" % self.variance + else: + return "x" + + + #try: + # traitVar = thisvar + # dispVar = "%2.3f" % thisvar + #except: + # traitVar = '' + # dispVar = 'x' + + #try: + # traitVal = thisval + # dispVal = "%2.3f" % thisval + #except: + # traitVal = '' + # dispVal = 'x' + - __repr__ = __str__ + #def this_val_full(self): + # strain_name =
\ No newline at end of file |