pilotpy 2.0.2__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.
- pilotpy/__init__.py +6 -0
- pilotpy/pl.py +1 -0
- pilotpy/plot/__init__.py +5 -0
- pilotpy/plot/curve_activity.py +92 -0
- pilotpy/plot/gene_selection_analysis.py +1409 -0
- pilotpy/plot/ploting.py +2126 -0
- pilotpy/plot/pseudobulk_DE_analysis.py +666 -0
- pilotpy/tl.py +1 -0
- pilotpy/tools/Cell_gene_selection.py +800 -0
- pilotpy/tools/Gene_cluster_specific.py +201 -0
- pilotpy/tools/Gene_cluster_specific_functions.py +809 -0
- pilotpy/tools/Trajectory.py +1729 -0
- pilotpy/tools/__init__.py +5 -0
- pilotpy/tools/patients_sub_clustering.py +268 -0
- pilotpy-2.0.2.dist-info/LICENSE +21 -0
- pilotpy-2.0.2.dist-info/METADATA +106 -0
- pilotpy-2.0.2.dist-info/RECORD +18 -0
- pilotpy-2.0.2.dist-info/WHEEL +4 -0
pilotpy/__init__.py
ADDED
pilotpy/pl.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .plot import *
|
pilotpy/plot/__init__.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# This code had been adapted from https://github.com/pinellolab/dictys
|
|
4
|
+
# Wang, L., Trasanidis, N., Wu, T. et al. Dictys: dynamic gene regulatory
|
|
5
|
+
## network dissects developmental continuum with single-cell multiomics.
|
|
6
|
+
### Nat Methods 20, 1368–1378 (2023).
|
|
7
|
+
|
|
8
|
+
import numpy as np
|
|
9
|
+
|
|
10
|
+
def auc(curves, times):
|
|
11
|
+
"""
|
|
12
|
+
Computes area under the curves.
|
|
13
|
+
Parameters
|
|
14
|
+
----------
|
|
15
|
+
times: numpy.ndarray(shape=(n,))
|
|
16
|
+
X coordinates
|
|
17
|
+
curves: numpy.ndarray(shape=(ny,n))
|
|
18
|
+
Y coordinates, one for each y curve
|
|
19
|
+
Returns
|
|
20
|
+
-------
|
|
21
|
+
numpy.ndarray(shape=(ny,))
|
|
22
|
+
Area under the curves
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
if len(times) < 2 or not (times[1:] > times[:-1]).all():
|
|
26
|
+
raise ValueError('times must be increasing and have at least 2 values.')
|
|
27
|
+
timesdiff = times[1:] - times[:-1]
|
|
28
|
+
curvesmean = (curves[:,1:] + curves[:, :-1]) / 2
|
|
29
|
+
ans = curvesmean@timesdiff
|
|
30
|
+
return ans
|
|
31
|
+
|
|
32
|
+
def _curvesnamic_network_char_terminal_logfc_(curves, times):
|
|
33
|
+
"""
|
|
34
|
+
Computes terminal logFC for curves.
|
|
35
|
+
Parameters
|
|
36
|
+
----------
|
|
37
|
+
times: numpy.ndarray(shape=(n,))
|
|
38
|
+
X coordinates
|
|
39
|
+
curves: numpy.ndarray(shape=(ny,n))
|
|
40
|
+
Y coordinates, one for each y curve
|
|
41
|
+
Returns
|
|
42
|
+
-------
|
|
43
|
+
numpy.ndarray(shape=(ny,))
|
|
44
|
+
Terminal logFCs
|
|
45
|
+
"""
|
|
46
|
+
if len(times) < 2 or not (times[1:] > times[:-1]).all():
|
|
47
|
+
raise ValueError('times must be increasing and have at least 2 values.')
|
|
48
|
+
return (curves[:,-1] - curves[:,0]) / (times[-1] - times[0])
|
|
49
|
+
|
|
50
|
+
def _curvesnamic_network_char_transient_logfc_(curves, times):
|
|
51
|
+
"""
|
|
52
|
+
Computes transient logFC for curves.
|
|
53
|
+
Parameters
|
|
54
|
+
----------
|
|
55
|
+
times: numpy.ndarray(shape=(n,))
|
|
56
|
+
X coordinates
|
|
57
|
+
curves: numpy.ndarray(shape=(ny,n))
|
|
58
|
+
Y coordinates, one for each y curve
|
|
59
|
+
Returns
|
|
60
|
+
-------
|
|
61
|
+
numpy.ndarray(shape=(ny,))
|
|
62
|
+
Transient logFCs
|
|
63
|
+
"""
|
|
64
|
+
n = curves.shape[1]
|
|
65
|
+
times = (times - times[0]) / (times[-1] - times[0])
|
|
66
|
+
curves = curves - np.median([curves, np.repeat(curves[:, [0]], n, axis = 1), np.repeat(curves[:, [-1]], n, axis = 1)], axis = 0)
|
|
67
|
+
return auc(curves, times)
|
|
68
|
+
|
|
69
|
+
def _curvesnamic_network_char_switching_time_(curves, times):
|
|
70
|
+
"""
|
|
71
|
+
Computes switching time for curves.
|
|
72
|
+
Parameters
|
|
73
|
+
----------
|
|
74
|
+
times: numpy.ndarray(shape=(n,))
|
|
75
|
+
X coordinates
|
|
76
|
+
curves: numpy.ndarray(shape=(ny,n))
|
|
77
|
+
Y coordinates, one for each y curve
|
|
78
|
+
Returns
|
|
79
|
+
-------
|
|
80
|
+
numpy.ndarray(shape=(ny,))
|
|
81
|
+
Switching time
|
|
82
|
+
"""
|
|
83
|
+
n = curves.shape[1]
|
|
84
|
+
times = (times - times[0]) / (times[-1] - times[0])
|
|
85
|
+
curves = np.median([curves, np.repeat(curves[:, [0]], n, axis = 1), np.repeat(curves[:, [-1]], n, axis = 1)], axis = 0)
|
|
86
|
+
return (auc((curves.T - curves[:, -1]).T, times)) / (curves[:, 0] - curves[:, -1] + 1E-300)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _curvesnamic_network_char_area_(curves, times):
|
|
90
|
+
return abs(curves[:, 0] + curves[:, -1]) * abs(times[-1] - times[0])
|
|
91
|
+
|
|
92
|
+
|