Skip to content

Commit

Permalink
Merge pull request #506 from kbase/fix_biolog_data_parser
Browse files Browse the repository at this point in the history
Fix biolog data parser
  • Loading branch information
Tianhao-Gu authored Oct 16, 2023
2 parents 5cf038c + 547b3bf commit 1f94ddd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/common/product_models/heatmap_common_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
FIELD_HEATMAP_CATEGORY = "category"
FIELD_HEATMAP_COLUMNS = "columns"
FIELD_HEATMAP_CATEGORIES = "categories"
FIELD_HEATMAP_CELL_DETAIL_ENTRY_VALUE = "val"
FIELD_HEATMAP_CELL_DETAIL_ENTRY_ID = "id"


_FLD_CELL_ID = Field(
Expand Down
9 changes: 6 additions & 3 deletions src/loaders/compute_tools/microtrait/microtrait.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
FIELD_HEATMAP_DESCR,
FIELD_HEATMAP_TYPE,
FIELD_HEATMAP_CATEGORY,
ColumnType)
FIELD_HEATMAP_CELL_DETAIL_ENTRY_ID,
FIELD_HEATMAP_CELL_DETAIL_ENTRY_VALUE,
ColumnType,)
from src.common.storage.field_names import FLD_KBASE_ID
from src.loaders.common import loader_common_names
from src.loaders.compute_tools.tool_common import (
Expand Down Expand Up @@ -237,8 +239,9 @@ def _run_microtrait(tool_safe_data_id: str, data_id: str, fna_file: Path, genome

trait_counts_df[_DETECTED_GENE_SCORE_COL] = trait_counts_df[
loader_common_names.UNWRAPPED_GENE_COL].apply(
lambda x: {gene: detected_genes_score.get(gene) for gene in str(x).split(';') if
gene in detected_genes_score})
lambda x: [{FIELD_HEATMAP_CELL_DETAIL_ENTRY_ID: gene,
FIELD_HEATMAP_CELL_DETAIL_ENTRY_VALUE: detected_genes_score.get(gene)} for gene in
str(x).split(';') if gene in detected_genes_score])
else:
raise ValueError('Please set environment variable MT_TRAIT_UNWRAPPED_FILE')

Expand Down
6 changes: 5 additions & 1 deletion src/loaders/compute_tools/microtrait/versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ versions:
- version: 0.1.2
date: 2023-08-24
notes: |
- upgrade pydantic to 2.3.0
- upgrade pydantic to 2.3.0
- version: 0.1.3
date: 2023-10-16
notes: |
- fix cells value data type
2 changes: 1 addition & 1 deletion src/loaders/genome_collection/parse_PMI_biolog_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def generate_pmi_biolog_heatmap_data(
# append a document for the heatmap cell details
heatmap_cell_details.append({
FIELD_HEATMAP_CELL_ID: cell_uuid,
FIELD_HEATMAP_VALUES: dict(), # 'values' for biolog is always empty
FIELD_HEATMAP_VALUES: list(), # 'values' for biolog is always empty
FLD_COLLECTION_ID: kbase_collection,
FLD_LOAD_VERSION: load_ver,
FLD_ARANGO_KEY: collection_data_id_key(kbase_collection, load_ver, cell_uuid),
Expand Down

0 comments on commit 1f94ddd

Please sign in to comment.