def __init__(self, transaction_list, row_size): fs.FunctionsSuper.__init__(self) self.__t_size = len(transaction_list) # all transaction size self.__f_size = self.sumValue( transaction_list) # transaction size which have flag = 1 (n1) self.__pvalTable = pvalTable.PvalTable(row_size) # P-value table self.__occrTable = pvalTable.PvalTable( row_size) # occurence table for calculate P-value self.calTime = 0 # Total number of calculate P-value if self.__f_size == 0: sys.stdout.write("Error: There is no up-regulate gene.\n") sys.exit() # Check the transaction value. # If the value is not 1 or 0, raise error. # Because fisher's exact test does not handle numerical value. for t in transaction_list: if not (t.value == 1.0 or t.value == 0.0): sys.stderr.write("Error: \"" + t.name + "\" value is " + str(t.value) + ".\n") sys.stderr.write( " But value is 1 or 0 if you test by fisher's exact test.\n" ) sys.exit() # check the support size. # If support size larger than half of all data size, raise error. # Because this version does not treat x > (n1+n0)/2. """
def __init__(self, transaction_list, row_size, alternative): fs.FunctionsSuper.__init__(self) self.__t_size = len(transaction_list) # all transaction size self.__f_size = self.sumValue( transaction_list) # transaction size which have flag = 1 (n1) self.alternative = alternative # alternative hypothesis. greater or less -> 1, two.sided -> 0. self.__pvalTable = pvalTable.PvalTable(row_size) # P-value table self.__chiTable = pvalTable.PvalTable(row_size) # P-value table if self.__f_size == 0: sys.stdout.write("Error: There is no up-regulate gene.\n") sys.exit() # Check the transaction value. # If the value is not 1 or 0, raise error. # Because fisher's exact test does not handle numerical value. for t in transaction_list: if not (t.value == 1.0 or t.value == 0.0): sys.stderr.write("Error: \"" + t.name + "\" value is " + str(t.value) + ".\n") sys.stderr.write( " But value is 1 or 0 if you test by fisher's exact test.\n" ) sys.exit()