Skip to content

Commit

Permalink
Passthrough surface name
Browse files Browse the repository at this point in the history
  • Loading branch information
caiw committed Mar 8, 2024
1 parent 97404fa commit e1ddd2d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 32 deletions.
43 changes: 14 additions & 29 deletions invokers/invoker_run_nkg_plotting.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,26 @@
from pathlib import Path
from os import path
from pathlib import Path

from kymata.datasets.sample import KymataMirror2023Q3Dataset
from kymata.io.config import load_config
from kymata.io.nkg import load_expression_set
from kymata.plot.plot import expression_plot


# template invoker for printing out expression set .nkgs
def main():
config = load_config(str(Path(Path(__file__).parent.parent, "kymata", "config", "dataset4.yaml")))

path_to_nkg_files = Path(Path(path.abspath("")).parent, "kymata-toolbox-data", "output")

expression_data = load_expression_set(Path( path_to_nkg_files, "IL_gridsearch.nkg"))
expression_data += load_expression_set(Path( path_to_nkg_files, "STL_gridsearch.nkg"))
expression_data += load_expression_set(Path( path_to_nkg_files, "IL1_gridsearch.nkg"))
expression_data += load_expression_set(Path( path_to_nkg_files, "IL2_gridsearch.nkg"))
expression_data += load_expression_set(Path( path_to_nkg_files, "IL3_gridsearch.nkg"))
expression_data += load_expression_set(Path( path_to_nkg_files, "IL4_gridsearch.nkg"))
expression_data += load_expression_set(Path( path_to_nkg_files, "IL5_gridsearch.nkg"))
expression_data += load_expression_set(Path( path_to_nkg_files, "IL6_gridsearch.nkg"))
expression_data += load_expression_set(Path( path_to_nkg_files, "IL7_gridsearch.nkg"))
expression_data += load_expression_set(Path( path_to_nkg_files, "IL8_gridsearch.nkg"))
expression_data += load_expression_set(Path( path_to_nkg_files, "IL9_gridsearch.nkg"))
expression_data = KymataMirror2023Q3Dataset().to_expressionset()

expression_plot(expression_data,
color = {
'IL': '#b11e34',
'IL1': '#a201e9',
'IL2': '#a201e9',
'IL3': '#a201e9',
'IL4': '#a201e9',
'IL5': '#a201e9',
'IL6': '#a201e9',
'IL7': '#a201e9',
'IL8': '#a201e9',
'IL9': '#a201e9',
'STL': '#d388b5'
},
show_only=[
'CIECAM02 A',
'CIECAM02 a',
],
minimap_config=config,
)
minimap_view="caudal",
minimap_surface="inflated",
)

if __name__ == '__main__':
main()
7 changes: 4 additions & 3 deletions kymata/plot/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def _plot_minimap_sensor(expression_set: ExpressionSet, minimap_axis: pyplot.Axe
def _plot_minimap_hexel(expression_set: HexelExpressionSet,
show_functions: list[str],
lh_minimap_axis: pyplot.Axes, rh_minimap_axis: pyplot.Axes,
view: str,
view: str, surface: str,
colors: dict[str, Any], alpha_logp: float):
transparent = (0, 0, 0, 0)

Expand All @@ -209,7 +209,7 @@ def _plot_minimap_hexel(expression_set: HexelExpressionSet,
warn("Plotting on the fsaverage brain. Ensure that hexel numbers match those of the fsaverage brain.")
plot_kwargs = dict(
subject='fsaverage',
surface="inflated",
surface=surface,
views=view,
colormap=colormap,
smoothing_steps=1,
Expand Down Expand Up @@ -254,6 +254,7 @@ def expression_plot(
# Display options
minimap_config: Optional[dict[str, str]] = None,
minimap_view: str = "lateral",
minimap_surface: str = "inflated",
# I/O args
save_to: Optional[Path] = None,
overwrite: bool = True,
Expand Down Expand Up @@ -432,7 +433,7 @@ def expression_plot(
show_functions=show_only,
lh_minimap_axis=axes[_AxName.minimap_top],
rh_minimap_axis=axes[_AxName.minimap_bottom],
view=minimap_view,
view=minimap_view, surface=minimap_surface,
colors=color, alpha_logp=sidak_corrected_alpha)
else:
raise NotImplementedError()
Expand Down

0 comments on commit e1ddd2d

Please sign in to comment.