本文整理匯總了Python中CGAT.Stats.adjustPValues方法的典型用法代碼示例。如果您正苦於以下問題:Python Stats.adjustPValues方法的具體用法?Python Stats.adjustPValues怎麽用?Python Stats.adjustPValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CGAT.Stats
的用法示例。
在下文中一共展示了Stats.adjustPValues方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: check
# 需要導入模塊: from CGAT import Stats [as 別名]
# 或者: from CGAT.Stats import adjustPValues [as 別名]
def check(self, method):
'''check for length equality and elementwise equality.'''
a = R['p.adjust'](self.pvalues, method=method)
b = Stats.adjustPValues(self.pvalues, method=method)
self.assertEqual(len(a), len(b))
for x, y in zip(a, b):
self.assertAlmostEqual(x, y)
示例2: main
# 需要導入模塊: from CGAT import Stats [as 別名]
# 或者: from CGAT.Stats import adjustPValues [as 別名]
#.........這裏部分代碼省略.........
elif method in ("lower-bound", "upper-bound"):
boundary = float(options.parameters[0])
del options.parameters[0]
new_value = float(options.parameters[0])
del options.parameters[0]
if method == "upper-bound":
for c in options.columns:
for r in range(nrows):
if isinstance(table[c][r], float) and \
table[c][r] > boundary:
table[c][r] = new_value
else:
for c in options.columns:
for r in range(nrows):
if isinstance(table[c][r], float) and \
table[c][r] < boundary:
table[c][r] = new_value
elif method == "fdr":
pvalues = []
for c in options.columns:
pvalues.extend(table[c])
assert max(pvalues) <= 1.0, "pvalues > 1 in table: max=%s" % str(
max(pvalues))
assert min(pvalues) >= 0, "pvalue < 0 in table: min=%s" % str(
min(pvalues))
# convert to str to avoid test for float downstream
qvalues = map(
str, Stats.adjustPValues(pvalues, method=options.fdr_method))
if options.fdr_add_column is None:
x = 0
for c in options.columns:
table[c] = qvalues[x:x + nrows]
x += nrows
else:
# add new column headers
if len(options.columns) == 1:
fields.append(options.fdr_add_column)
else:
for co in options.columns:
fields.append(options.fdr_add_column + fields[c])
x = 0
for c in options.columns:
# add a new column
table.append(qvalues[x:x + nrows])
x += nrows
ncols += len(options.columns)
elif method == "normalize-by-table":
other_table_name = options.parameters[0]
del options.parameters[0]
other_fields, other_table = CSV.ReadTable(
open(other_table_name, "r"),
with_header=options.has_headers,
as_rows=False)
# convert all values to float
示例3: range
# 需要導入模塊: from CGAT import Stats [as 別名]
# 或者: from CGAT.Stats import adjustPValues [as 別名]
else:
for c in options.columns:
for r in range(nrows):
if type(table[c][r]) == types.FloatType and \
table[c][r] < boundary:
table[c][r] = new_value
elif method == "fdr":
pvalues = []
for c in options.columns: pvalues.extend( table[c] )
assert max(pvalues) <= 1.0, "pvalues > 1 in table"
assert min(pvalues) >= 0, "pvalue < 0 in table"
# convert to str to avoid test for float downstream
qvalues = map(str, Stats.adjustPValues( pvalues, method = options.fdr_method ))
x = 0
for c in options.columns:
table[c] = qvalues[x:x+nrows]
x += nrows
elif method == "normalize-by-table":
other_table_name = options.parameters[0]
del options.parameters[0]
other_fields, other_table = CSV.ReadTable( open(other_table_name, "r"), with_header = options.has_headers, as_rows = False )
# convert all values to float
for c in options.columns:
for r in range(nrows):