Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update orthology association table #930

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions backend/src/monarch_py/solr_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,7 @@ def multi_entity_associations(
] = None,
counterpart_category: Annotated[
Optional[List[str]],
typer.Option(
"--counterpart-category",
"-c",
help="A comma-separated list of counterpart categories"
),
typer.Option("--counterpart-category", "-c", help="A comma-separated list of counterpart categories"),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was autoformatting from make format

] = None,
limit: fields.LimitOption = 20,
offset: fields.OffsetOption = 0,
Expand Down Expand Up @@ -306,9 +302,7 @@ def histopheno(

@solr_app.command("association-counts")
def association_counts(
entity_id: Annotated[
str, typer.Argument(help="The entity to get association counts for")
],
entity_id: Annotated[str, typer.Argument(help="The entity to get association counts for")],
fmt: fields.FormatOption = fields.OutputFormat.json,
output: fields.OutputOption = None,
):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autoformatting

Expand Down
15 changes: 0 additions & 15 deletions frontend/src/components/AppTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -454,21 +454,6 @@ const ariaSort = computed(() => {
text-transform: capitalize;
}

/* first th */
.th:nth-child(1) {
width: 30%;
}

/* second th */
.th:nth-child(2) {
width: 5%;
}

/* third th */
.th:nth-child(3) {
width: 30%;
}

/** body cells */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where I might be causing trouble by altering potentially broader impact css, but I think I'm actually reducing the trouble that this overly broad css was causing. This PR is the first of many for defining the columns for each association type separately, and it doesn't make sense that we'll always want these widths. Plus, if you scan through Human Disease on this branch, most tables look better, in particular it gives as much space as possible to disease models.

.td {
border-bottom: solid 2px $light-gray;
Expand Down
78 changes: 74 additions & 4 deletions frontend/src/pages/node/AssociationsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,31 @@
:total="associations.total"
@download="download"
>
<!-- ortholog -->
<template #ortholog="{ row }">
<AppNodeBadge
v-if="row.direction === AssociationDirectionEnum.outgoing"
:node="{
id: row.object,
name: row.object_label,
category: 'biolink:Gene',
info: row.object_taxon_label,
}"
:breadcrumbs="getBreadcrumbs(node, row, 'subject')"
/>

<AppNodeBadge
v-if="row.direction === AssociationDirectionEnum.incoming"
:node="{
id: row.subject,
name: row.subject_label,
category: 'biolink:Gene',
info: row.subject_taxon_label,
}"
:breadcrumbs="getBreadcrumbs(node, row, 'object')"
/>
</template>

<!-- subject -->
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how to display an ortholog cell

<template #subject="{ row }">
<AppNodeBadge
Expand Down Expand Up @@ -65,6 +90,15 @@
<span v-else class="empty">No info</span>
</template>

<template #has_evidence="{ row }">
<AppLink
v-for="(source, index) in row.has_evidence_links"
:key="index"
:to="source.url || ''"
>{{ source.id }}</AppLink
>
</template>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how to display a has_evidence cell (borrowed from SectionAssociationDetails)

<!-- button to show details -->
<template #details="{ row }">
<AppButton text="Details" icon="info-circle" @click="openModal(row)" />
Expand Down Expand Up @@ -180,8 +214,46 @@ const search = ref("");

type Datum = keyof DirectionalAssociation;

/** Orholog columns */

const orthologColoumns = computed<Cols<Datum>>(() => {
return [
{
slot: "taxon",
key: "taxon" as Datum,
heading: "Taxon",
},
{
slot: "ortholog",
key: "ortholog" as Datum,
heading: "Ortholog",
},
{
slot: "has_evidence",
key: "has_evidence" as Datum,
heading: "Evidence",
},
{
slot: "primary_knowledge_source",
key: "primary_knowledge_source" as Datum,
heading: "Source",
},
{ slot: "divider" },
{
slot: "details",
key: "evidence_count",
heading: "Details",
align: "center",
},
];
});

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which columns should be shown for the ortholog section

/** table columns */
const cols = computed((): Cols<Datum> => {
if (props.category.id.includes("GeneToGeneHomology")) {
return orthologColoumns.value;
}

/** standard columns, always present */
const baseCols: Cols<Datum> = [
{
Expand Down Expand Up @@ -219,14 +291,12 @@ const cols = computed((): Cols<Datum> => {
let extraCols: Cols<Datum> = [];

/** taxon column. exists for many categories, so just add if any row has taxon. */
if (
props.category.id.includes("GeneToGeneHomology") ||
props.category.id.includes("Interaction")
)
if (props.category.id.includes("Interaction")) {
extraCols.push({
slot: "taxon",
heading: "Taxon",
});
}

if (
props.node.in_taxon_label == "Homo sapiens" &&
Expand Down
Loading