Skip to content

Commit

Permalink
Merge pull request #120 from molgenis/feat/tree_labels
Browse files Browse the repository at this point in the history
Use decision tree labels for categories
  • Loading branch information
dennishendriksen authored Nov 22, 2024
2 parents 9456d86 + 4e30270 commit d4ccf14
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/__tests__/apiClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,15 @@ test("postProcess - sample tree categories", async () => {
expect(metadata.format["VIPC_S"].categories).toEqual({
U1: {
description: "Usable: probably",
label: "U1",
label: "probably",
},
U2: {
description: "Usable: maybe",
label: "U2",
label: "maybe",
},
U3: {
description: "Usable: probably not",
label: "U3",
label: "probably not",
},
});
});
Expand All @@ -224,23 +224,23 @@ test("postProcess - decision tree categories", async () => {
const csqItem = csqItems.find((item) => item.id === "VIPC");
expect(csqItem.categories).toEqual({
B: {
label: "B",
label: "Benign",
},
LB: {
label: "LB",
label: "Likely Benign",
},
LP: {
label: "LP",
label: "Likely Pathogenic",
},
LQ: {
description: "Low quality variants.",
label: "LQ",
label: "LowQual",
},
P: {
label: "P",
label: "Pathogenic",
},
VUS: {
label: "VUS",
label: "Unknown Significance",
},
});
});
Expand Down
6 changes: 6 additions & 0 deletions src/__tests__/decisionTree.json
Original file line number Diff line number Diff line change
Expand Up @@ -326,27 +326,33 @@
}
},
"exit_lq": {
"label": "LowQual",
"description": "Low quality variants.",
"type": "LEAF",
"class": "LQ"
},
"exit_b": {
"label": "Benign",
"type": "LEAF",
"class": "B"
},
"exit_lb": {
"label": "Likely Benign",
"type": "LEAF",
"class": "LB"
},
"exit_vus": {
"label": "Unknown Significance",
"type": "LEAF",
"class": "VUS"
},
"exit_lp": {
"label": "Likely Pathogenic",
"type": "LEAF",
"class": "LP"
},
"exit_p": {
"label": "Pathogenic",
"type": "LEAF",
"class": "P"
}
Expand Down
3 changes: 3 additions & 0 deletions src/__tests__/sampleTree.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,19 @@
}
},
"exit_u1": {
"label": "probably",
"description": "Usable: probably",
"type": "LEAF",
"class": "U1"
},
"exit_u2": {
"label": "maybe",
"description": "Usable: maybe",
"type": "LEAF",
"class": "U2"
},
"exit_u3": {
"label": "probably not",
"description": "Usable: probably not",
"type": "LEAF",
"class": "U3"
Expand Down
4 changes: 2 additions & 2 deletions src/apiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class ApiClient implements Api {
.reduce(
(acc, node) => ({
...acc,
[node.class]: { label: node.class, description: node.description },
[node.class]: { label: node.label, description: node.description },
}),
{},
);
Expand All @@ -143,7 +143,7 @@ export class ApiClient implements Api {
.reduce(
(acc, node) => ({
...acc,
[node.class]: { label: node.class, description: node.description },
[node.class]: { label: node.label, description: node.description },
}),
{},
);
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ export interface LeafNode extends Node {

export interface Node {
type: Type;
label: string;
description: string;
}

Expand Down

0 comments on commit d4ccf14

Please sign in to comment.