Skip to content

Commit 86fdf1f

Browse files
authored
Adds IGV Viewer as Gen3 App (#659)
* Add IGV BAM viewer with genomic visualization support - Integrate `igv.js` library for BAM file viewing. - Implement `IGVApp` and related components for genomic exploration. - Enhance Explorer with `activeTab` support for routing. * Add IGV BAM viewer with genomic visualization support - Integrate `igv.js` library for BAM file viewing. - Implement `IGVApp` and related components for genomic exploration. - Enhance Explorer with `activeTab` support for routing. * add igv type declarations * add support for indexd * fix table link to IVG App * Refactor IGV components and enhance routing - Modularized `IGVApp` with `IGVAppPage`, `IGVBamPicker`, and `IGVExplorerViewer`. - Added new utility to handle multiple slashes in URLs. - Improved link rendering in the CohortBuilder table with optimized URL sanitization. * add igv app logo
1 parent a1769b1 commit 86fdf1f

File tree

30 files changed

+835
-23
lines changed

30 files changed

+835
-23
lines changed

package-lock.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/src/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export const GEN3_FENCE_API =
1717
process.env.NEXT_PUBLIC_GEN3_FENCE_API || `${GEN3_API}/user`;
1818
export const GEN3_FENCE_SERVICE =
1919
process.env.GEN3_FENCE_SERVICE || 'http://fence-service';
20+
export const GEN3_INDEXD_API =
21+
process.env.NEXT_PUBLIC_GEN3_INDEXD_API || `${GEN3_API}/index`;
2022
export const GEN3_AI_SEARCH_API =
2123
process.env.NEXT_PUBLIC_GEN3_AI_SEARCH_API || `${GEN3_API}/ai-search`;
2224
export const GEN3_AUTHZ_API =

packages/core/src/features/fence/fenceApi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ interface PresignedUrlRequest {
2828
readonly what: string;
2929
}
3030

31-
interface PresignedUrlResponse {
31+
export interface PresignedUrlResponse {
3232
readonly url: string;
3333
}
3434

packages/core/src/features/fence/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
type Gen3LoginProvider,
33
logoutFence,
44
type NameUrl,
5+
type PresignedUrlResponse,
56
useGetDownloadQuery,
67
useGetLoginProvidersQuery,
78
useGetPresignedUrlQuery,
@@ -31,6 +32,7 @@ export {
3132
type Gen3FenceCredentials,
3233
type Gen3LoginProvider,
3334
type NameUrl,
35+
type PresignedUrlResponse,
3436
fetchFence,
3537
logoutFence,
3638
isFetchError,
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {
2+
type IndexdResponse,
3+
type IndexObject,
4+
useGetIndexdMetdataQuery,
5+
useGetIndexObjectQuery,
6+
useLazyGetIndexdMetdataQuery,
7+
useLazyGetIndexObjectQuery,
8+
} from './indexdSlice';
9+
10+
export {
11+
useGetIndexdMetdataQuery,
12+
useLazyGetIndexdMetdataQuery,
13+
useGetIndexObjectQuery,
14+
useLazyGetIndexObjectQuery,
15+
type IndexdResponse,
16+
type IndexObject,
17+
};
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import { GEN3_INDEXD_API } from '../../constants';
2+
import { gen3Api } from '../gen3';
3+
import { KeyValuePair } from '../../types';
4+
5+
export interface IndexdMetadataRequestParams {
6+
limit?: number;
7+
filters: KeyValuePair[];
8+
}
9+
10+
export interface IndexObject {
11+
acl: string[];
12+
authz: string[];
13+
baseid: string;
14+
content_created_date: string | null;
15+
content_updated_date: string | null;
16+
created_date: string;
17+
description: string | null;
18+
did: string;
19+
file_name: string;
20+
form: string | null;
21+
hashes: {
22+
crc: string;
23+
md5: string;
24+
sha1: string;
25+
sha256: string;
26+
sha512: string;
27+
};
28+
metadata: Record<string, unknown>;
29+
rev: string;
30+
size: number;
31+
updated_date: string;
32+
uploader: string | null;
33+
urls: string[];
34+
urls_metadata: Record<string, Record<string, unknown>>;
35+
version: string | null;
36+
}
37+
38+
export interface IndexdResponse {
39+
acl: string | null;
40+
authz: string | null;
41+
file_name: string | null;
42+
hashes: string | null;
43+
ids: string | null;
44+
limit: number;
45+
metadata: Record<string, unknown>;
46+
page: number | null;
47+
did: string;
48+
size: number | null;
49+
start: number | null;
50+
urls: string[];
51+
urls_metadata: string | null;
52+
version: string | null;
53+
records: Array<IndexObject>;
54+
}
55+
56+
export const indexdApi = gen3Api.injectEndpoints({
57+
endpoints: (builder) => ({
58+
getIndexdMetdata: builder.query<
59+
IndexdResponse,
60+
IndexdMetadataRequestParams
61+
>({
62+
query: ({ filters, limit = 1000 }: IndexdMetadataRequestParams) => {
63+
const query = filters.reduce(
64+
(acc, filter) => `${acc}&${filter.key}=${filter.value}`,
65+
'',
66+
);
67+
return `${GEN3_INDEXD_API}/index?${query}&limit=${limit}`;
68+
},
69+
}),
70+
getIndexObject: builder.query<IndexObject, string>({
71+
query: (guid) => `${GEN3_INDEXD_API}/index/${guid}`,
72+
}),
73+
}),
74+
});
75+
76+
export const {
77+
useGetIndexdMetdataQuery,
78+
useLazyGetIndexdMetdataQuery,
79+
useGetIndexObjectQuery,
80+
useLazyGetIndexObjectQuery,
81+
} = indexdApi;

packages/core/src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
CART_LIMIT,
44
FILE_DELIMITERS,
55
FILE_FORMATS,
6+
GEN3_ANALYSIS_API,
67
GEN3_API,
78
GEN3_AUTHZ_API,
89
GEN3_AUTHZ_SERVICE,
@@ -13,6 +14,7 @@ import {
1314
GEN3_FENCE_API,
1415
GEN3_FENCE_SERVICE,
1516
GEN3_GUPPY_API,
17+
GEN3_INDEXD_API,
1618
GEN3_MANIFEST_API,
1719
GEN3_MDS_API,
1820
GEN3_REDIRECT_URL,
@@ -52,6 +54,7 @@ export * from './features/workspace';
5254
export * from './features/cart';
5355
export * from './features/config';
5456
export * from './features/cohortComparison';
57+
export * from './features/indexd';
5558

5659
export {
5760
type CoreState,
@@ -62,6 +65,7 @@ export {
6265
GEN3_GUPPY_API,
6366
GEN3_FENCE_API,
6467
GEN3_FENCE_SERVICE,
68+
GEN3_INDEXD_API,
6569
GEN3_AUTHZ_API,
6670
GEN3_AUTHZ_SERVICE,
6771
GEN3_MDS_API,
@@ -71,6 +75,7 @@ export {
7175
GEN3_CROSSWALK_API,
7276
GEN3_SOWER_API,
7377
GEN3_MANIFEST_API,
78+
GEN3_ANALYSIS_API,
7479
CART_LIMIT,
7580
FILE_DELIMITERS,
7681
FILE_FORMATS,

packages/core/src/types/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,3 +277,8 @@ export interface DataFetchingStatus {
277277
}
278278

279279
export type DataFetchingHook<T> = () => DataFetchingResult<T>;
280+
281+
export interface KeyValuePair {
282+
key: string;
283+
value: string;
284+
}

packages/frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
"graphiql": "^3.7.1",
9292
"graphql": "^16.9.0",
9393
"graphql-ws": "^5.14.0",
94+
"igv": "^3.7.3",
9495
"isomorphic-dompurify": "^2.32.0",
9596
"jose": "^6.1.0",
9697
"js-cookie": "^3.0.5",

packages/frontend/src/exports/app.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export { registerMetadataSchemaApp } from '../features/Dictionary/metadata/regis
44
export { registerCohortDiscoveryApp } from '../features/CohortDiscovery/registerApp';
55
export { registerExplorerDefaultCellRenderers } from '../features/CohortBuilder/ExplorerTable/ExplorerTableCellRenderers';
66
export { registerCohortBuilderDefaultPreviewRenderers } from '../features/CohortBuilder/ExplorerTable/ExploreTableDetails/ExplorerTableDetailsPanelFactory';
7+
export { registerIGVApp } from '../features/genomic/igv/registerApp';
78
export { type TenStringArray } from '../utils/types';
89
export {
910
createMantineTheme,

0 commit comments

Comments
 (0)