pilotpy 2.0.2__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.
- pilotpy-2.0.2/LICENSE +21 -0
- pilotpy-2.0.2/PKG-INFO +106 -0
- pilotpy-2.0.2/README.md +74 -0
- pilotpy-2.0.2/pyproject.toml +35 -0
- pilotpy-2.0.2/src/pilotpy/__init__.py +6 -0
- pilotpy-2.0.2/src/pilotpy/pl.py +1 -0
- pilotpy-2.0.2/src/pilotpy/plot/__init__.py +5 -0
- pilotpy-2.0.2/src/pilotpy/plot/__pycache__/__init__.cpython-311.pyc +0 -0
- pilotpy-2.0.2/src/pilotpy/plot/__pycache__/curve_activity.cpython-311.pyc +0 -0
- pilotpy-2.0.2/src/pilotpy/plot/__pycache__/gene_selection_analysis.cpython-311.pyc +0 -0
- pilotpy-2.0.2/src/pilotpy/plot/__pycache__/ploting.cpython-311.pyc +0 -0
- pilotpy-2.0.2/src/pilotpy/plot/__pycache__/pseudobulk_DE_analysis.cpython-311.pyc +0 -0
- pilotpy-2.0.2/src/pilotpy/plot/curve_activity.py +92 -0
- pilotpy-2.0.2/src/pilotpy/plot/gene_selection_analysis.py +1409 -0
- pilotpy-2.0.2/src/pilotpy/plot/ploting.py +2126 -0
- pilotpy-2.0.2/src/pilotpy/plot/pseudobulk_DE_analysis.py +666 -0
- pilotpy-2.0.2/src/pilotpy/tl.py +1 -0
- pilotpy-2.0.2/src/pilotpy/tools/Cell_gene_selection.py +800 -0
- pilotpy-2.0.2/src/pilotpy/tools/Gene_cluster_specific.py +201 -0
- pilotpy-2.0.2/src/pilotpy/tools/Gene_cluster_specific_functions.py +809 -0
- pilotpy-2.0.2/src/pilotpy/tools/Trajectory.py +1729 -0
- pilotpy-2.0.2/src/pilotpy/tools/__init__.py +5 -0
- pilotpy-2.0.2/src/pilotpy/tools/__pycache__/Cell_gene_selection.cpython-311.pyc +0 -0
- pilotpy-2.0.2/src/pilotpy/tools/__pycache__/Gene_cluster_specific.cpython-311.pyc +0 -0
- pilotpy-2.0.2/src/pilotpy/tools/__pycache__/Gene_cluster_specific_functions.cpython-311.pyc +0 -0
- pilotpy-2.0.2/src/pilotpy/tools/__pycache__/Trajectory.cpython-311.pyc +0 -0
- pilotpy-2.0.2/src/pilotpy/tools/__pycache__/__init__.cpython-311.pyc +0 -0
- pilotpy-2.0.2/src/pilotpy/tools/__pycache__/patients_sub_clustering.cpython-311.pyc +0 -0
- pilotpy-2.0.2/src/pilotpy/tools/patients_sub_clustering.py +268 -0
pilotpy-2.0.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 PILOT (https://github.com/CostaLab/PILOT)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pilotpy-2.0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pilotpy
|
|
3
|
+
Version: 2.0.2
|
|
4
|
+
Summary: PILOT: Detection of PatIent-Level distances from single cell genomics and pathomics data with Optimal Transport (PILOT)
|
|
5
|
+
License: MIT
|
|
6
|
+
Author: Mehdi Joodaki
|
|
7
|
+
Requires-Python: ==3.11.5
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Requires-Dist: POT (>=0.9.3,<0.10.0)
|
|
11
|
+
Requires-Dist: adjustText (>=1.1.1,<2.0.0)
|
|
12
|
+
Requires-Dist: cycler (>=0.12.1,<0.13.0)
|
|
13
|
+
Requires-Dist: elpigraph-python (>=0.3.1,<0.4.0)
|
|
14
|
+
Requires-Dist: gprofiler-official (>=1.0.0,<2.0.0)
|
|
15
|
+
Requires-Dist: joypy (>=0.2.6,<0.3.0)
|
|
16
|
+
Requires-Dist: leidenalg (>=0.10.2,<0.11.0)
|
|
17
|
+
Requires-Dist: matplotlib (>=3.8.4,<4.0.0)
|
|
18
|
+
Requires-Dist: numpy (>=1.26.4,<2.0.0)
|
|
19
|
+
Requires-Dist: pandas (>=2.2.2,<3.0.0)
|
|
20
|
+
Requires-Dist: plotly (>=5.22.0,<6.0.0)
|
|
21
|
+
Requires-Dist: plotnine (>=0.13.5,<0.14.0)
|
|
22
|
+
Requires-Dist: pydiffmap (>=0.2.0.1,<0.3.0.0)
|
|
23
|
+
Requires-Dist: scanpy (>=1.10.1,<2.0.0)
|
|
24
|
+
Requires-Dist: scikit-learn (>=1.4.2,<2.0.0)
|
|
25
|
+
Requires-Dist: scikit-network (>=0.32.1,<0.33.0)
|
|
26
|
+
Requires-Dist: scipy (>=1.13.0,<2.0.0)
|
|
27
|
+
Requires-Dist: seaborn (>=0.13.2,<0.14.0)
|
|
28
|
+
Requires-Dist: shap (>=0.45.0,<0.46.0)
|
|
29
|
+
Requires-Dist: statsmodels (>=0.14.2,<0.15.0)
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# PILOT <img src="img/logo.png" align="right" width="300" />
|
|
33
|
+
|
|
34
|
+
[](https://github.com/CostaLab/PILOT?tab=MIT-1-ov-file#MIT-1-ov-file)
|
|
35
|
+
|
|
36
|
+
**Authors:**
|
|
37
|
+
Mehdi Joodaki<sup>[*1]</sup>
|
|
38
|
+
,Mina Shaigan<sup>[*1]</sup>
|
|
39
|
+
,Victor Parra<sup>[1]</sup>
|
|
40
|
+
,Roman D. Bülow<sup>[2]</sup>
|
|
41
|
+
,Christoph Kuppe<sup>[3]</sup>
|
|
42
|
+
,David L. Hölscher<sup>[2]</sup>
|
|
43
|
+
,Mingbo Cheng<sup>[1]</sup>
|
|
44
|
+
,James S. Nagai<sup>[1]</sup>
|
|
45
|
+
,Michaël Goedertier<sup>[1,2]</sup>
|
|
46
|
+
,Nassim Bouteldja<sup>[2]</sup>
|
|
47
|
+
,Vladimir Tesar<sup>[5]</sup>
|
|
48
|
+
,Jonathan Barratt<sup>[6,7]</sup>
|
|
49
|
+
,Ian S.D. Roberts<sup>[8]</sup>
|
|
50
|
+
,Rosanna Coppo<sup>[9]</sup>
|
|
51
|
+
,Rafael Kramann<sup>[3,4]</sup>
|
|
52
|
+
,Peter Boor<sup>[2,@]</sup>
|
|
53
|
+
,Ivan G. Costa<sup>[1,@]</sup>
|
|
54
|
+
|
|
55
|
+
**Affiliations:**
|
|
56
|
+
- [1] Institute for Computational Genomics, Joint Research Center for Computational Biomedicine, RWTH Aachen University Medical School
|
|
57
|
+
- [2] Institute of Pathology, Laboratory of Nephropathology, RWTH Aachen University Medical School
|
|
58
|
+
- [3] Institute of Experimental Medicine and Systems Biology, RWTH Aachen University
|
|
59
|
+
- [4] Department of Internal Medicine, Nephrology and Transplantation, Erasmus Medical Center
|
|
60
|
+
- [5] Department of Nephrology, $1^{st}$ Faculty of Medicine and General University Hospital, Charles University, Prague, Czech Republic
|
|
61
|
+
- [6] John Walls Renal Unit, University Hospital of Leicester National Health Service Trust, Leicester, United Kingdom
|
|
62
|
+
- [7] Department of Cardiovascular Sciences, University of Leicester, Leicester, United Kingdom
|
|
63
|
+
- [8] Department of Cellular Pathology, Oxford University Hospitals National Health Services Foundation Trust, Oxford, United Kingdom
|
|
64
|
+
- [9] Fondazione Ricerca Molinette. Regina Margherita Children's University Hospital, Torino, Italy
|
|
65
|
+
|
|
66
|
+

|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
Current version for PILOT is 2.0.2
|
|
70
|
+
|
|
71
|
+
## Installation
|
|
72
|
+
The easiest way to install PILOT and the required packages is using the following way:
|
|
73
|
+
|
|
74
|
+
```terminal
|
|
75
|
+
git clone https://github.com/CostaLab/PILOT
|
|
76
|
+
cd PILOT
|
|
77
|
+
conda create --name PILOT r-base
|
|
78
|
+
conda activate PILOT
|
|
79
|
+
conda install -c conda-forge rpy2
|
|
80
|
+
conda install jupyter
|
|
81
|
+
pip install .
|
|
82
|
+
```
|
|
83
|
+
Once you've completed these steps, you can proceed to run the tutorials and explore the features of PILOT.
|
|
84
|
+
When doing so, remember to move to the tutorial folder, as all the work will be performed there:
|
|
85
|
+
|
|
86
|
+
```terminal
|
|
87
|
+
cd Tutorial
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## [Tutorial&Data sets](https://pilot.readthedocs.io/en/latest/index.html)
|
|
91
|
+
There are five tutorials, one for [Myocardial Infarction (single cell data)](https://pilot.readthedocs.io/en/latest/Myocardial_infarction.html), and the second tutorial for [pathomics data, the combination of Kidney IgAN(G) & Kidney IgAN(T)](https://pilot.readthedocs.io/en/latest/Combination_Kidney_IgAN.html), and the third one for [Patients sub-group detection and then ranking cells/genes (Pancreas data)](https://pilot.readthedocs.io/en/latest/Patients_sub_group_detection.html) and the forth one for
|
|
92
|
+
[evaluation of the presence of batch effects in Trajectory](https://pilot.readthedocs.io/en/latest/Kidney_trajectory.html) and the last one for [evaluation of the presence of batch effects in detected sub-groups](https://pilot.readthedocs.io/en/latest/Kidney_clusters.html).
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
You can access the used data sets by PILOT in Part 1 [](https://zenodo.org/records/8370081) and Part 2 [](https://zenodo.org/records/7957118)
|
|
96
|
+
|
|
97
|
+
# References
|
|
98
|
+
PILOT: Detection of PatIent-Level distances from single cell genomics and pathomics data with Optimal Transport (PILOT) [link](https://www.embopress.org/doi/full/10.1038/s44320-023-00003-8)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
pilotpy-2.0.2/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# PILOT <img src="img/logo.png" align="right" width="300" />
|
|
2
|
+
|
|
3
|
+
[](https://github.com/CostaLab/PILOT?tab=MIT-1-ov-file#MIT-1-ov-file)
|
|
4
|
+
|
|
5
|
+
**Authors:**
|
|
6
|
+
Mehdi Joodaki<sup>[*1]</sup>
|
|
7
|
+
,Mina Shaigan<sup>[*1]</sup>
|
|
8
|
+
,Victor Parra<sup>[1]</sup>
|
|
9
|
+
,Roman D. Bülow<sup>[2]</sup>
|
|
10
|
+
,Christoph Kuppe<sup>[3]</sup>
|
|
11
|
+
,David L. Hölscher<sup>[2]</sup>
|
|
12
|
+
,Mingbo Cheng<sup>[1]</sup>
|
|
13
|
+
,James S. Nagai<sup>[1]</sup>
|
|
14
|
+
,Michaël Goedertier<sup>[1,2]</sup>
|
|
15
|
+
,Nassim Bouteldja<sup>[2]</sup>
|
|
16
|
+
,Vladimir Tesar<sup>[5]</sup>
|
|
17
|
+
,Jonathan Barratt<sup>[6,7]</sup>
|
|
18
|
+
,Ian S.D. Roberts<sup>[8]</sup>
|
|
19
|
+
,Rosanna Coppo<sup>[9]</sup>
|
|
20
|
+
,Rafael Kramann<sup>[3,4]</sup>
|
|
21
|
+
,Peter Boor<sup>[2,@]</sup>
|
|
22
|
+
,Ivan G. Costa<sup>[1,@]</sup>
|
|
23
|
+
|
|
24
|
+
**Affiliations:**
|
|
25
|
+
- [1] Institute for Computational Genomics, Joint Research Center for Computational Biomedicine, RWTH Aachen University Medical School
|
|
26
|
+
- [2] Institute of Pathology, Laboratory of Nephropathology, RWTH Aachen University Medical School
|
|
27
|
+
- [3] Institute of Experimental Medicine and Systems Biology, RWTH Aachen University
|
|
28
|
+
- [4] Department of Internal Medicine, Nephrology and Transplantation, Erasmus Medical Center
|
|
29
|
+
- [5] Department of Nephrology, $1^{st}$ Faculty of Medicine and General University Hospital, Charles University, Prague, Czech Republic
|
|
30
|
+
- [6] John Walls Renal Unit, University Hospital of Leicester National Health Service Trust, Leicester, United Kingdom
|
|
31
|
+
- [7] Department of Cardiovascular Sciences, University of Leicester, Leicester, United Kingdom
|
|
32
|
+
- [8] Department of Cellular Pathology, Oxford University Hospitals National Health Services Foundation Trust, Oxford, United Kingdom
|
|
33
|
+
- [9] Fondazione Ricerca Molinette. Regina Margherita Children's University Hospital, Torino, Italy
|
|
34
|
+
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
Current version for PILOT is 2.0.2
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
The easiest way to install PILOT and the required packages is using the following way:
|
|
42
|
+
|
|
43
|
+
```terminal
|
|
44
|
+
git clone https://github.com/CostaLab/PILOT
|
|
45
|
+
cd PILOT
|
|
46
|
+
conda create --name PILOT r-base
|
|
47
|
+
conda activate PILOT
|
|
48
|
+
conda install -c conda-forge rpy2
|
|
49
|
+
conda install jupyter
|
|
50
|
+
pip install .
|
|
51
|
+
```
|
|
52
|
+
Once you've completed these steps, you can proceed to run the tutorials and explore the features of PILOT.
|
|
53
|
+
When doing so, remember to move to the tutorial folder, as all the work will be performed there:
|
|
54
|
+
|
|
55
|
+
```terminal
|
|
56
|
+
cd Tutorial
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## [Tutorial&Data sets](https://pilot.readthedocs.io/en/latest/index.html)
|
|
60
|
+
There are five tutorials, one for [Myocardial Infarction (single cell data)](https://pilot.readthedocs.io/en/latest/Myocardial_infarction.html), and the second tutorial for [pathomics data, the combination of Kidney IgAN(G) & Kidney IgAN(T)](https://pilot.readthedocs.io/en/latest/Combination_Kidney_IgAN.html), and the third one for [Patients sub-group detection and then ranking cells/genes (Pancreas data)](https://pilot.readthedocs.io/en/latest/Patients_sub_group_detection.html) and the forth one for
|
|
61
|
+
[evaluation of the presence of batch effects in Trajectory](https://pilot.readthedocs.io/en/latest/Kidney_trajectory.html) and the last one for [evaluation of the presence of batch effects in detected sub-groups](https://pilot.readthedocs.io/en/latest/Kidney_clusters.html).
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
You can access the used data sets by PILOT in Part 1 [](https://zenodo.org/records/8370081) and Part 2 [](https://zenodo.org/records/7957118)
|
|
65
|
+
|
|
66
|
+
# References
|
|
67
|
+
PILOT: Detection of PatIent-Level distances from single cell genomics and pathomics data with Optimal Transport (PILOT) [link](https://www.embopress.org/doi/full/10.1038/s44320-023-00003-8)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "pilotpy"
|
|
3
|
+
version = "2.0.2"
|
|
4
|
+
description = "PILOT: Detection of PatIent-Level distances from single cell genomics and pathomics data with Optimal Transport (PILOT)"
|
|
5
|
+
authors = ["Mehdi Joodaki"]
|
|
6
|
+
license = "MIT license"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
|
|
9
|
+
[tool.poetry.dependencies]
|
|
10
|
+
python = "3.11.5"
|
|
11
|
+
cycler = "^0.12.1"
|
|
12
|
+
joypy = "^0.2.6"
|
|
13
|
+
leidenalg = "^0.10.2"
|
|
14
|
+
numpy = "^1.26.4"
|
|
15
|
+
matplotlib = "^3.8.4"
|
|
16
|
+
pandas = "^2.2.2"
|
|
17
|
+
plotly = "^5.22.0"
|
|
18
|
+
plotnine = "^0.13.5"
|
|
19
|
+
POT = "^0.9.3"
|
|
20
|
+
pydiffmap = "^0.2.0.1"
|
|
21
|
+
scanpy = "^1.10.1"
|
|
22
|
+
scikit-learn = "^1.4.2"
|
|
23
|
+
scikit-network = "^0.32.1"
|
|
24
|
+
scipy = "^1.13.0"
|
|
25
|
+
seaborn = "^0.13.2"
|
|
26
|
+
shap = "^0.45.0"
|
|
27
|
+
statsmodels = "^0.14.2"
|
|
28
|
+
elpigraph-python = "^0.3.1"
|
|
29
|
+
adjustText = "^1.1.1"
|
|
30
|
+
gprofiler-official = "^1.0.0"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
[build-system]
|
|
34
|
+
requires = ["poetry-core"]
|
|
35
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .plot import *
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -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
|
+
|