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

Go cam viz #823

Open
wants to merge 84 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
2798405
Add @geneontology/wc-gocam-viz/loader package.
dlrice Jul 22, 2024
33db87f
Add wc-gocam-viz module types.
dlrice Jul 22, 2024
46e30a4
Create GoCamViz wrapper around wc.
dlrice Jul 22, 2024
2718779
Add GoCam component.
dlrice Jul 22, 2024
e01ac22
Add GoCap to function section.
dlrice Jul 22, 2024
6313446
Add go-cam-viz.module.scss
dlrice Jul 23, 2024
4de38ea
Add NoctuaAlliancePathwayPreview url.
dlrice Jul 23, 2024
f0db1ff
Style tweak.
dlrice Jul 23, 2024
adeda43
Snapshot update.
dlrice Jul 23, 2024
6d8da70
Merge remote-tracking branch 'origin/main' into go-cam-viz
dlrice Oct 7, 2024
e8cdfb0
Add gocam url; fetch model ids.
dlrice Oct 22, 2024
3c88995
Provide go-cam id selection; styling.
dlrice Oct 23, 2024
eaa0274
Use TreeSelect for go-cam model selection.
dlrice Oct 24, 2024
75324bb
Update Complex Viewer to use TreeSelect rather than drodown.
dlrice Oct 24, 2024
7ea79da
Remove now unused util fn.
dlrice Oct 24, 2024
0e3d5aa
Update tests.
dlrice Oct 24, 2024
287747f
Use native select for go-cam model selection; style tweaks.
dlrice Nov 1, 2024
b2cc0f1
Use native select for complex selection; style tweaks.
dlrice Nov 1, 2024
db86794
Try to sort out lazy loading of go-cam.
dlrice Nov 1, 2024
91a1b83
Tidy up InteractionSection.
dlrice Nov 1, 2024
5bf40e1
Remove duplicate import.
dlrice Nov 1, 2024
7bf298a
Try to sort out lazy loading of go-cam again.
dlrice Nov 1, 2024
b609e77
Use tabs for go ribbon and go cam.
dlrice Nov 1, 2024
23886bc
Import order fix.
dlrice Nov 1, 2024
3b576dc
Upgrade @geneontology/wc-gocam-viz to latest version.
dlrice Nov 11, 2024
54ec131
Add preamble to GO tabs.
dlrice Nov 11, 2024
2590dd1
Add New chip to GO-CAM tab title.
dlrice Nov 11, 2024
c27ceb6
Snapshot update.
dlrice Nov 11, 2024
b4b5b6f
Update tab title.
dlrice Nov 13, 2024
ca6dfd5
Only show go-cam models which are uniprotkb curated.
dlrice Dec 6, 2024
c4995cb
Report loading and no go-cam models to user.
dlrice Dec 9, 2024
ebd096f
Update go-cam tab title.
dlrice Dec 9, 2024
fb54b25
Snapshot update.
dlrice Dec 9, 2024
baed1b5
Don't cache GO tabs.
dlrice Dec 9, 2024
20241e8
Only fetch go cam model info if goCamIdToItem has items.
dlrice Dec 9, 2024
fa23c31
Merge remote-tracking branch 'origin/main' into go-cam-viz
dlrice Dec 10, 2024
af2c607
Add help doc links; twerk loading logic.
dlrice Dec 10, 2024
b9331bc
Merge remote-tracking branch 'origin/main' into go-cam-viz
dlrice Dec 18, 2024
6124c87
Adjust coverage.
dlrice Dec 18, 2024
e2f2be9
Tweak go-cam loading logic.
dlrice Dec 23, 2024
377d539
Hide both GO tabs if no GO ids.
dlrice Dec 23, 2024
996f706
Update InteractionSection tests.
dlrice Dec 23, 2024
11573f6
Update comment.
dlrice Dec 23, 2024
38431f5
Test getGoCamStructures.
dlrice Dec 23, 2024
4a6947b
Test isUniprotCurated.
dlrice Dec 23, 2024
e87bbe8
Lower coverage threshold.
dlrice Dec 23, 2024
50aff0c
Remove old go help article link.
dlrice Jan 7, 2025
826faac
Merge remote-tracking branch 'origin/main' into go-cam-viz
dlrice Feb 3, 2025
21d3f98
Update wc-gocam-viz to 1.1.1-beta.3
dlrice Feb 3, 2025
fcb9882
Merge remote-tracking branch 'origin/main' into go-cam-viz
dlrice Feb 6, 2025
4d793ec
Upgrade @geneontology/wc-gocam-viz to 1.1.1
dlrice Feb 6, 2025
a46fefd
Adapt GO-CAM model fetching to use p-map.
dlrice Feb 6, 2025
e6c5040
Tweak go-cam-viz styles.
dlrice Feb 11, 2025
7d3aa62
Adapt Tabs.
dlrice Feb 13, 2025
ee232bc
Don't try to goto history tab if already there.
dlrice Feb 13, 2025
53ef4c3
Update tabs in the BasketMiniView.
dlrice Feb 13, 2025
a4b2a83
Add bordered option to GO tabs and SimilarProteins.
dlrice Feb 13, 2025
7bfe931
Add bordered optoin to SubEntrySimilarProteins, Subcell Location, Sta…
dlrice Feb 13, 2025
d673e04
Remove unused imports.
dlrice Feb 13, 2025
56433c1
Conditionally disable GO-CAMs based on reviewed/unreviewed entry type.
dlrice Feb 13, 2025
22379d9
Hide process-label.
dlrice Feb 17, 2025
251ece5
Show relevant viz node as chip above go-cam viz.
dlrice Feb 18, 2025
937891c
Add netlify.toml.
dlrice Feb 18, 2025
2b60aa6
Gitignore local Netlify folder.
dlrice Feb 18, 2025
e779878
Remove unneeded colours import.
dlrice Feb 18, 2025
085243c
Use Custom Properties throughout go-cam-viz styles.
dlrice Feb 18, 2025
7a88eb5
Adapt tests to use real mock data.
dlrice Feb 19, 2025
df00c5b
Use useSafeState in when loading wc-gocam-viz.
dlrice Feb 19, 2025
1f3016a
useSafeState for gocam to node map.
dlrice Feb 19, 2025
0cd1be0
Cancel all of the gocam reqeusts if users navigates away.
dlrice Feb 19, 2025
bc0dccf
Exclude the organism eg Hsap.
dlrice Feb 19, 2025
3ac9be0
Add missing hook dep.
dlrice Feb 19, 2025
fc16089
Update snapshots.
dlrice Feb 19, 2025
3ec1003
Rename build:ux-netlify to build:netlify
dlrice Feb 19, 2025
ce2aba2
Add deploy:netlify script.
dlrice Feb 19, 2025
0d1021c
Wording tweak.
dlrice Feb 20, 2025
3f91eb0
Try to adjust styles for more consistent link indication.
dlrice Feb 20, 2025
995960f
More style tweaks.
dlrice Feb 20, 2025
aa0607e
Make go-cam-viz layout tighter.
dlrice Feb 20, 2025
6ec710f
More white space tweakings.
dlrice Feb 20, 2025
1f0267e
Bold text in the go-cam panel. Tweak colors.
dlrice Feb 20, 2025
df57d28
Add activity-color-link-hover and tweak button-background-hover color…
dlrice Feb 20, 2025
10f36c7
Case tweak.
dlrice Feb 20, 2025
2eac5c6
Table and GO tabs spacing tweaks.
dlrice Feb 21, 2025
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"string-width": "4.1.0"
},
"dependencies": {
"@geneontology/wc-gocam-viz": "1.0.1-beta.2",
"@hello-pangea/dnd": "17.0.0",
"@lit/react": "1.0.5",
"@nightingale-elements/nightingale-msa": "5.0.0",
Expand Down
4 changes: 3 additions & 1 deletion src/app/components/home-page/styles/non-critical.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
& > * {
position: relative;

text-shadow: -1px -1px 0 white, 1px 1px 0 white;
text-shadow:
-1px -1px 0 white,
1px 1px 0 white;
}

& img {
Expand Down
4 changes: 4 additions & 0 deletions src/shared/config/externalUrls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const externalUrls = {
`https://www.ebi.ac.uk/intact/complex-ws/export/${id}`,
ComplexPortal: (id: string) =>
`https://www.ebi.ac.uk/complexportal/complex/${id}`,
GeneOntologyModels: (id: string) =>
`https://api.geneontology.org/api/gp/UniProtKB:${id}/models`,
// rule
HAMAPRule: (id: string | number) => `//hamap.expasy.org/unirule/${id}`,
ProRule: (id: string | number) => `//prosite.expasy.org/unirule/${id}`,
Expand Down Expand Up @@ -73,6 +75,8 @@ const externalUrls = {
`https://www.ebi.ac.uk/chebi/searchId.do?chebiId=${id}`,
EspacenetPatent: (id: string | number) =>
`https://worldwide.espacenet.com/textdoc?DB=EPODOC&IDX=${id}`,
NoctuaAlliancePathwayPreview: (id: string) =>
`http://noctua.geneontology.org/workbench/noctua-alliance-pathway-preview/?model_id=${id}`,
};

export const getIntActQueryUrl = (
Expand Down
8 changes: 8 additions & 0 deletions src/types/wc-gocam-viz.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
declare module '@geneontology/wc-gocam-viz';

declare namespace JSX {
interface IntrinsicElements {
'wc-gocam-viz': any;
}
}
21 changes: 10 additions & 11 deletions src/uniparc/config/UniParcXRefsColumnConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,17 +260,16 @@ UniParcXRefsColumnConfiguration.set(UniParcXRefsColumn.lastSeen, {
});

const getTimelineColumn =
(firstSeen?: string, lastSeen?: string) => (xref: UniParcXRef) =>
(
<div className={xref.active ? undefined : 'xref-inactive'}>
<Timeline
first={firstSeen}
last={lastSeen}
start={xref.created}
end={xref.lastUpdated}
/>
</div>
);
(firstSeen?: string, lastSeen?: string) => (xref: UniParcXRef) => (
<div className={xref.active ? undefined : 'xref-inactive'}>
<Timeline
first={firstSeen}
last={lastSeen}
start={xref.created}
end={xref.lastUpdated}
/>
</div>
);

UniParcXRefsColumnConfiguration.set(UniParcXRefsColumn.timeline, {
label: 'Timeline',
Expand Down
11 changes: 9 additions & 2 deletions src/uniprotkb/components/entry/FunctionSection.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { lazy, Suspense, Fragment, memo } from 'react';
import { Card, Loader, Message } from 'franklin-sites';
import { Card, Loader, Message, Tabs } from 'franklin-sites';
import { Link } from 'react-router-dom';

import ErrorBoundary from '../../../shared/components/error-component/ErrorBoundary';

import HTMLHead from '../../../shared/components/HTMLHead';
import FreeTextView, {
RichText,
Expand All @@ -16,6 +15,7 @@ import FeaturesView from '../protein-data-views/UniProtKBFeaturesView';
import UniProtKBEvidenceTag from '../protein-data-views/UniProtKBEvidenceTag';
import KineticsTableView from './KineticsTableView';
import ExternalLink from '../../../shared/components/ExternalLink';
import GoCam from './GoCam';

import { useSmallScreen } from '../../../shared/hooks/useMatchMedia';

Expand Down Expand Up @@ -376,6 +376,13 @@ const FunctionSection = ({
/>
</Suspense>
</ErrorBoundary>
<ErrorBoundary>
<Tabs>
<Suspense fallback={<Loader />}>
<GoCam primaryAccession={primaryAccession} />
</Suspense>
</Tabs>
</ErrorBoundary>
<KeywordView keywords={data.keywordData} />
<XRefView xrefs={data.xrefData} primaryAccession={primaryAccession} />
<CommunityCuration
Expand Down
104 changes: 104 additions & 0 deletions src/uniprotkb/components/entry/GoCam.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import { useEffect, useMemo, useState } from 'react';
import { ExternalLink, Loader, Tab, Tabs, TreeSelect } from 'franklin-sites';

import GoCamViz from '../protein-data-views/GoCamViz';
import ErrorHandler from '../../../shared/components/error-pages/ErrorHandler';
import LazyComponent from '../../../shared/components/LazyComponent';

import { useSmallScreen } from '../../../shared/hooks/useMatchMedia';
import useDataApi from '../../../shared/hooks/useDataApi';

import externalUrls from '../../../shared/config/externalUrls';

import styles from './styles/go-cam.module.scss';

const extractGoCamId = (url: string) => {
const reGoCamId = /https?:\/\/model\.geneontology\.org\/(?<goCamId>.*)/;
const m = url.match(reGoCamId);
return m?.groups?.goCamId;
};

const getGoCamStructures = (
data: GoCamModel[] = []
): [string[], { id: string; label: string }[]] => {
const ids = [];
const items = [];
for (const d of data) {
const goCamId = extractGoCamId(d.gocam);
if (goCamId) {
ids.push(goCamId);
items.push({
id: goCamId,
label: d.title,
});
}
}
return [ids, items];
};

export type GoCamModel = {
gocam: string;
title: string;
};

type Props = {
primaryAccession: string;
};

const GoCam = ({ primaryAccession }: Props) => {
const isSmallScreen = useSmallScreen();
const [selectedId, setSelectedId] = useState<string | null>(null);
const { data, loading, error, status } = useDataApi<GoCamModel[]>(
isSmallScreen ? null : externalUrls.GeneOntologyModels(primaryAccession)
);

const [goCamIds, goCamItems] = useMemo(
() => getGoCamStructures(data),
[data]
);

useEffect(() => {
if (goCamIds?.[0]) {
setSelectedId(goCamIds[0]);
}
}, [goCamIds]);

if (loading) {
return <Loader />;
}

if (error) {
return <ErrorHandler status={status} error={error} noReload />;
}

if (isSmallScreen || !goCamIds.length || !selectedId) {
return null;
}

return (
<Tabs>
<Tab title="GO-CAM">
<div className={styles['go-cam-container']}>
<TreeSelect
data={goCamItems}
label="Select GO-CAM model"
onSelect={(item) => {
setSelectedId(item.id);
}}
defaultActiveNodes={[selectedId]}
/>
<LazyComponent>
<GoCamViz id={selectedId} />
</LazyComponent>
<ExternalLink
url={externalUrls.NoctuaAlliancePathwayPreview(selectedId)}
>
View in Noctua Alliance Pathway Preview
</ExternalLink>
</div>
</Tab>
</Tabs>
);
};

export default GoCam;
54 changes: 13 additions & 41 deletions src/uniprotkb/components/entry/InteractionSection.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { lazy, useMemo, memo, useState } from 'react';
import { Link } from 'react-router-dom';
import { Button, Card, Dropdown, Tab, Tabs } from 'franklin-sites';
import { Card, Tab, Tabs, TreeSelect } from 'franklin-sites';

import { SetRequired } from 'type-fest/source/set-required';
import ExternalLink from '../../../shared/components/ExternalLink';
Expand Down Expand Up @@ -35,15 +35,6 @@ import { Xref } from '../../../shared/types/apiModel';

import styles from './styles/interaction-section.module.scss';

const clickOnDropdown = (element: HTMLElement) => {
(
element.closest('.dropdown')?.firstElementChild as
| HTMLElement
| null
| undefined
)?.click();
};

const interactionSorter = (a: Interaction, b: Interaction) => {
// Normalise what we'll sort on
const aOneComparer = (
Expand Down Expand Up @@ -288,38 +279,19 @@ const InteractionSection = ({ data, primaryAccession }: Props) => {
{complexPortalXrefs.size ? (
<Tab cache title="Complex viewer">
<div className={styles['viewer-ids-container']}>
<Dropdown
// eslint-disable-next-line react/no-unstable-nested-components
visibleElement={(onClick: () => unknown) => (
<Button variant="primary" onClick={onClick}>
{complexString}
</Button>
<TreeSelect
label={complexString}
onSelect={(item) => {
setViewerID(item.id);
}}
defaultActiveNodes={[complexId]}
data={Array.from(complexPortalXrefs.values()).map(
({ id, properties }) => ({
id,
label: `${id} ${properties?.EntryName || ''}`,
})
)}
>
<ul className={styles['ids-list']}>
{Array.from(complexPortalXrefs.values()).map(
({ id, properties }) => (
<li key={id}>
<Button
variant="tertiary"
key={id}
id={id}
onClick={(event) => {
setViewerID(
(event.target as HTMLButtonElement).id
);
clickOnDropdown(
event.target as HTMLButtonElement
);
}}
>
{id} {properties?.EntryName || ''}
</Button>
</li>
)
)}
</ul>
</Dropdown>
/>
<LazyComponent>
<ComplexViewer complexID={complexId} />
</LazyComponent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ describe('InteractionSection', () => {
'CPX-1062 Amyloid-beta protein 40/42 complex'
);
fireEvent.click(dropdownButton);
const selectButton = screen.getByText(/CPX-1069/, {
selector: '.button.tertiary',
});
const selectButton = screen.getByRole('button', { name: /CPX-1069/ });
fireEvent.click(selectButton, { target: { innerText: 'CPX-1069' } });
expect(dropdownButton).toHaveTextContent(
'CPX-1069 Amyloid-beta protein 40 complex'
Expand Down
Loading