Skip to content

Commit 8a53f6f

Browse files
authored
Merge pull request #16 from elmbeech/master
release v3.2.12
2 parents 1a49e02 + a18cec0 commit 8a53f6f

22 files changed

+2346
-254
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: pytest pcdl
5+
run-name: ${{ github.actor }} is pytesting the pcdl library on all supported python versions and operating systems.
6+
7+
on:
8+
push:
9+
branches: ["master"]
10+
pull_request:
11+
branches: ["master"]
12+
13+
jobs:
14+
build-linux:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
#python-version: ["3.11"]
20+
python-version: ["3.8", "3.9", "3.10", "3.11"]
21+
22+
env:
23+
PYTHONPATH: /home/runner/work/physicelldataloader/physicelldataloader
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v3
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
- name: Install dependencies
32+
run: |
33+
sudo apt install ffmpeg imagemagick
34+
python -m pip install --upgrade pip
35+
python -m pip install flake8 pytest matplotlib numpy pandas scipy requests anndata
36+
#if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
37+
- name: Lint with flake8
38+
run: |
39+
# stop the build if there are Python syntax errors or undefined names
40+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
41+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
42+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
43+
- name: Test with pytest
44+
run: |
45+
pytest
46+
47+
48+
build-macosx:
49+
runs-on: macos-latest
50+
strategy:
51+
fail-fast: false
52+
matrix:
53+
#python-version: ["3.11"]
54+
python-version: ["3.8", "3.9", "3.10", "3.11"]
55+
56+
env:
57+
PYTHONPATH: /Users/runner/work/physicelldataloader/physicelldataloader
58+
59+
steps:
60+
- uses: actions/checkout@v3
61+
- name: Set up Python ${{ matrix.python-version }}
62+
uses: actions/setup-python@v3
63+
with:
64+
python-version: ${{ matrix.python-version }}
65+
- name: Install dependencies
66+
run: |
67+
brew install ffmpeg imagemagick
68+
python -m pip install --upgrade pip
69+
python -m pip install flake8 pytest matplotlib numpy pandas scipy requests anndata
70+
#if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
71+
- name: Lint with flake8
72+
run: |
73+
# stop the build if there are Python syntax errors or undefined names
74+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
75+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
76+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
77+
- name: Test with pytest
78+
run: |
79+
pytest
80+
81+
82+
build-windows:
83+
runs-on: windows-latest
84+
strategy:
85+
fail-fast: false
86+
matrix:
87+
#python-version: ["3.11"]
88+
python-version: ["3.8", "3.9", "3.10", "3.11"]
89+
90+
env:
91+
PYTHONPATH: D:\a\physicelldataloader\physicelldataloader
92+
93+
steps:
94+
- uses: actions/checkout@v3
95+
- name: Set up Python ${{ matrix.python-version }}
96+
uses: actions/setup-python@v3
97+
with:
98+
python-version: ${{ matrix.python-version }}
99+
- name: Install dependencies
100+
run: |
101+
choco install ffmpeg imagemagick
102+
python -m pip install --upgrade pip
103+
python -m pip install flake8 pytest matplotlib numpy pandas scipy requests anndata
104+
#echo 'set PYTHONPATH=D:\a\physicelldataloader\physicelldataloader' >> $GITHUB_ENV
105+
#if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
106+
- name: Lint with flake8
107+
run: |
108+
# stop the build if there are Python syntax errors or undefined names
109+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
110+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
111+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
112+
- name: Test with pytest
113+
run: |
114+
pytest
115+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ build/
1616
dist/
1717
pcdl.egg-info/
1818

19+
# jupyter
20+
**/.ipynb_checkpoints/

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The pcdl python3 library maintains three branches branches:
1616

1717

