RAISE-RBP 0.1.4__tar.gz → 0.1.5__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.
- {raise_rbp-0.1.4/src/RAISE_RBP.egg-info → raise_rbp-0.1.5}/PKG-INFO +1 -1
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/pyproject.toml +1 -1
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/src/RAISE/find_target.py +18 -6
- {raise_rbp-0.1.4 → raise_rbp-0.1.5/src/RAISE_RBP.egg-info}/PKG-INFO +1 -1
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/LICENSE +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/MANIFEST.in +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/README.md +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/data/Motif.txt +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/data/RBP-exon_network.gexf +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/data/downstream.bed +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/data/exon.bed +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/data/upstream.bed +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/setup.cfg +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/src/RAISE/Quantas2rMATS.py +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/src/RAISE/__init__.py +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/src/RAISE/calculate_activity.py +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/src/RAISE/cli.py +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/src/RAISE/construct_network.py +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/src/RAISE/plot_target.py +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/src/RAISE_RBP.egg-info/SOURCES.txt +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/src/RAISE_RBP.egg-info/dependency_links.txt +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/src/RAISE_RBP.egg-info/requires.txt +0 -0
- {raise_rbp-0.1.4 → raise_rbp-0.1.5}/src/RAISE_RBP.egg-info/top_level.txt +0 -0
|
@@ -26,6 +26,9 @@ def parse_args():
|
|
|
26
26
|
parser.add_argument('--output', type=str, required=True, help="Output directory.")
|
|
27
27
|
parser.add_argument('--max_iter', type=int, default=1000, help="Maximum number of EM iterations.")
|
|
28
28
|
parser.add_argument('--tol', type=float, default=1e-4, help="Convergence threshold for EM.")
|
|
29
|
+
parser.add_argument('--use_motif', type=str2bool, default=True, help='Use motif features in EM (True/False, default: True)')
|
|
30
|
+
parser.add_argument('--use_clip', type=str2bool, default=True, help='Use CLIP features in EM (True/False, default: True)')
|
|
31
|
+
|
|
29
32
|
return parser.parse_args()
|
|
30
33
|
|
|
31
34
|
|
|
@@ -73,7 +76,7 @@ def calculate_mean(value):
|
|
|
73
76
|
return np.mean([float(x) for x in value.split(',')])
|
|
74
77
|
|
|
75
78
|
|
|
76
|
-
def run_em(features_df, max_iter=1000, tol=1e-4):
|
|
79
|
+
def run_em(features_df, max_iter=1000, tol=1e-4, use_clip=True, use_motif=True):
|
|
77
80
|
"""
|
|
78
81
|
Run EM algorithm to estimate parameters and compute posterior P(T=1 | data).
|
|
79
82
|
"""
|
|
@@ -110,11 +113,20 @@ def run_em(features_df, max_iter=1000, tol=1e-4):
|
|
|
110
113
|
# M-step
|
|
111
114
|
pi1_new = np.mean(gamma)
|
|
112
115
|
pi0_new = 1 - pi1_new
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
# Update motif parameters
|
|
117
|
+
if use_motif:
|
|
118
|
+
p1_new = np.sum(gamma[:, None] * M, axis=0) / (np.sum(gamma) + 1e-10)
|
|
119
|
+
p0_new = np.sum((1 - gamma)[:, None] * M, axis=0) / (np.sum(1 - gamma) + 1e-10)
|
|
120
|
+
else:
|
|
121
|
+
p1_new, p0_new = p1, p0 # 保持原值
|
|
117
122
|
|
|
123
|
+
# Update CLIP parameters
|
|
124
|
+
if use_clip:
|
|
125
|
+
q1_new = np.sum(gamma[:, None] * C, axis=0) / (np.sum(gamma) + 1e-10)
|
|
126
|
+
q0_new = np.sum((1 - gamma)[:, None] * C, axis=0) / (np.sum(1 - gamma) + 1e-10)
|
|
127
|
+
else:
|
|
128
|
+
q1_new, q0_new = q1, q0
|
|
129
|
+
|
|
118
130
|
# Beta distribution parameters
|
|
119
131
|
if np.sum(gamma) > 0:
|
|
120
132
|
mu1 = np.sum(gamma * PSI) / (np.sum(gamma) + 1e-10)
|
|
@@ -248,7 +260,7 @@ def main():
|
|
|
248
260
|
"S": "PSI"
|
|
249
261
|
})
|
|
250
262
|
|
|
251
|
-
features_df, params = run_em(features_df, max_iter=args.max_iter, tol=args.tol)
|
|
263
|
+
features_df, params = run_em(features_df, max_iter=args.max_iter, tol=args.tol, use_motif=args.use_motif, use_clip=args.use_clip)
|
|
252
264
|
|
|
253
265
|
# Step 9: Save results
|
|
254
266
|
basename = f"{args.cell_line}_{args.rbp}"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|