PyOVERCAST 1.0.13__tar.gz → 1.0.14__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyOVERCAST
3
- Version: 1.0.13
3
+ Version: 1.0.14
4
4
  Summary: A Python package for mining key transcription factors from transcriptome data.
5
5
  Author-email: Tinghua Huang <thua45@126.com>
6
6
  License-Expression: MIT
@@ -14,6 +14,7 @@ plt.rcParams['axes.unicode_minus'] = False # 解决负号显示问题
14
14
  import multiprocessing as mp
15
15
  import seaborn as sns
16
16
  from scipy import stats
17
+ from scipy.stats import false_discovery_control
17
18
  import random
18
19
 
19
20
  overcast_data_dir = './OVERCAST_data'
@@ -104,7 +105,7 @@ def Z_to_frame(Z):
104
105
  return df
105
106
 
106
107
  def compute_dtci_core(df, x_col='x', y_col='y', z_col='z',
107
- c=1.0, alpha=1.0, beta_w=0.5, gamma=1.0):
108
+ c=1.0, alpha=1.0, beta_w=0.5, gamma=1.0, m=2.0):
108
109
  """
109
110
  核心DTCI计算 —— 使用 statsmodels.OLS
110
111
 
@@ -127,6 +128,7 @@ def compute_dtci_core(df, x_col='x', y_col='y', z_col='z',
127
128
  # 使用 statsmodels.OLS(自动处理常数项、标准误和p值)
128
129
  X_design = sm.add_constant(pd.DataFrame({'x': x, 'y': y, 'xy': xy}))
129
130
  model = sm.OLS(z, X_design).fit()
131
+ rmse = np.sqrt(model.mse_resid)
130
132
 
131
133
  # 提取系数 [const, x, y, xy]
132
134
  beta_hat = model.params.values
@@ -143,7 +145,16 @@ def compute_dtci_core(df, x_col='x', y_col='y', z_col='z',
143
145
  z_std = np.std(z, ddof=1)
144
146
 
145
147
  # 子指标
146
- DI = np.abs(beta3) / (np.abs(beta3) + c * z_std)
148
+ # DI = np.abs(beta3) / (np.abs(beta3) + c * z_std)
149
+ # RI: 翘起深度指数 —— 修正版 v4.0
150
+ # 信噪比 = 超额高度 / 纯噪声(残差标准差)
151
+ # SNR = h_diff / rmse if rmse > 1e-10 else 0.0
152
+ SNR = np.abs(beta3) / rmse if rmse > 1e-10 else 0.0
153
+ # Sigmoid 映射:SNR=m 时 RI=0.5,SNR 越大 RI 越接近1
154
+ if SNR > 0:
155
+ DI = 1.0 / (1.0 + np.exp(m - SNR))
156
+ else:
157
+ DI = 0.0
147
158
  SI = min(1.0, -np.log10(max(p_values[3], 1e-10)) / 10.0)
148
159
  QI = max(0.0, R2_adj)
149
160
 
@@ -706,6 +717,8 @@ def olcr_bootstrap(set_names=None, list_file=None, win=30, thread_n=16, bs_n=200
706
717
  results.append(rline)
707
718
  col_names = ['TF_motif', 'Beta3', 'Beta3_Pvalue', 'DTCI', 'DTCI_Pvalue', 'Rank_Score', 'Rank / N']
708
719
  df = pd.DataFrame(results, columns=col_names)
720
+ fdr = false_discovery_control(df['DTCI_Pvalue'], method='bh')
721
+ df.insert(loc=5, column='DTCI_FDR', value=fdr)
709
722
 
710
723
  return df
711
724
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyOVERCAST
3
- Version: 1.0.13
3
+ Version: 1.0.14
4
4
  Summary: A Python package for mining key transcription factors from transcriptome data.
5
5
  Author-email: Tinghua Huang <thua45@126.com>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "PyOVERCAST"
7
- version = "1.0.13"
7
+ version = "1.0.14"
8
8
  license = "MIT" # SPDX expression
9
9
  description = "A Python package for mining key transcription factors from transcriptome data."
10
10
  readme = "README.md"
File without changes
File without changes
File without changes