Skip to content

Commit da511ba

Browse files
authored
Update orthology association table (#930)
A first try at largely keeping our existing association table infrastructure but defining each section separately, doing the ortholog table specifically.
1 parent a1e2a3d commit da511ba

File tree

3 files changed

+76
-27
lines changed

3 files changed

+76
-27
lines changed

backend/src/monarch_py/solr_cli.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,7 @@ def multi_entity_associations(
210210
] = None,
211211
counterpart_category: Annotated[
212212
Optional[List[str]],
213-
typer.Option(
214-
"--counterpart-category",
215-
"-c",
216-
help="A comma-separated list of counterpart categories"
217-
),
213+
typer.Option("--counterpart-category", "-c", help="A comma-separated list of counterpart categories"),
218214
] = None,
219215
limit: fields.LimitOption = 20,
220216
offset: fields.OffsetOption = 0,
@@ -306,9 +302,7 @@ def histopheno(
306302

307303
@solr_app.command("association-counts")
308304
def association_counts(
309-
entity_id: Annotated[
310-
str, typer.Argument(help="The entity to get association counts for")
311-
],
305+
entity_id: Annotated[str, typer.Argument(help="The entity to get association counts for")],
312306
fmt: fields.FormatOption = fields.OutputFormat.json,
313307
output: fields.OutputOption = None,
314308
):

frontend/src/components/AppTable.vue

-15
Original file line numberDiff line numberDiff line change
@@ -454,21 +454,6 @@ const ariaSort = computed(() => {
454454
text-transform: capitalize;
455455
}
456456

457-
/* first th */
458-
.th:nth-child(1) {
459-
width: 30%;
460-
}
461-
462-
/* second th */
463-
.th:nth-child(2) {
464-
width: 5%;
465-
}
466-
467-
/* third th */
468-
.th:nth-child(3) {
469-
width: 30%;
470-
}
471-
472457
/** body cells */
473458
.td {
474459
border-bottom: solid 2px $light-gray;

frontend/src/pages/node/AssociationsTable.vue

+74-4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,31 @@
2424
:total="associations.total"
2525
@download="download"
2626
>
27+
<!-- ortholog -->
28+
<template #ortholog="{ row }">
29+
<AppNodeBadge
30+
v-if="row.direction === AssociationDirectionEnum.outgoing"
31+
:node="{
32+
id: row.object,
33+
name: row.object_label,
34+
category: 'biolink:Gene',
35+
info: row.object_taxon_label,
36+
}"
37+
:breadcrumbs="getBreadcrumbs(node, row, 'subject')"
38+
/>
39+
40+
<AppNodeBadge
41+
v-if="row.direction === AssociationDirectionEnum.incoming"
42+
:node="{
43+
id: row.subject,
44+
name: row.subject_label,
45+
category: 'biolink:Gene',
46+
info: row.subject_taxon_label,
47+
}"
48+
:breadcrumbs="getBreadcrumbs(node, row, 'object')"
49+
/>
50+
</template>
51+
2752
<!-- subject -->
2853
<template #subject="{ row }">
2954
<AppNodeBadge
@@ -65,6 +90,15 @@
6590
<span v-else class="empty">No info</span>
6691
</template>
6792

93+
<template #has_evidence="{ row }">
94+
<AppLink
95+
v-for="source in row.has_evidence_links"
96+
:key="source.id"
97+
:to="source.url || ''"
98+
>{{ source.id }}</AppLink
99+
>
100+
</template>
101+
68102
<!-- button to show details -->
69103
<template #details="{ row }">
70104
<AppButton text="Details" icon="info-circle" @click="openModal(row)" />
@@ -180,8 +214,46 @@ const search = ref("");
180214

181215
type Datum = keyof DirectionalAssociation;
182216

217+
/** Orholog columns */
218+
219+
const orthologColoumns = computed<Cols<Datum>>(() => {
220+
return [
221+
{
222+
slot: "taxon",
223+
key: "taxon" as Datum,
224+
heading: "Taxon",
225+
},
226+
{
227+
slot: "ortholog",
228+
key: "ortholog" as Datum,
229+
heading: "Ortholog",
230+
},
231+
{
232+
slot: "has_evidence",
233+
key: "has_evidence" as Datum,
234+
heading: "Evidence",
235+
},
236+
{
237+
slot: "primary_knowledge_source",
238+
key: "primary_knowledge_source" as Datum,
239+
heading: "Source",
240+
},
241+
{ slot: "divider" },
242+
{
243+
slot: "details",
244+
key: "evidence_count",
245+
heading: "Details",
246+
align: "center",
247+
},
248+
];
249+
});
250+
183251
/** table columns */
184252
const cols = computed((): Cols<Datum> => {
253+
if (props.category.id.includes("GeneToGeneHomology")) {
254+
return orthologColoumns.value;
255+
}
256+
185257
/** standard columns, always present */
186258
const baseCols: Cols<Datum> = [
187259
{
@@ -219,14 +291,12 @@ const cols = computed((): Cols<Datum> => {
219291
let extraCols: Cols<Datum> = [];
220292

221293
/** taxon column. exists for many categories, so just add if any row has taxon. */
222-
if (
223-
props.category.id.includes("GeneToGeneHomology") ||
224-
props.category.id.includes("Interaction")
225-
)
294+
if (props.category.id.includes("Interaction")) {
226295
extraCols.push({
227296
slot: "taxon",
228297
heading: "Taxon",
229298
});
299+
}
230300

231301
if (
232302
props.node.in_taxon_label == "Homo sapiens" &&

0 commit comments

Comments
 (0)