本文整理汇总了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):