1818
## Header:
19-
+ Language: python >= 3.6
19+
+ Language: python [>= 3.8](https://devguide.python.org/versions/)
2020
+ Library dependencies: anndata, matplotlib, numpy, pandas, scipy
2121
+ Date of origin original PhysiCell-Tools python-loader: 2019-09-02
2222
+ Date of origin pcdl fork: 2022-08-30
@@ -32,7 +32,7 @@ The pcdl python3 library maintains three branches branches:
3232

3333
## Tutorial:
3434
+ Check out: [man/TUTORIAL.md](https://github.com/elmbeech/physicelldataloader/tree/master/man/TUTORIAL.md)!
35-
35+
+ Check out: [man/jupyter/pcdl\_repl\_programming.ipynb](https://github.com/elmbeech/physicelldataloader/tree/master/man/jupyter/pcdl_repl_programming.ipynb)
3636

3737
## Reference Manual:
3838
+ Check out: [man/REFERENCE.md](https://github.com/elmbeech/physicelldataloader/tree/master/man/REFERENCE.md)!
@@ -67,10 +67,24 @@ Within the pcdl library, we tried to stick to the documentation policy lined out
6767

6868
## Road Map:
6969
+ [vtk file format](https://docs.vtk.org/en/latest/design_documents/VTKFileFormats.html) output, maybe [stl](https://en.wikipedia.org/wiki/STL_(file_format)) and [wavefront obj](https://en.wikipedia.org/wiki/Wavefront_.obj_file) output.
70-
+ [GML](https://en.wikipedia.org/wiki/Graph_Modelling_Language) ([networkx](https://networkx.org/) compatible) graph output.
70+
+ [GML](https://en.wikipedia.org/wiki/Graph_Modelling_Language) ([networkx](https://networkx.org/) and [igraph](https://igraph.org/) compatible) output.
7171

7272

7373
## Release Notes:
74+
+ version 3.2.12 (2023-08-12): elmbeech/physicelldatalodader
75+
+ add **pcdl_repl_programming.ipynb** : Jupyter notebook to give an idea about how to work with pcdl in a Python3 REPL.
76+
+ add github **continuous integration**, all supported python versions, all supported operating systems.
77+
78+
+ version 3.2.11 (2023-08-08): elmbeech/physicelldatalodader
79+
+ **pip install pcdl**: will only install the bare minimum library dependencies.
80+
+ **pip install pcdl[data]**: will install the minimum dependencies plus the dependencies to download the test dataset.
81+
+ **pip install pcdl[scverse]**: will install the minimum dependencies plus the dependencies needed to generate anndata object.
82+
+ **pip install pcdl[all]**: will always install all dependencies.
83+
+ new TimeSeries **get_annmcds_list** function, which, points to the self.l\_annmcds object.
84+
+ new pyMCDS **get_scatter** function split off from pyMCDSts make\_imgcell.
85+
+ pyMCDSts **make_imgcell** and **make_imgsubs** bug fixes.
86+
+ TimeStep and TimeSeries **get_anndata** evolution.
87+
7488
+ version 3.2.10 (2023-07-24): elmbeech/physicelldataloader
7589
+ rename pyMCDSts get\_cell\_df\_columns\_states to **get_cell_df_states** for conciseness.
7690
+ rename pyMCDSts get\_conc\_df\_columns\_states to **get_conc_df_states** for conciseness.

man/HOWTO.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,23 @@
22

33
## How to install the latest physicelldataloader?
44

5+
Full-fledged installation, with all library dependencies installed.
56
```bash
6-
pip3 install pcdl
7+
pip3 install pcdl[all]
78
```
89

10+
If necessary, you can tweak your installation to make it more lightweight.
11+
```bash
12+
pip3 install pcdl # The bare minimum. Installs only the pcdl core library dependencies.
13+
pip3 install pcdl[data] # Installs pcdl core and test data library dependencies.
14+
pip3 install pcdl[scverse] # Installs pcdl core and anndata library dependencies.
15+
pip3 install pcdl[all] # Installs pcdl core, test data, and anndata library dependencies.
16+
```
917

1018
## How to update to the latest physicelldataloader?
1119

1220
```bash
13-
pip3 install -U pcdl
21+
pip3 install -U pcdl[all]
1422
```
1523

1624

@@ -19,6 +27,7 @@ pip3 install -U pcdl
1927
Note: For the pcdl library this is a two-step procedure.
2028
First, possibly installed test data and tutorial output will be removed.
2129
Then, the software will be uninstalled.
30+
Keep in mind that pcdl library dependencies (like anndata, matplotlib, numpy, pandas, scipy) will never be uninstalled automatically.
2231

2332
```bash
2433
python3 -c "import pcdl; pcdl.uninstall_data()"
@@ -54,7 +63,7 @@ The pcDataLoader library will thereafter act as a simple gateway to the latest i
5463
In future, you can just update the pcdl package to go with the latest version.
5564

5665
```
57-
pip install -U pcDataLoader pcdl
66+
pip install -U pcDataLoader pcdl[all]
5867
```
5968

6069

man/REFERENCE.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The **workhorse functions** are the ones most important for data analysis.
1313
Familiarize yourself with all of their parameters!
1414

1515

16-
# TimeStep
16+
# TimeStep Class
1717
```python3
1818
help(pcdl.TimeStep) # ! make class instance
1919
help(pcdl.TimeStep.__init__)
@@ -55,6 +55,7 @@ help(pcdl.TimeStep.get_celltype_dict)
5555
help(pcdl.TimeStep.get_cell_variables)
5656
help(pcdl.TimeStep.get_cell_df) # ! workhorse function
5757
help(pcdl.TimeStep.get_cell_df_at)
58+
help(pcdl.TimeStep.get_scatter) # ! workhorse function
5859

5960
# TimeStep graphs
6061
help(pcdl.TimeStep.get_attached_graph_dict) # !
@@ -74,7 +75,7 @@ help(pcdl.TimeStep.scaler)
7475
```
7576

7677

77-
# TimeStep time series
78+
# TimeSeries Class
7879
```python3
7980
help(pcdl.TimeSeries) # ! make class instance
8081
help(pcdl.TimeSeries.__init__)
@@ -83,6 +84,7 @@ help(pcdl.TimeSeries.__init__)
8384
help(pcdl.TimeSeries.get_xmlfile_list)
8485
help(pcdl.TimeSeries.read_mcds)
8586
help(pcdl.TimeSeries.get_mcds_list) # ! workhorse function
87+
help(pcdl.TimeSeries.get_annmcds_list) # ! workhorse function
8688

8789
# TimeSeries triage data
8890
help(pcdl.TimeSeries.get_cell_df_states) # ! workhorse function

man/TUTORIAL.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,17 @@ df.shape # (3, 94)
349349
df = mcds.get_cell_df_at(x=111,y=22,z=-5.1) # None and Warning @ pyMCDS.is_in_mesh : z = -5.1 out of bounds: z-range is (-5.0, 5.0)
350350
```
351351

352+
Additionally, there is a scatter plot function available, shaped for df\_cell dataframe content.
353+
```
354+
# scatter plot
355+
fig = mcds.get_scatter() # default focus is cell_type and z_slice=0
356+
fig.show()
357+
358+
fig = mcds.get_scatter('oxygen', z_slice=3.333)
359+
fig.show()
360+
```
361+
362+
352363
Since lately, PhysiCell tracks for each cell, if this cell touches other cells.\
353364
This data is stored in two dictionaries of sets of integers which link the corresponding cell IDs.\
354365
We have here a closer look at the neighbor graph because the attached graph is in this particular study not really interesting.
@@ -719,21 +730,25 @@ mcdsts = pcdl.TimeSeries(s_path)
719730
A mcds time series can be translated into one single anndata (default).
720731
```python
721732
ann = mcdsts.get_anndata(states=2, scale='maxabs', collapse=True)
722-
print(ann) # AnnData object with n_obs × n_vars = 24758 × 27
723-
# obs: 'ID', 'current_phase', 'cycle_model'
733+
print(ann) # AnnData object with n_obs × n_vars = 889 × 26
734+
# obs: 'z_layer', 'time', 'current_phase', 'cycle_model'
724735
# obsm: 'spatial'
725736
```
726737
The output tells us that we have loaded a time series with 24758 cell (agent) snapshots and 27 features.
727738
And that we have spatial coordinate annotation (position\_x, position\_y, position\_z, time) of the loaded data.
728739

729-
730-
A mcds time series can be translated into a dictionary of anndata objects, where each entry is a single time step.
740+
A mcds time series can be translated into a chronological list of anndata objects, where each entry is a single time step.
741+
After running get\_anndata, you can access the objects by the get\_annmcds\_list function.
731742
```python
732-
d_ann = mcdsts.get_anndata(states=2, scale='maxabs', collapse=False)
733-
d_ann.keys() # dict_keys([0, 60, ..., 1440])
734-
d_ann[1440] # AnnData object with n_obs × n_vars = 1099 × 27
735-
# obs: 'ID', 'current_phase', 'cycle_model'
736-
# obsm: 'spatial'
743+
l_ann = mcdsts.get_anndata(states=2, scale='maxabs', collapse=False)
744+
len(l_ann) # 25
745+
l_ann[24] # AnnData object with n_obs × n_vars = 1099 × 79
746+
# obs: 'z_layer', 'time', 'cell_type', 'current_death_model', 'current_phase', 'cycle_model'
747+
# obsm: 'spatial'
748+
749+
# load all snapshots
750+
mcdsts.get_annmcds_list() # YMMV! [AnnData object with n_obs × n_vars ..., ..., ... obsm: 'spatial']
751+
len(mcdsts.get_annmcds_list()) # 25
737752
```
738753

739754

189 KB
Loading

0 commit comments

Comments
 (0)