Skip to content

Commit 2dca274

Browse files
authored
Merge pull request #217 from PhysiCell-Tools/development
Development
2 parents c0480c8 + e138ad4 commit 2dca274

7 files changed

Lines changed: 704 additions & 285 deletions

File tree

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.37.8
1+
2.37.9

bin/biwt_dev.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import os
2+
def biwt_dev_mode(biwt):
3+
BIWT_SPATIAL_DEV = os.getenv('BIWT_SPATIAL_DEV', 'False')
4+
BIWT_SPATIAL_DEV = BIWT_SPATIAL_DEV=='True'
5+
if BIWT_SPATIAL_DEV:
6+
# file_name = "./data/visium_adata.h5ad"
7+
# file_name = "./data/Zhuang-ABCA-1-1.064_raw_wClusterAnnots.h5ad"
8+
file_name = "./data/abc/metadata/Zhuang-ABCA-1/20231215/views/cell_metadata_with_cluster_annotation.csv"
9+
if "Zhuang" in file_name:
10+
biwt.column_line_edit.setText("subclass")
11+
else:
12+
biwt.column_line_edit.setText("cluster")
13+
biwt.import_file(file_name)
14+
# biwt.continue_from_import()
15+
# biwt.window.process_window() # process spatial y/n window
16+
# biwt.window.process_window() # process edit window
17+
# biwt.window.process_window() # process rename window
18+
# biwt.continue_from_spatial_query()
19+
# biwt.continue_from_edit()
20+
# biwt.window.process_window() # process rename window
21+
# biwt.set_cell_positions()
22+
# biwt.import_file("./data/visium_adata.h5ad")
23+
# biwt.continue_from_import()
24+
# biwt.continue_from_spatial_query()
25+
# biwt.continue_from_edit()
26+
# biwt.window.process_window() # process rename window
27+
# biwt.set_cell_positions()
28+
else:
29+
biwt.import_file("./data/pbmc3k_clustered.h5ad")
30+
biwt.continue_from_edit()
31+
biwt.window.process_window() # process rename window
32+
biwt.window.process_window() # process cell count window
33+
# biwt.continue_from_rename()
34+
# biwt.set_cell_positions()
Lines changed: 643 additions & 255 deletions
Large diffs are not rendered by default.

bin/cell_def_tab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def new_cell_def(self):
530530
else:
531531
break
532532

533-
self.new_cell_def_named(cdname) # added by DRB to make it easier for BioinfImport to add a new cell type programmatically
533+
self.new_cell_def_named(cdname) # added by DRB to make it easier for BIWT to add a new cell type programmatically
534534

535535
def new_cell_def_named(self, cdname):
536536

bin/ics_tab.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from PyQt5.QtGui import QPixmap
3131

3232
from studio_classes import QHLine
33-
from bioinf_import_tab import BioinfImport
33+
from biwt_tab import BioinformaticsWalkthrough
3434

3535
import numpy as np
3636
import matplotlib
@@ -66,7 +66,7 @@ def __init__(self,name):
6666

6767
class ICs(QWidget):
6868

69-
def __init__(self, config_tab, celldef_tab, bioinf_import_flag, bioinf_import_test, bioinf_import_test_spatial):
69+
def __init__(self, config_tab, celldef_tab, biwt_flag):
7070
super().__init__()
7171
# global self.config_params
7272

