Skip to content

Commit

Permalink
Merge branch 'main' into atar-mg-data-file
Browse files Browse the repository at this point in the history
  • Loading branch information
atarashansky authored May 10, 2024
2 parents 316a1c7 + 841cb18 commit a8f1e38
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 33 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/push-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44.0.0
uses: tj-actions/changed-files@v44.3.0
with:
files: |
Dockerfile*
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44.0.0
uses: tj-actions/changed-files@v44.3.0
with:
files: |
Dockerfile*
Expand Down Expand Up @@ -201,7 +201,7 @@ jobs:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44.0.0
uses: tj-actions/changed-files@v44.3.0
with:
files: |
Dockerfile*
Expand Down Expand Up @@ -260,7 +260,7 @@ jobs:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44.0.0
uses: tj-actions/changed-files@v44.3.0
with:
files: |
Dockerfile*
Expand Down Expand Up @@ -316,7 +316,7 @@ jobs:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44.0.0
uses: tj-actions/changed-files@v44.3.0
with:
files: |
Dockerfile*
Expand Down Expand Up @@ -372,7 +372,7 @@ jobs:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44.0.0
uses: tj-actions/changed-files@v44.3.0
with:
files: |
Dockerfile*
Expand Down Expand Up @@ -431,7 +431,7 @@ jobs:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44.0.0
uses: tj-actions/changed-files@v44.3.0
with:
files: |
Dockerfile*
Expand Down
11 changes: 5 additions & 6 deletions backend/layers/processing/process_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,11 @@ def get_spatial_metadata(self, spatial_dict: Dict[str, Any]) -> Optional[Spatial
"""
is_single = spatial_dict.get("is_single")
has_fullres = False
# schema validation ensures nested 'fullres' key is only included when is_single is True
if is_single:
# schema validation ensures there can only be one other key in uns["spatial"] if "is_single" is True
library_id = [key for key in spatial_dict if key != "is_single"][0]
if "fullres" in spatial_dict[library_id]["images"]:
has_fullres = True
spatial_library_ids = [key for key in spatial_dict if key != "is_single"]
# schema validation ensures there can only be at max, one other key in uns["spatial"] if "is_single" is True
library_id = spatial_library_ids.pop() if spatial_library_ids else None
if library_id and "images" in spatial_dict[library_id] and "fullres" in spatial_dict[library_id]["images"]:
has_fullres = True
return SpatialMetadata(is_single=bool(is_single), has_fullres=has_fullres)

@logit
Expand Down
20 changes: 5 additions & 15 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,8 @@ loginState.json
public/sitemap*
public/robots.txt

# Cell Guide
src/views/CellGuide/common/fixtures/allCellTypeDescriptions.json
src/views/CellGuide/common/fixtures/allCellTypeDescriptionsSEO.json
src/views/CellGuide/common/fixtures/allCellTypeMarkerGenes.json
src/views/CellGuide/common/fixtures/allCellTypeOwlDescriptions.json
src/views/CellGuide/common/fixtures/allCellTypes.json
src/views/CellGuide/common/fixtures/allEnrichedGenes/
src/views/CellGuide/common/fixtures/allSourceData.json
src/views/CellGuide/common/fixtures/allTissueDescriptions.json
src/views/CellGuide/common/fixtures/allTissues.json
src/views/CellGuide/common/fixtures/ontologyTree.json
src/views/CellGuide/common/fixtures/ontologyTreeStatePerCellType.json
src/views/CellGuide/common/fixtures/ontologyTreeStatePerTissue.json

certificates
# Filter descendants
src/components/common/Filter/descendant_mappings/cell_type_descendants.json
src/components/common/Filter/descendant_mappings/tissue_descendants.json

certificates
11 changes: 11 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,25 @@ RUN apt-get update && apt-get install -y make wget \
lsb-release xdg-utils nano vim procps moreutils ripgrep \
&& rm -rf /var/lib/apt/lists/*

# Create the directory `make retrieve-descendants` expects before running npm ci, which runs `make retrieve-descendants`
# as a preinstall script
RUN mkdir -p src/components/common/Filter/descendant_mappings

COPY Makefile ./
COPY package*.json ./
RUN npm ci --verbose --no-optional && npm cache clean --force

ENV PATH /opt/node_app/node_modules/.bin:$PATH

# -- TODO, we should try turning this back on later.
# ADD --chown=node . /corpora-frontend
ADD . /corpora-frontend

# Explicitly copy the JSON files from the earlier steps
RUN cp -r /opt/node_app/src/components/common/Filter/descendant_mappings/* /corpora-frontend/src/components/common/Filter/descendant_mappings/

WORKDIR /corpora-frontend

ADD ./src/configs/build.js src/configs/configs.js
RUN mkdir -p node_modules
RUN ln -sf /opt/node_app/node_modules/* /opt/node_app/node_modules/.bin ./node_modules/.
Expand Down
1 change: 1 addition & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@
],
"license": "MIT",
"scripts": {
"predev": "make retrieve-descendants",
"prebuild": "make retrieve-descendants",
"preinstall": "make retrieve-descendants",
"dev": "next dev --experimental-https",
"build": "NODE_OPTIONS=\"--max_old_space_size=2048\" next build",
"start": "next start",
Expand Down

This file was deleted.

This file was deleted.

10 changes: 10 additions & 0 deletions frontend/src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@ namespace HubSpotFormAPI {
}

declare const hbspt: HubSpotFormAPI.HubSpot;

declare module "src/components/common/Filter/descendant_mappings/cell_type_descendants.json" {
const value: { [key: string]: string[] };
export default value;
}

declare module "src/components/common/Filter/descendant_mappings/tissue_descendants.json" {
const value: { [key: string]: string[] };
export default value;
}
8 changes: 7 additions & 1 deletion tests/unit/processing/test_extract_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def test_get_spatial_metadata__is_single_and_fullres_true(self):
}
self.assertEqual(self.pdv.get_spatial_metadata(spatial_dict), SpatialMetadata(is_single=True, has_fullres=True))

def test_get_spatial_metadata__is_single_true_fullres_false(self):
def test_get_spatial_metadata__is_single_true_and_fullres_false(self):
spatial_dict = {
"is_single": True,
"dummy_library_id": {"images": {}},
Expand All @@ -299,6 +299,12 @@ def test_get_spatial_metadata__is_single_true_fullres_false(self):
self.pdv.get_spatial_metadata(spatial_dict), SpatialMetadata(is_single=True, has_fullres=False)
)

def test_get_spatial_metadata__is_single_true_and_no_library_id(self):
spatial_dict = {"is_single": np.bool_(True)}
self.assertEqual(
self.pdv.get_spatial_metadata(spatial_dict), SpatialMetadata(is_single=True, has_fullres=False)
)

def test_get_spatial_metadata__is_single_false(self):
spatial_dict = {"is_single": np.bool_(False)}
self.assertEqual(
Expand Down

0 comments on commit a8f1e38

Please sign in to comment.