Skip to content

Commit

Permalink
add cell details entry keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Tianhao-Gu committed Oct 16, 2023
1 parent ee93fcc commit 547b3bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 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

0 comments on commit 547b3bf

Please sign in to comment.