M3Drop 0.4.59__py3-none-any.whl → 0.4.60__py3-none-any.whl
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.
- m3Drop/CoreCPU.py +13 -3
- m3Drop/CoreGPU.py +8 -2
- m3Drop/DiagnosticsCPU.py +15 -1
- m3Drop/DiagnosticsGPU.py +15 -1
- {m3drop-0.4.59.dist-info → m3drop-0.4.60.dist-info}/METADATA +1 -1
- m3drop-0.4.60.dist-info/RECORD +14 -0
- m3drop-0.4.59.dist-info/RECORD +0 -14
- {m3drop-0.4.59.dist-info → m3drop-0.4.60.dist-info}/WHEEL +0 -0
- {m3drop-0.4.59.dist-info → m3drop-0.4.60.dist-info}/licenses/LICENSE +0 -0
- {m3drop-0.4.59.dist-info → m3drop-0.4.60.dist-info}/top_level.txt +0 -0
m3Drop/CoreCPU.py
CHANGED
|
@@ -332,9 +332,17 @@ def NBumiFitDispVsMeanCPU(fit: dict, suppress_plot=True):
|
|
|
332
332
|
tjs = vals['tjs'].values
|
|
333
333
|
mean_expression = tjs / vals['nc']
|
|
334
334
|
|
|
335
|
-
|
|
335
|
+
# [FIX] Filter out the 10,000 imputation values.
|
|
336
|
+
# We treat 10,000 as an error code for "Under-Dispersed/Poissonian".
|
|
337
|
+
# Masking these prevents artificial gravity from pulling the regression line up.
|
|
338
|
+
forfit = (np.isfinite(size_g)) & \
|
|
339
|
+
(size_g < 9999.0) & \
|
|
340
|
+
(mean_expression > 1e-3) & \
|
|
341
|
+
(size_g > 0)
|
|
342
|
+
|
|
336
343
|
log2_mean_expr = np.log2(mean_expression, where=(mean_expression > 0))
|
|
337
344
|
|
|
345
|
+
# Heuristic: If we have enough high-expression genes, focus fit there
|
|
338
346
|
higher = log2_mean_expr > 4
|
|
339
347
|
if np.sum(higher & forfit) > 2000:
|
|
340
348
|
forfit = higher & forfit
|
|
@@ -347,8 +355,10 @@ def NBumiFitDispVsMeanCPU(fit: dict, suppress_plot=True):
|
|
|
347
355
|
|
|
348
356
|
if not suppress_plot:
|
|
349
357
|
plt.figure(figsize=(7, 6))
|
|
350
|
-
|
|
351
|
-
plt.
|
|
358
|
+
# Plot ALL points (grey) vs FITTED points (blue)
|
|
359
|
+
plt.scatter(np.log(mean_expression), np.log(size_g), alpha=0.3, s=1, c='grey', label='All Genes')
|
|
360
|
+
plt.scatter(x, y, alpha=0.5, s=1, c='blue', label='Used for Fit')
|
|
361
|
+
plt.plot(x, model.fittedvalues, color='red', label='Regression Fit')
|
|
352
362
|
plt.show()
|
|
353
363
|
|
|
354
364
|
return model.params
|
m3Drop/CoreGPU.py
CHANGED
|
@@ -324,9 +324,14 @@ def NBumiFitDispVsMeanGPU(fit: dict, suppress_plot=True):
|
|
|
324
324
|
tjs = vals['tjs'].values
|
|
325
325
|
mean_expression = tjs / vals['nc']
|
|
326
326
|
|
|
327
|
-
forfit = (np.isfinite(size_g)) &
|
|
327
|
+
forfit = (np.isfinite(size_g)) & \
|
|
328
|
+
(size_g < 9999.0) & \
|
|
329
|
+
(mean_expression > 1e-3) & \
|
|
330
|
+
(size_g > 0)
|
|
331
|
+
|
|
328
332
|
log2_mean_expr = np.log2(mean_expression, where=(mean_expression > 0))
|
|
329
333
|
|
|
334
|
+
# Heuristic: If we have enough high-expression genes, focus fit there
|
|
330
335
|
higher = log2_mean_expr > 4
|
|
331
336
|
if np.sum(higher & forfit) > 2000:
|
|
332
337
|
forfit = higher & forfit
|
|
@@ -339,7 +344,8 @@ def NBumiFitDispVsMeanGPU(fit: dict, suppress_plot=True):
|
|
|
339
344
|
|
|
340
345
|
if not suppress_plot:
|
|
341
346
|
plt.figure(figsize=(7, 6))
|
|
342
|
-
|
|
347
|
+
# Visual check only - code below handles the production plot
|
|
348
|
+
plt.scatter(x, y, alpha=0.5, s=1, c='blue')
|
|
343
349
|
plt.plot(x, model.fittedvalues, color='red')
|
|
344
350
|
plt.show()
|
|
345
351
|
|
m3Drop/DiagnosticsCPU.py
CHANGED
|
@@ -4,6 +4,7 @@ import matplotlib.pyplot as plt
|
|
|
4
4
|
import h5py
|
|
5
5
|
import os
|
|
6
6
|
import time
|
|
7
|
+
import sys
|
|
7
8
|
import pickle
|
|
8
9
|
import gc
|
|
9
10
|
from scipy import sparse
|
|
@@ -385,9 +386,11 @@ def NBumiPlotDispVsMeanCPU(
|
|
|
385
386
|
mean_expression = fit['vals']['tjs'].values / fit['vals']['nc']
|
|
386
387
|
sizes = fit['sizes'].values
|
|
387
388
|
|
|
389
|
+
# 1. Get calibrated coefficients (using the fixed CoreCPU logic)
|
|
388
390
|
coeffs = NBumiFitDispVsMeanCPU(fit, suppress_plot=True)
|
|
389
391
|
intercept, slope = coeffs[0], coeffs[1]
|
|
390
392
|
|
|
393
|
+
# 2. Calculate the regression line
|
|
391
394
|
log_mean_expr_range = np.linspace(
|
|
392
395
|
np.log(mean_expression[mean_expression > 0].min()),
|
|
393
396
|
np.log(mean_expression.max()),
|
|
@@ -396,8 +399,19 @@ def NBumiPlotDispVsMeanCPU(
|
|
|
396
399
|
log_fitted_sizes = intercept + slope * log_mean_expr_range
|
|
397
400
|
fitted_sizes = np.exp(log_fitted_sizes)
|
|
398
401
|
|
|
402
|
+
# 3. [FIX] Mask the 10k outliers for the SCATTER PLOT
|
|
403
|
+
# We create a visualization mask to hide the distracting "roof" at y=10000
|
|
404
|
+
mask_viz = (sizes < 9999.0) & (sizes > 0)
|
|
405
|
+
|
|
406
|
+
mean_expr_clean = mean_expression[mask_viz]
|
|
407
|
+
sizes_clean = sizes[mask_viz]
|
|
408
|
+
|
|
399
409
|
plt.figure(figsize=(8, 6))
|
|
400
|
-
|
|
410
|
+
|
|
411
|
+
# Plot only the clean data
|
|
412
|
+
plt.scatter(mean_expr_clean, sizes_clean, label='Observed Dispersion', alpha=0.5, s=8)
|
|
413
|
+
|
|
414
|
+
# Plot the regression line (calculated correctly via CoreCPU)
|
|
401
415
|
plt.plot(np.exp(log_mean_expr_range), fitted_sizes, color='red', label='Regression Fit', linewidth=2)
|
|
402
416
|
|
|
403
417
|
plt.xscale('log')
|
m3Drop/DiagnosticsGPU.py
CHANGED
|
@@ -9,6 +9,7 @@ import time
|
|
|
9
9
|
import pickle
|
|
10
10
|
import psutil
|
|
11
11
|
import gc
|
|
12
|
+
import sys
|
|
12
13
|
from scipy import sparse
|
|
13
14
|
from scipy import stats
|
|
14
15
|
import anndata
|
|
@@ -403,9 +404,11 @@ def NBumiPlotDispVsMeanGPU(
|
|
|
403
404
|
mean_expression = fit['vals']['tjs'].values / fit['vals']['nc']
|
|
404
405
|
sizes = fit['sizes'].values
|
|
405
406
|
|
|
407
|
+
# 1. Get calibrated coefficients (using the fixed CoreGPU logic)
|
|
406
408
|
coeffs = NBumiFitDispVsMeanGPU(fit, suppress_plot=True)
|
|
407
409
|
intercept, slope = coeffs[0], coeffs[1]
|
|
408
410
|
|
|
411
|
+
# 2. Calculate the regression line
|
|
409
412
|
log_mean_expr_range = np.linspace(
|
|
410
413
|
np.log(mean_expression[mean_expression > 0].min()),
|
|
411
414
|
np.log(mean_expression.max()),
|
|
@@ -414,8 +417,19 @@ def NBumiPlotDispVsMeanGPU(
|
|
|
414
417
|
log_fitted_sizes = intercept + slope * log_mean_expr_range
|
|
415
418
|
fitted_sizes = np.exp(log_fitted_sizes)
|
|
416
419
|
|
|
420
|
+
# 3. [FIX] Mask the 10k outliers for the SCATTER PLOT
|
|
421
|
+
# We create a visualization mask to hide the distracting "roof" at y=10000
|
|
422
|
+
mask_viz = (sizes < 9999.0) & (sizes > 0)
|
|
423
|
+
|
|
424
|
+
mean_expr_clean = mean_expression[mask_viz]
|
|
425
|
+
sizes_clean = sizes[mask_viz]
|
|
426
|
+
|
|
417
427
|
plt.figure(figsize=(8, 6))
|
|
418
|
-
|
|
428
|
+
|
|
429
|
+
# Plot only the clean data
|
|
430
|
+
plt.scatter(mean_expr_clean, sizes_clean, label='Observed Dispersion', alpha=0.5, s=8)
|
|
431
|
+
|
|
432
|
+
# Plot the regression line (which was calculated correctly via CoreGPU)
|
|
419
433
|
plt.plot(np.exp(log_mean_expr_range), fitted_sizes, color='red', label='Regression Fit', linewidth=2)
|
|
420
434
|
|
|
421
435
|
plt.xscale('log')
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
m3Drop/ControlDeviceCPU.py,sha256=8P-hxd4thc2wSeon73b9rz3clIGkE3x0cEE82RiGFds,8880
|
|
2
|
+
m3Drop/ControlDeviceGPU.py,sha256=4nzPtgyV0RsEOeezwCVJ7oyDOsp9-dRVLczlduUocpU,9143
|
|
3
|
+
m3Drop/CoreCPU.py,sha256=EVGh6JFka-PlUHF034z6UOjKsmMdjWJxP0a4Sg1mq4M,19475
|
|
4
|
+
m3Drop/CoreGPU.py,sha256=e-dZhtQgRmOdy6Ill_X9YaLEM7GXOWu4R8VO7SNkr8E,20439
|
|
5
|
+
m3Drop/DiagnosticsCPU.py,sha256=CjuP773llDZuvll3xl0Yjl1BAxMx5vDZY9P4tM-kHyE,14072
|
|
6
|
+
m3Drop/DiagnosticsGPU.py,sha256=qWtH0lGaWwTxaY-7c5oDA2gJff_y0-r18-RqarWZz7E,15521
|
|
7
|
+
m3Drop/NormalizationCPU.py,sha256=Qfj2IRMQyxkvJaAlbH9_H6SMFIWs_UCw3LhY2mOTFSA,13038
|
|
8
|
+
m3Drop/NormalizationGPU.py,sha256=FJLzfYdEB96v9OXld64FZO7r5_M9AU00OSuSlaM0ThY,15541
|
|
9
|
+
m3Drop/__init__.py,sha256=W_TQ9P8_7Tdsa6kDZ6IJKT0FMkX_JFvBqiP821CZIrk,2180
|
|
10
|
+
m3drop-0.4.60.dist-info/licenses/LICENSE,sha256=44Iqpp8Fc10Xzd5T7cT9UhO31Qftk3gBiCjtpwilP_k,1074
|
|
11
|
+
m3drop-0.4.60.dist-info/METADATA,sha256=FDFnoP0RnBjbl0gLkJNsEWcdIUkJwDLtIv9kYQbW9gA,5248
|
|
12
|
+
m3drop-0.4.60.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
13
|
+
m3drop-0.4.60.dist-info/top_level.txt,sha256=AEULFEFIgFtAwS-KBlIFoYXrqczX_rwqrEcdK46GIrA,7
|
|
14
|
+
m3drop-0.4.60.dist-info/RECORD,,
|
m3drop-0.4.59.dist-info/RECORD
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
m3Drop/ControlDeviceCPU.py,sha256=8P-hxd4thc2wSeon73b9rz3clIGkE3x0cEE82RiGFds,8880
|
|
2
|
-
m3Drop/ControlDeviceGPU.py,sha256=4nzPtgyV0RsEOeezwCVJ7oyDOsp9-dRVLczlduUocpU,9143
|
|
3
|
-
m3Drop/CoreCPU.py,sha256=bJ-4eSW5Q5FXIRdxv6Q8Aj-hF4VhvVq0fFJpTPZGwDA,18922
|
|
4
|
-
m3Drop/CoreGPU.py,sha256=phOUJ6PyOCczY3x_9FzVuOtC-oyHOkDte8bqA1yX7b4,20227
|
|
5
|
-
m3Drop/DiagnosticsCPU.py,sha256=YnKK6mkPEUS8IkQ-vKPE3aZaVJQBsSUp3YsO98sPNV0,13569
|
|
6
|
-
m3Drop/DiagnosticsGPU.py,sha256=wtVC2O48vcfS0sEl7RlXTHGZRBNDehszXEtxgLOqTJc,14994
|
|
7
|
-
m3Drop/NormalizationCPU.py,sha256=Qfj2IRMQyxkvJaAlbH9_H6SMFIWs_UCw3LhY2mOTFSA,13038
|
|
8
|
-
m3Drop/NormalizationGPU.py,sha256=FJLzfYdEB96v9OXld64FZO7r5_M9AU00OSuSlaM0ThY,15541
|
|
9
|
-
m3Drop/__init__.py,sha256=W_TQ9P8_7Tdsa6kDZ6IJKT0FMkX_JFvBqiP821CZIrk,2180
|
|
10
|
-
m3drop-0.4.59.dist-info/licenses/LICENSE,sha256=44Iqpp8Fc10Xzd5T7cT9UhO31Qftk3gBiCjtpwilP_k,1074
|
|
11
|
-
m3drop-0.4.59.dist-info/METADATA,sha256=S9HaM8uJ_X5BfUnho10yRoYV62o8yXkBfm9oWYCKWY4,5248
|
|
12
|
-
m3drop-0.4.59.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
13
|
-
m3drop-0.4.59.dist-info/top_level.txt,sha256=AEULFEFIgFtAwS-KBlIFoYXrqczX_rwqrEcdK46GIrA,7
|
|
14
|
-
m3drop-0.4.59.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|