當前位置: 首頁>>代碼示例>>Python>>正文


Python Stats.adjustPValues方法代碼示例

本文整理匯總了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)
開發者ID:lesheng,項目名稱:cgat,代碼行數:9,代碼來源:Stats_test.py

示例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
開發者ID:Charlie-George,項目名稱:cgat,代碼行數:70,代碼來源:table2table.py

示例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):
開發者ID:siping,項目名稱:cgat,代碼行數:33,代碼來源:table2table.py


注:本文中的CGAT.Stats.adjustPValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。