Skip to content

Commit

Permalink
Removed manual channel mapping for EPICs (#99)
Browse files Browse the repository at this point in the history
* Removed manual channel mapping for EPICs

* Updated vitessce and fixed builder

* Fixed python version and configs

* Updated readme

* Updated pytest version

* Updated python version

* Fixed np.str_ issue during test

* Bumped version
  • Loading branch information
tkakar authored Dec 18, 2024
1 parent e84b829 commit 12dbd45
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 163 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/portal-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
with:
submodules: 'recursive'

- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: '3.10'
architecture: 'x64'

- name: Install python main dependencies
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ usage: vis-preview.py [-h] (--url URL | --json JSON) [--assets_url URL]
Given HuBMAP Dataset JSON, generate a Vitessce viewconf, and load vitessce.io.
optional arguments:
options:
-h, --help show this help message and exit
--url URL URL which returns Dataset JSON
--json JSON File containing Dataset JSON
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.6
0.3.7
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pytest==5.2.1
pytest==7.0.0
flake8==7.0.0
autopep8==2.0.4
pytest-mock==3.7.0
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ scripts =
package_dir =
= src
packages = find:
python_requires = >=3.7
python_requires = >=3.10
install_requires =
# Currently pinned due to the added `spatialdata` dependency
# having a lot of uncapped dependencies that are causing conflicts with search-api downstream.
vitessce==3.4.0
vitessce==3.5.0
hubmap-commons>=2.0.15
requests>=2.27.1
nbformat==5.1.3
Expand Down
3 changes: 1 addition & 2 deletions src/portal_visualization/builders/anndata_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def _set_up_marker_gene(self, marker):
# Future improvement to be implemented in CAT-137
# elif (encoding_version == "0.2.0"):
# print('TODO - Encoding Version 0.2.0 support')
self._marker = marker
self._marker = str(marker) if marker is not None else None
self._gene_alias = gene_alias

def _set_up_dataset(self, vc):
Expand Down Expand Up @@ -600,7 +600,6 @@ def _setup_anndata_view_config(self, vc, dataset, column_name, column_label):
obs_set_coordination, obs_color_coordination = vc.add_coordination(
ct.OBS_SET_SELECTION, ct.OBS_COLOR_ENCODING)
genomic_profiles.use_coordination(obs_set_coordination, obs_color_coordination)

obs_set_coordination.set_value(obs_set_coordinations)
obs_color_coordination.set_value('cellSetSelection')

Expand Down
14 changes: 2 additions & 12 deletions src/portal_visualization/builders/epic_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,9 @@ def read_segmentation_scale(self): # pragma: no cover


def create_segmentation_objects(base_url, mask_names): # pragma: no cover
spatialTargetCMapping = {
'arteries-arterioles': 4,
'glomeruli': 2,
'tubules': 3,
}
segmentation_objects = []
segmentations_CL = []
for index, mask_name in enumerate(mask_names):
for mask_name in mask_names:
color_channel = generate_unique_color()
mask_url = f'{base_url}/{mask_name}.zarr'
segmentations_zarr = AnnDataWrapper(
Expand All @@ -187,13 +182,8 @@ def create_segmentation_objects(base_url, mask_names): # pragma: no cover
"obsType": mask_name
}
)
# TODO: manually adjusted for the test dataset, need to be fixed on Vitessce side
if all(mask in mask_names for mask in spatialTargetCMapping.keys()):
channelIndex = spatialTargetCMapping[mask_name]
else:
channelIndex = index
seg_CL = {
"spatialTargetC": channelIndex,
"spatialTargetC": mask_name,
"obsType": mask_name,
"spatialChannelOpacity": 1,
"spatialChannelColor": color_channel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,13 @@
"obsColorEncoding": "A",
"obsSetSelection": "A"
},
"h": 6.0,
"h": 6,
"props": {
"embeddingCellSetLabelsVisible": false
},
"w": 3.0,
"x": 0.0,
"y": 0.0
"w": 3,
"x": 0,
"y": 0
},
{
"component": "scatterplot",
Expand All @@ -200,13 +200,13 @@
"obsColorEncoding": "A",
"obsSetSelection": "A"
},
"h": 6.0,
"h": 6,
"props": {
"embeddingCellSetLabelsVisible": false
},
"w": 3.0,
"x": 3.0,
"y": 0.0
"w": 3,
"x": 3,
"y": 0
},
{
"component": "scatterplot",
Expand All @@ -219,13 +219,13 @@
"obsColorEncoding": "A",
"obsSetSelection": "A"
},
"h": 6.0,
"h": 6,
"props": {
"embeddingCellSetLabelsVisible": false
},
"w": 3.0,
"x": 6.0,
"y": 0.0
"w": 3,
"x": 6,
"y": 0
},
{
"component": "featureList",
Expand All @@ -238,10 +238,10 @@
"obsColorEncoding": "A",
"obsSetSelection": "A"
},
"h": 6.0,
"w": 3.0,
"x": 9.0,
"y": 6.0
"h": 6,
"w": 3,
"x": 9,
"y": 6
},
{
"component": "featureList",
Expand All @@ -254,10 +254,10 @@
"obsColorEncoding": "A",
"obsSetSelection": "A"
},
"h": 6.0,
"w": 3.0,
"x": 6.0,
"y": 6.0
"h": 6,
"w": 3,
"x": 6,
"y": 6
},
{
"component": "genomicProfiles",
Expand All @@ -266,13 +266,13 @@
"obsColorEncoding": "B",
"obsSetSelection": "B"
},
"h": 6.0,
"h": 6,
"props": {
"title": "Leiden (Weighted Nearest Neighbor) Genomic Profiles"
},
"w": 6.0,
"x": 0.0,
"y": 6.0
"w": 6,
"x": 0,
"y": 6
},
{
"component": "obsSets",
Expand All @@ -283,10 +283,10 @@
"obsColorEncoding": "A",
"obsSetSelection": "A"
},
"h": 6.0,
"w": 3.0,
"x": 9.0,
"y": 0.0
"h": 6,
"w": 3,
"x": 9,
"y": 0
}
],
"name": "Leiden (Weighted Nearest Neighbor)",
Expand Down Expand Up @@ -472,13 +472,13 @@
"obsColorEncoding": "A",
"obsSetSelection": "A"
},
"h": 6.0,
"h": 6,
"props": {
"embeddingCellSetLabelsVisible": false
},
"w": 3.0,
"x": 0.0,
"y": 0.0
"w": 3,
"x": 0,
"y": 0
},
{
"component": "scatterplot",
Expand All @@ -493,13 +493,13 @@
"obsColorEncoding": "A",
"obsSetSelection": "A"
},
"h": 6.0,
"h": 6,
"props": {
"embeddingCellSetLabelsVisible": false
},
"w": 3.0,
"x": 3.0,
"y": 0.0
"w": 3,
"x": 3,
"y": 0
},
{
"component": "scatterplot",
Expand All @@ -512,13 +512,13 @@
"obsColorEncoding": "A",
"obsSetSelection": "A"
},
"h": 6.0,
"h": 6,
"props": {
"embeddingCellSetLabelsVisible": false
},
"w": 3.0,
"x": 6.0,
"y": 0.0
"w": 3,
"x": 6,
"y": 0
},
{
"component": "featureList",
Expand All @@ -531,10 +531,10 @@
"obsColorEncoding": "A",
"obsSetSelection": "A"
},
"h": 6.0,
"w": 3.0,
"x": 9.0,
"y": 6.0
"h": 6,
"w": 3,
"x": 9,
"y": 6
},
{
"component": "featureList",
Expand All @@ -547,10 +547,10 @@
"obsColorEncoding": "A",
"obsSetSelection": "A"
},
"h": 6.0,
"w": 3.0,
"x": 6.0,
"y": 6.0
"h": 6,
"w": 3,
"x": 6,
"y": 6
},
{
"component": "genomicProfiles",
Expand All @@ -559,13 +559,13 @@
"obsColorEncoding": "B",
"obsSetSelection": "B"
},
"h": 6.0,
"h": 6,
"props": {
"title": "Leiden (RNA) Genomic Profiles"
},
"w": 6.0,
"x": 0.0,
"y": 6.0
"w": 6,
"x": 0,
"y": 6
},
{
"component": "obsSets",
Expand All @@ -576,13 +576,13 @@
"obsColorEncoding": "A",
"obsSetSelection": "A"
},
"h": 6.0,
"w": 3.0,
"x": 9.0,
"y": 0.0
"h": 6,
"w": 3,
"x": 9,
"y": 0
}
],
"name": "Leiden (RNA)",
"version": "1.0.15"
}
]
]
Loading

0 comments on commit 12dbd45

Please sign in to comment.