Skip to content

Commit

Permalink
feat(api): use gosling server instead of HiGlass server for gene sear…
Browse files Browse the repository at this point in the history
…ch (#1053)

feat: use gosling server instead of HiGlass server for gene search
  • Loading branch information
sehilyi committed Apr 25, 2024
1 parent f52ef3a commit f0ec117
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion editor/example/json-spec/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { EX_SPEC_CYTOBANDS } from './ideograms';
import { EX_SPEC_PILEUP } from './pileup';
import { EX_SPEC_TEMPLATE } from './track-template';
import { EX_SPEC_MOUSE_EVENT } from './mouse-event';
import { EX_SPEC_PERF_ALIGNMENT } from './perf-alignment'
import { EX_SPEC_PERF_ALIGNMENT } from './perf-alignment';
import { EX_SPEC_DEBUG } from './debug';

export const JsonExampleSpecs = {
Expand Down
9 changes: 2 additions & 7 deletions src/compiler/higlass-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Assembly, AxisPosition, Domain, DummyTrack, Orientation, ZoomLimit
import { getNumericDomain } from '../core/utils/scales';
import type { RelativePosition } from './bounding-box';
import { validateSpec } from '@gosling-lang/gosling-schema';
import { getAutoCompleteId, computeChromSizes } from '../core/utils/assembly';
import { getAutoCompleteObject, computeChromSizes } from '../core/utils/assembly';
import type { CompleteThemeDeep } from '../core/utils/theme';
import exampleHg from '../core/example/hg-view-config-1';
import { insertItemToArray } from '../core/utils/array';
Expand All @@ -15,12 +15,7 @@ export const HIGLASS_AXIS_SIZE = 30;
const getViewTemplate = (assembly?: Assembly) => {
return {
genomePositionSearchBoxVisible: false,
genomePositionSearchBox: {
autocompleteServer: 'https://higlass.io/api/v1',
autocompleteId: getAutoCompleteId(assembly),
chromInfoServer: 'https://higlass.io/api/v1',
chromInfoId: assembly ?? 'hg38'
},
genomePositionSearchBox: getAutoCompleteObject(assembly),
layout: { w: 12, h: 12, x: 0, y: 0 },
tracks: {
top: [],
Expand Down
22 changes: 17 additions & 5 deletions src/core/utils/assembly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,29 @@ const CRHOM_SIZES: { [assembly: string]: ChromSize } = Object.freeze({
/**
* Some presets of auto-complete IDs (`autocompleteId`) to search for genes using the HiGlass server.
*/
export function getAutoCompleteId(assembly?: Assembly) {
export function getAutoCompleteObject(assembly: Assembly = 'hg38') {
const base = {
autocompleteServer: 'https://server.gosling-lang.org/api/v1',
chromInfoServer: 'https://server.gosling-lang.org/api/v1',
chromInfoId: assembly
};
switch (assembly) {
case 'hg19':
return 'OHJakQICQD6gTD7skx4EWA';
return { ...base, autocompleteId: 'gene-annotation-hg19' };
case 'mm10':
return 'QDutvmyiSrec5nX4pA5WGQ';
return { ...base, autocompleteId: 'gene-annotation-mm10' };
case 'mm9':
return 'GUm5aBiLRCyz2PsBea7Yzg';
// mm9 is not supported by the Gosling server, so we use HiGlass server.
// To support, we need to add mm9 gene annotation to the Gosling server.
return {
...base,
autocompleteServer: 'https://higlass.io/api/v1',
chromInfoServer: 'https://higlass.io/api/v1',
autocompleteId: 'GUm5aBiLRCyz2PsBea7Yzg'
};
case 'hg38':
default:
return 'P0PLbQMwTYGy-5uPIQid7A';
return { ...base, autocompleteId: 'gene-annotation' };
}
}

Expand Down

0 comments on commit f0ec117

Please sign in to comment.