@@ -75,7 +75,7 @@ def __init__(self, config_tab, celldef_tab, bioinf_import_flag, bioinf_import_te
7575
self.celldef_tab = celldef_tab
7676
self.config_tab = config_tab
7777

78-
self.bioinf_import_flag = bioinf_import_flag
78+
self.biwt_flag = biwt_flag
7979

8080
# self.circle_radius = 100 # will be set in run_tab.py using the .xml
8181
# self.mech_voxel_size = 30
@@ -186,9 +186,9 @@ def __init__(self, config_tab, celldef_tab, bioinf_import_flag, bioinf_import_te
186186

187187
self.tab_widget = QTabWidget()
188188
self.base_tab_id = self.tab_widget.addTab(self.create_base_ics_tab(),"Base")
189-
if self.bioinf_import_flag:
190-
self.bioinf_import_tab = BioinfImport(self.config_tab, self.celldef_tab, self, bioinf_import_test, bioinf_import_test_spatial)
191-
self.tab_widget.addTab(self.bioinf_import_tab,"Bioinformatics Import")
189+
if self.biwt_flag:
190+
self.biwt_tab = BioinformaticsWalkthrough(self.config_tab, self.celldef_tab, self)
191+
self.tab_widget.addTab(self.biwt_tab,"BIWT")
192192

193193
self.layout = QVBoxLayout(self)
194194
self.layout.addWidget(self.tab_widget)
@@ -1943,8 +1943,8 @@ def import_from_file(self, full_path_rules_name):
19431943
def fill_gui(self):
19441944
self.csv_folder.setText(self.config_tab.csv_folder.text())
19451945
self.output_file.setText(self.config_tab.csv_file.text())
1946-
if self.bioinf_import_flag:
1947-
self.bioinf_import_tab.fill_gui()
1946+
if self.biwt_flag:
1947+
self.biwt_tab.fill_gui()
19481948

19491949
def on_enter_axes(self, event):
19501950
self.mouse_on_axes = True
@@ -1966,4 +1966,3 @@ def mouseMoved(self, event):
19661966
self.ax0.set_title(f"(x,y) = ({round(current_location[0])}, {round(current_location[1])})")
19671967
self.canvas.update()
19681968
self.canvas.draw()
1969-

bin/studio.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def quit_cb():
8080
studio_app.quit()
8181

8282
class PhysiCellXMLCreator(QWidget):
83-
def __init__(self, config_file, studio_flag, skip_validate_flag, rules_flag, model3D_flag, tensor_flag, exec_file, nanohub_flag, is_movable_flag, pytest_flag, bioinf_import_flag, bioinf_import_test_flag, bioinf_import_test_spatial_flag, parent = None):
83+
def __init__(self, config_file, studio_flag, skip_validate_flag, rules_flag, model3D_flag, tensor_flag, exec_file, nanohub_flag, is_movable_flag, pytest_flag, biwt_flag, parent = None):
8484
super(PhysiCellXMLCreator, self).__init__(parent)
8585
if model3D_flag:
8686
try:
@@ -106,7 +106,7 @@ def __init__(self, config_file, studio_flag, skip_validate_flag, rules_flag, mod
106106
self.nanohub_flag = nanohub_flag
107107
self.ecm_flag = False
108108
self.pytest_flag = pytest_flag
109-
self.bioinf_import_flag = bioinf_import_flag
109+
self.biwt_flag = biwt_flag
110110
print("PhysiCellXMLCreator(): self.nanohub_flag= ",self.nanohub_flag)
111111

112112
self.rules_tab_index = None
@@ -326,7 +326,7 @@ def __init__(self, config_file, studio_flag, skip_validate_flag, rules_flag, mod
326326

327327
if self.studio_flag:
328328
logging.debug(f'studio.py: creating ICs, Run, and Plot tabs')
329-
self.ics_tab = ICs(self.config_tab, self.celldef_tab, self.bioinf_import_flag, bioinf_import_test_flag, bioinf_import_test_spatial_flag)
329+
self.ics_tab = ICs(self.config_tab, self.celldef_tab, self.biwt_flag)
330330
self.ics_tab.fill_celltype_combobox()
331331
self.ics_tab.reset_info()
332332

@@ -1362,9 +1362,7 @@ def main():
13621362
nanohub_flag = False
13631363
is_movable_flag = False
13641364
pytest_flag = False
1365-
bioinf_import_flag = False
1366-
bioinf_import_test_flag = False
1367-
bioinf_import_test_spatial_flag = False
1365+
biwt_flag = False
13681366
try:
13691367
parser = argparse.ArgumentParser(description='PhysiCell Studio.')
13701368

@@ -1378,9 +1376,7 @@ def main():
13781376
parser.add_argument("-c ", "--config", type=str, help="config file (.xml)")
13791377
parser.add_argument("-e ", "--exec", type=str, help="executable model")
13801378
# parser.add_argument("-p ", "--pconfig", help="use config/PhysiCell_settings.xml", action="store_true")
1381-
parser.add_argument("--bioinf_import", help="display bioinformatics import tab on ICs tab", action="store_true")
1382-
parser.add_argument("--bioinf_import_test", help="immediately start loading anndata w/o spatial", action="store_true")
1383-
parser.add_argument("--bioinf_import_test_spatial", help="immediately start loading spatial anndata", action="store_true")
1379+
parser.add_argument("--bioinf_import","--biwt", dest="biwt_flag", help="display bioinformatics walkthrough tab on ICs tab", action="store_true")
13841380
if platform.system() == "Windows":
13851381
exec_file = 'project.exe'
13861382
else:
@@ -1453,12 +1449,8 @@ def main():
14531449
# else:
14541450
# print("config_file is NOT valid: ", config_file)
14551451
# sys.exit()
1456-
if args.bioinf_import:
1457-
bioinf_import_flag = True
1458-
if args.bioinf_import_test:
1459-
bioinf_import_test_flag = True
1460-
if args.bioinf_import_test_spatial:
1461-
bioinf_import_test_spatial_flag = True
1452+
if args.biwt_flag:
1453+
biwt_flag = True
14621454
except:
14631455
# print("Error parsing command line args.")
14641456
sys.exit(-1)
@@ -1539,7 +1531,8 @@ def main():
15391531
# print("Warning: Rules module not found.\n")
15401532

15411533
# print("calling PhysiCellXMLCreator with rules_flag= ",rules_flag)
1542-
ex = PhysiCellXMLCreator(config_file, studio_flag, skip_validate_flag, rules_flag, model3D_flag, tensor_flag, exec_file, nanohub_flag, is_movable_flag, pytest_flag, bioinf_import_flag, bioinf_import_test_flag, bioinf_import_test_spatial_flag)
1534+
ex = PhysiCellXMLCreator(config_file, studio_flag, skip_validate_flag, rules_flag, model3D_flag, tensor_flag, exec_file, nanohub_flag, is_movable_flag, pytest_flag, biwt_flag
1535+
)
15431536
print("size=",ex.size()) # = PyQt5.QtCore.QSize(1100, 770)
15441537
# ex.setFixedWidth(1101) # = PyQt5.QtCore.QSize(1100, 770)
15451538
# print("width=",ex.size())

bin/studio_ecm.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def quit_cb():
7878

7979

8080
class PhysiCellXMLCreator(QWidget):
81-
def __init__(self, config_file, studio_flag, skip_validate_flag, rules_flag, model3D_flag, tensor_flag, exec_file, nanohub_flag, is_movable_flag, ecm_flag, pytest_flag, parent = None):
81+
def __init__(self, config_file, studio_flag, skip_validate_flag, rules_flag, model3D_flag, tensor_flag, exec_file, nanohub_flag, is_movable_flag, ecm_flag, pytest_flag, biwt_flag, parent = None):
8282
super(PhysiCellXMLCreator, self).__init__(parent)
8383
if ecm_flag:
8484
from vis_tab_ecm import Vis
@@ -106,6 +106,7 @@ def __init__(self, config_file, studio_flag, skip_validate_flag, rules_flag, mod
106106
self.nanohub_flag = nanohub_flag
107107
self.ecm_flag = ecm_flag
108108
self.pytest_flag = pytest_flag
109+
self.biwt_flag = biwt_flag
109110
print("PhysiCellXMLCreator(): self.nanohub_flag= ",self.nanohub_flag)
110111

111112
self.rules_tab_index = None
@@ -340,7 +341,7 @@ def __init__(self, config_file, studio_flag, skip_validate_flag, rules_flag, mod
340341

341342
if self.studio_flag:
342343
logging.debug(f'studio.py: creating ICs, Run, and Plot tabs')
343-
self.ics_tab = ICs(self.config_tab, self.celldef_tab, False, False, False)
344+
self.ics_tab = ICs(self.config_tab, self.celldef_tab, self.biwt_flag)
344345
self.ics_tab.fill_celltype_combobox()
345346
self.ics_tab.reset_info()
346347

@@ -1317,6 +1318,7 @@ def main():
13171318
nanohub_flag = False
13181319
is_movable_flag = False
13191320
pytest_flag = False
1321+
biwt_flag = False
13201322
try:
13211323
parser = argparse.ArgumentParser(description='PhysiCell Studio.')
13221324

@@ -1329,6 +1331,7 @@ def main():
13291331
# parser.add_argument("--is_movable", help="checkbox for mechanics is_movable", action="store_true")
13301332
parser.add_argument("-c", "--config", type=str, help="config file (.xml)")
13311333
parser.add_argument("-e", "--exec", type=str, help="executable model")
1334+
parser.add_argument("--bioinf_import","--biwt", dest="biwt_flag", help="display bioinformatics walkthrough tab on ICs tab", action="store_true")
13321335

13331336
exec_file = 'project' # for template sample
13341337

@@ -1395,6 +1398,8 @@ def main():
13951398
else:
13961399
print("exec_file is NOT valid: ", args.exec)
13971400
sys.exit()
1401+
if args.biwt_flag:
1402+
biwt_flag = True
13981403
except:
13991404
# print("Error parsing command line args.")
14001405
sys.exit(-1)
@@ -1468,7 +1473,7 @@ def main():
14681473
# print("Warning: Rules module not found.\n")
14691474

14701475
# print("calling PhysiCellXMLCreator with rules_flag= ",rules_flag)
1471-
ex = PhysiCellXMLCreator(config_file, studio_flag, skip_validate_flag, rules_flag, model3D_flag, tensor_flag, exec_file, nanohub_flag, is_movable_flag, ecm_flag, pytest_flag)
1476+
ex = PhysiCellXMLCreator(config_file, studio_flag, skip_validate_flag, rules_flag, model3D_flag, tensor_flag, exec_file, nanohub_flag, is_movable_flag, ecm_flag, pytest_flag, biwt_flag)
14721477
print("size=",ex.size()) # = PyQt5.QtCore.QSize(1100, 770)
14731478
# ex.setFixedWidth(1101) # = PyQt5.QtCore.QSize(1100, 770)
14741479
# print("width=",ex.size())

0 commit comments

Comments
 (0)