@jbrowse/plugin-arc 2.7.1 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/LinearPairedArcDisplay/afterAttach.d.ts +2 -0
- package/dist/LinearPairedArcDisplay/afterAttach.js +11 -0
- package/dist/LinearPairedArcDisplay/components/Arcs.d.ts +7 -0
- package/dist/LinearPairedArcDisplay/components/Arcs.js +138 -0
- package/dist/LinearPairedArcDisplay/components/BaseDisplayComponent.d.ts +7 -0
- package/dist/LinearPairedArcDisplay/components/BaseDisplayComponent.js +40 -0
- package/dist/LinearPairedArcDisplay/components/ReactComponent.d.ts +7 -0
- package/dist/LinearPairedArcDisplay/components/ReactComponent.js +14 -0
- package/dist/LinearPairedArcDisplay/configSchema.d.ts +36 -0
- package/dist/LinearPairedArcDisplay/configSchema.js +28 -0
- package/dist/LinearPairedArcDisplay/fetchChains.d.ts +27 -0
- package/dist/LinearPairedArcDisplay/fetchChains.js +22 -0
- package/dist/LinearPairedArcDisplay/index.d.ts +2 -0
- package/dist/LinearPairedArcDisplay/index.js +44 -0
- package/dist/LinearPairedArcDisplay/model.d.ts +161 -0
- package/dist/LinearPairedArcDisplay/model.js +129 -0
- package/dist/LinearPairedArcDisplay/renderSvg.d.ts +5 -0
- package/dist/LinearPairedArcDisplay/renderSvg.js +23 -0
- package/dist/LinearPairedArcDisplay/util.d.ts +27 -0
- package/dist/LinearPairedArcDisplay/util.js +131 -0
- package/dist/index.js +23 -2
- package/esm/LinearPairedArcDisplay/afterAttach.d.ts +2 -0
- package/esm/LinearPairedArcDisplay/afterAttach.js +7 -0
- package/esm/LinearPairedArcDisplay/components/Arcs.d.ts +7 -0
- package/esm/LinearPairedArcDisplay/components/Arcs.js +113 -0
- package/esm/LinearPairedArcDisplay/components/BaseDisplayComponent.d.ts +7 -0
- package/esm/LinearPairedArcDisplay/components/BaseDisplayComponent.js +35 -0
- package/esm/LinearPairedArcDisplay/components/ReactComponent.d.ts +7 -0
- package/esm/LinearPairedArcDisplay/components/ReactComponent.js +9 -0
- package/esm/LinearPairedArcDisplay/configSchema.d.ts +36 -0
- package/esm/LinearPairedArcDisplay/configSchema.js +24 -0
- package/esm/LinearPairedArcDisplay/fetchChains.d.ts +27 -0
- package/esm/LinearPairedArcDisplay/fetchChains.js +18 -0
- package/esm/LinearPairedArcDisplay/index.d.ts +2 -0
- package/esm/LinearPairedArcDisplay/index.js +18 -0
- package/esm/LinearPairedArcDisplay/model.d.ts +161 -0
- package/esm/LinearPairedArcDisplay/model.js +102 -0
- package/esm/LinearPairedArcDisplay/renderSvg.d.ts +5 -0
- package/esm/LinearPairedArcDisplay/renderSvg.js +16 -0
- package/esm/LinearPairedArcDisplay/util.d.ts +27 -0
- package/esm/LinearPairedArcDisplay/util.js +121 -0
- package/esm/index.js +23 -2
- package/package.json +2 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DisplayType } from '@jbrowse/core/pluggableElementTypes';
|
|
2
|
+
import { configSchemaFactory } from './configSchema';
|
|
3
|
+
import { stateModelFactory } from './model';
|
|
4
|
+
import { lazy } from 'react';
|
|
5
|
+
export default function LinearPairedArcDisplayF(pluginManager) {
|
|
6
|
+
pluginManager.addDisplayType(() => {
|
|
7
|
+
const configSchema = configSchemaFactory();
|
|
8
|
+
return new DisplayType({
|
|
9
|
+
name: 'LinearPairedArcDisplay',
|
|
10
|
+
displayName: 'Arc display',
|
|
11
|
+
configSchema,
|
|
12
|
+
stateModel: stateModelFactory(configSchema),
|
|
13
|
+
trackType: 'VariantTrack',
|
|
14
|
+
viewType: 'LinearGenomeView',
|
|
15
|
+
ReactComponent: lazy(() => import('./components/ReactComponent')),
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration';
|
|
3
|
+
import { Instance } from 'mobx-state-tree';
|
|
4
|
+
import { Feature } from '@jbrowse/core/util';
|
|
5
|
+
/**
|
|
6
|
+
* #stateModel LinearPairedArcDisplay
|
|
7
|
+
* extends BaseDisplay, TrackHeightMixin, FeatureDensityMixin
|
|
8
|
+
*/
|
|
9
|
+
export declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): import("mobx-state-tree").IModelType<{
|
|
10
|
+
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
11
|
+
type: import("mobx-state-tree").ISimpleType<string>;
|
|
12
|
+
rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
13
|
+
} & {
|
|
14
|
+
heightPreConfig: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
15
|
+
} & {
|
|
16
|
+
userBpPerPxLimit: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
17
|
+
userByteSizeLimit: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
18
|
+
} & {
|
|
19
|
+
/**
|
|
20
|
+
* #property
|
|
21
|
+
*/
|
|
22
|
+
type: import("mobx-state-tree").ISimpleType<"LinearPairedArcDisplay">;
|
|
23
|
+
/**
|
|
24
|
+
* #property
|
|
25
|
+
*/
|
|
26
|
+
configuration: AnyConfigurationSchemaType;
|
|
27
|
+
/**
|
|
28
|
+
* #property
|
|
29
|
+
*/
|
|
30
|
+
displayMode: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
31
|
+
}, {
|
|
32
|
+
rendererTypeName: string;
|
|
33
|
+
error: unknown;
|
|
34
|
+
message: string | undefined;
|
|
35
|
+
} & {
|
|
36
|
+
readonly RenderingComponent: React.FC<{
|
|
37
|
+
model: {
|
|
38
|
+
id: string;
|
|
39
|
+
type: string;
|
|
40
|
+
rpcDriverName: string | undefined;
|
|
41
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
42
|
+
rendererTypeName: string;
|
|
43
|
+
error: unknown;
|
|
44
|
+
message: string | undefined;
|
|
45
|
+
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
46
|
+
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
47
|
+
type: import("mobx-state-tree").ISimpleType<string>;
|
|
48
|
+
rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
49
|
+
}, {
|
|
50
|
+
rendererTypeName: string;
|
|
51
|
+
error: unknown;
|
|
52
|
+
message: string | undefined;
|
|
53
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
54
|
+
onHorizontalScroll?: Function | undefined;
|
|
55
|
+
blockState?: Record<string, any> | undefined;
|
|
56
|
+
}>;
|
|
57
|
+
readonly DisplayBlurb: React.FC<{
|
|
58
|
+
model: {
|
|
59
|
+
id: string;
|
|
60
|
+
type: string;
|
|
61
|
+
rpcDriverName: string | undefined;
|
|
62
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
63
|
+
rendererTypeName: string;
|
|
64
|
+
error: unknown;
|
|
65
|
+
message: string | undefined;
|
|
66
|
+
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
67
|
+
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
68
|
+
type: import("mobx-state-tree").ISimpleType<string>;
|
|
69
|
+
rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
70
|
+
}, {
|
|
71
|
+
rendererTypeName: string;
|
|
72
|
+
error: unknown;
|
|
73
|
+
message: string | undefined;
|
|
74
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
75
|
+
}> | null;
|
|
76
|
+
readonly adapterConfig: any;
|
|
77
|
+
readonly parentTrack: any;
|
|
78
|
+
renderProps(): any;
|
|
79
|
+
readonly rendererType: import("@jbrowse/core/pluggableElementTypes").RendererType;
|
|
80
|
+
readonly DisplayMessageComponent: React.FC<any> | undefined;
|
|
81
|
+
trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
|
|
82
|
+
readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[];
|
|
83
|
+
regionCannotBeRendered(): null;
|
|
84
|
+
} & {
|
|
85
|
+
setMessage(arg?: string | undefined): void;
|
|
86
|
+
setError(error?: unknown): void;
|
|
87
|
+
setRpcDriverName(rpcDriverName: string): void;
|
|
88
|
+
reload(): void;
|
|
89
|
+
} & {
|
|
90
|
+
scrollTop: number;
|
|
91
|
+
} & {
|
|
92
|
+
readonly height: number;
|
|
93
|
+
} & {
|
|
94
|
+
setScrollTop(scrollTop: number): void;
|
|
95
|
+
setHeight(displayHeight: number): number; /**
|
|
96
|
+
* #property
|
|
97
|
+
*/
|
|
98
|
+
resizeHeight(distance: number): number;
|
|
99
|
+
} & {
|
|
100
|
+
featureDensityStatsP: Promise<import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats> | undefined;
|
|
101
|
+
featureDensityStats: import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats | undefined;
|
|
102
|
+
currStatsBpPerPx: number;
|
|
103
|
+
} & {
|
|
104
|
+
readonly currentBytesRequested: number;
|
|
105
|
+
readonly currentFeatureScreenDensity: number;
|
|
106
|
+
readonly maxFeatureScreenDensity: any;
|
|
107
|
+
readonly featureDensityStatsReady: boolean;
|
|
108
|
+
readonly maxAllowableBytes: number;
|
|
109
|
+
} & {
|
|
110
|
+
afterAttach(): void;
|
|
111
|
+
} & {
|
|
112
|
+
setCurrStatsBpPerPx(n: number): void;
|
|
113
|
+
setFeatureDensityStatsLimit(stats?: import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats | undefined): void;
|
|
114
|
+
getFeatureDensityStats(): Promise<import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats>;
|
|
115
|
+
setFeatureDensityStatsP(arg: any): void;
|
|
116
|
+
setFeatureDensityStats(featureDensityStats?: import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats | undefined): void;
|
|
117
|
+
clearFeatureDensityStats(): void;
|
|
118
|
+
} & {
|
|
119
|
+
readonly regionTooLarge: boolean;
|
|
120
|
+
readonly regionTooLargeReason: string;
|
|
121
|
+
} & {
|
|
122
|
+
regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
|
|
123
|
+
regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): React.JSX.Element | null;
|
|
124
|
+
} & {
|
|
125
|
+
lastDrawnOffsetPx: number;
|
|
126
|
+
features: Feature[] | undefined;
|
|
127
|
+
loading: boolean;
|
|
128
|
+
drawn: boolean;
|
|
129
|
+
} & {
|
|
130
|
+
/**
|
|
131
|
+
* #getter
|
|
132
|
+
*/
|
|
133
|
+
readonly displayModeSetting: any;
|
|
134
|
+
} & {
|
|
135
|
+
/**
|
|
136
|
+
* #action
|
|
137
|
+
*/
|
|
138
|
+
selectFeature(feature: Feature): void;
|
|
139
|
+
/**
|
|
140
|
+
* #action
|
|
141
|
+
*/
|
|
142
|
+
setLoading(flag: boolean): void;
|
|
143
|
+
/**
|
|
144
|
+
* #action
|
|
145
|
+
*/
|
|
146
|
+
setFeatures(f: Feature[]): void;
|
|
147
|
+
/**
|
|
148
|
+
* #action
|
|
149
|
+
*/
|
|
150
|
+
setDisplayMode(flag: string): void;
|
|
151
|
+
} & {
|
|
152
|
+
afterAttach(): void;
|
|
153
|
+
/**
|
|
154
|
+
* #action
|
|
155
|
+
*/
|
|
156
|
+
renderSvg(opts: {
|
|
157
|
+
rasterizeLayers?: boolean;
|
|
158
|
+
}): Promise<React.ReactNode>;
|
|
159
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
160
|
+
export type LinearArcDisplayStateModel = ReturnType<typeof stateModelFactory>;
|
|
161
|
+
export type LinearArcDisplayModel = Instance<LinearArcDisplayStateModel>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ConfigurationReference, getConf, } from '@jbrowse/core/configuration';
|
|
2
|
+
import { types } from 'mobx-state-tree';
|
|
3
|
+
import { getSession, isSessionModelWithWidgets, getContainingView, getContainingTrack, isSelectionContainer, } from '@jbrowse/core/util';
|
|
4
|
+
import { BaseDisplay } from '@jbrowse/core/pluggableElementTypes';
|
|
5
|
+
import { FeatureDensityMixin, TrackHeightMixin, } from '@jbrowse/plugin-linear-genome-view';
|
|
6
|
+
/**
|
|
7
|
+
* #stateModel LinearPairedArcDisplay
|
|
8
|
+
* extends BaseDisplay, TrackHeightMixin, FeatureDensityMixin
|
|
9
|
+
*/
|
|
10
|
+
export function stateModelFactory(configSchema) {
|
|
11
|
+
return types
|
|
12
|
+
.compose('LinearPairedArcDisplay', BaseDisplay, TrackHeightMixin(), FeatureDensityMixin(), types.model({
|
|
13
|
+
/**
|
|
14
|
+
* #property
|
|
15
|
+
*/
|
|
16
|
+
type: types.literal('LinearPairedArcDisplay'),
|
|
17
|
+
/**
|
|
18
|
+
* #property
|
|
19
|
+
*/
|
|
20
|
+
configuration: ConfigurationReference(configSchema),
|
|
21
|
+
/**
|
|
22
|
+
* #property
|
|
23
|
+
*/
|
|
24
|
+
displayMode: types.maybe(types.string),
|
|
25
|
+
}))
|
|
26
|
+
.volatile(() => ({
|
|
27
|
+
lastDrawnOffsetPx: 0,
|
|
28
|
+
features: undefined,
|
|
29
|
+
loading: false,
|
|
30
|
+
drawn: true,
|
|
31
|
+
}))
|
|
32
|
+
.views(self => ({
|
|
33
|
+
/**
|
|
34
|
+
* #getter
|
|
35
|
+
*/
|
|
36
|
+
get displayModeSetting() {
|
|
37
|
+
var _a;
|
|
38
|
+
return (_a = self.displayMode) !== null && _a !== void 0 ? _a : getConf(self, ['renderer', 'displayMode']);
|
|
39
|
+
},
|
|
40
|
+
}))
|
|
41
|
+
.actions(self => ({
|
|
42
|
+
/**
|
|
43
|
+
* #action
|
|
44
|
+
*/
|
|
45
|
+
selectFeature(feature) {
|
|
46
|
+
const session = getSession(self);
|
|
47
|
+
if (isSessionModelWithWidgets(session)) {
|
|
48
|
+
const featureWidget = session.addWidget('VariantFeatureWidget', 'variantFeature', {
|
|
49
|
+
view: getContainingView(self),
|
|
50
|
+
track: getContainingTrack(self),
|
|
51
|
+
featureData: feature.toJSON(),
|
|
52
|
+
});
|
|
53
|
+
session.showWidget(featureWidget);
|
|
54
|
+
}
|
|
55
|
+
if (isSelectionContainer(session)) {
|
|
56
|
+
session.setSelection(feature);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* #action
|
|
61
|
+
*/
|
|
62
|
+
setLoading(flag) {
|
|
63
|
+
self.loading = flag;
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* #action
|
|
67
|
+
*/
|
|
68
|
+
setFeatures(f) {
|
|
69
|
+
self.features = f;
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* #action
|
|
73
|
+
*/
|
|
74
|
+
setDisplayMode(flag) {
|
|
75
|
+
self.displayMode = flag;
|
|
76
|
+
},
|
|
77
|
+
}))
|
|
78
|
+
.actions(self => ({
|
|
79
|
+
afterAttach() {
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
81
|
+
;
|
|
82
|
+
(async () => {
|
|
83
|
+
try {
|
|
84
|
+
const { doAfterAttach } = await import('./afterAttach');
|
|
85
|
+
doAfterAttach(self);
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
console.error(e);
|
|
89
|
+
self.setError(e);
|
|
90
|
+
}
|
|
91
|
+
})();
|
|
92
|
+
},
|
|
93
|
+
/**
|
|
94
|
+
* #action
|
|
95
|
+
*/
|
|
96
|
+
async renderSvg(opts) {
|
|
97
|
+
const { renderArcSvg } = await import('./renderSvg');
|
|
98
|
+
// @ts-expect-error
|
|
99
|
+
return renderArcSvg(self, opts);
|
|
100
|
+
},
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getContainingView, when } from '@jbrowse/core/util';
|
|
3
|
+
import Arcs from './components/Arcs';
|
|
4
|
+
export async function renderArcSvg(model, _opts) {
|
|
5
|
+
await when(() => !model.loading);
|
|
6
|
+
const view = getContainingView(model);
|
|
7
|
+
const width = view.dynamicBlocks.totalWidthPx;
|
|
8
|
+
const height = model.height;
|
|
9
|
+
const clipid = 'arc-' + model.id;
|
|
10
|
+
return (React.createElement(React.Fragment, null,
|
|
11
|
+
React.createElement("defs", null,
|
|
12
|
+
React.createElement("clipPath", { id: clipid },
|
|
13
|
+
React.createElement("rect", { x: 0, y: 0, width: width, height: height }))),
|
|
14
|
+
React.createElement("g", { clipPath: `url(#${clipid})` },
|
|
15
|
+
React.createElement(Arcs, { model: model, exportSVG: true }))));
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
+
import { Feature, AugmentedRegion } from '@jbrowse/core/util';
|
|
3
|
+
import { IAnyStateTreeNode } from 'mobx-state-tree';
|
|
4
|
+
import { IAutorunOptions } from 'mobx';
|
|
5
|
+
export declare function getTag(feature: Feature, tag: string): any;
|
|
6
|
+
export declare function getTagAlt(feature: Feature, tag: string, alt: string): any;
|
|
7
|
+
export declare const orientationTypes: {
|
|
8
|
+
fr: Record<string, string>;
|
|
9
|
+
rf: Record<string, string>;
|
|
10
|
+
ff: Record<string, string>;
|
|
11
|
+
};
|
|
12
|
+
export declare const pairMap: {
|
|
13
|
+
readonly LR: "color_pair_lr";
|
|
14
|
+
readonly LL: "color_pair_ll";
|
|
15
|
+
readonly RR: "color_pair_rr";
|
|
16
|
+
readonly RL: "color_pair_rl";
|
|
17
|
+
};
|
|
18
|
+
export declare function getColorWGBS(strand: number, base: string): "#f00" | "#00f" | "#888";
|
|
19
|
+
export declare function fetchSequence(region: AugmentedRegion, adapter: BaseFeatureDataAdapter): Promise<any>;
|
|
20
|
+
export declare function shouldFetchReferenceSequence(type?: string): boolean;
|
|
21
|
+
export declare const modificationColors: Record<string, string | undefined>;
|
|
22
|
+
type DisplayModel = IAnyStateTreeNode & {
|
|
23
|
+
setError: (arg: unknown) => void;
|
|
24
|
+
};
|
|
25
|
+
export declare function createAutorun(self: DisplayModel, cb: () => Promise<void>, opts?: IAutorunOptions): void;
|
|
26
|
+
export declare function randomColor(): string;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { toArray } from 'rxjs/operators';
|
|
2
|
+
import { firstValueFrom } from 'rxjs';
|
|
3
|
+
import { addDisposer, isAlive } from 'mobx-state-tree';
|
|
4
|
+
import { autorun } from 'mobx';
|
|
5
|
+
// get tag from BAM or CRAM feature, where CRAM uses feature.get('tags') and
|
|
6
|
+
// BAM does not
|
|
7
|
+
export function getTag(feature, tag) {
|
|
8
|
+
const tags = feature.get('tags');
|
|
9
|
+
return tags !== undefined ? tags[tag] : feature.get(tag);
|
|
10
|
+
}
|
|
11
|
+
// use fallback alt tag, used in situations where upper case/lower case tags
|
|
12
|
+
// exist e.g. Mm/MM for base modifications
|
|
13
|
+
export function getTagAlt(feature, tag, alt) {
|
|
14
|
+
var _a;
|
|
15
|
+
return (_a = getTag(feature, tag)) !== null && _a !== void 0 ? _a : getTag(feature, alt);
|
|
16
|
+
}
|
|
17
|
+
// orientation definitions from igv.js, see also
|
|
18
|
+
// https://software.broadinstitute.org/software/igv/interpreting_pair_orientations
|
|
19
|
+
export const orientationTypes = {
|
|
20
|
+
fr: {
|
|
21
|
+
F1R2: 'LR',
|
|
22
|
+
F2R1: 'LR',
|
|
23
|
+
F1F2: 'LL',
|
|
24
|
+
F2F1: 'LL',
|
|
25
|
+
R1R2: 'RR',
|
|
26
|
+
R2R1: 'RR',
|
|
27
|
+
R1F2: 'RL',
|
|
28
|
+
R2F1: 'RL',
|
|
29
|
+
},
|
|
30
|
+
rf: {
|
|
31
|
+
R1F2: 'LR',
|
|
32
|
+
R2F1: 'LR',
|
|
33
|
+
R1R2: 'LL',
|
|
34
|
+
R2R1: 'LL',
|
|
35
|
+
F1F2: 'RR',
|
|
36
|
+
F2F1: 'RR',
|
|
37
|
+
F1R2: 'RL',
|
|
38
|
+
F2R1: 'RL',
|
|
39
|
+
},
|
|
40
|
+
ff: {
|
|
41
|
+
F2F1: 'LR',
|
|
42
|
+
R1R2: 'LR',
|
|
43
|
+
F2R1: 'LL',
|
|
44
|
+
R1F2: 'LL',
|
|
45
|
+
R2F1: 'RR',
|
|
46
|
+
F1R2: 'RR',
|
|
47
|
+
R2R1: 'RL',
|
|
48
|
+
F1F2: 'RL',
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
export const pairMap = {
|
|
52
|
+
LR: 'color_pair_lr',
|
|
53
|
+
LL: 'color_pair_ll',
|
|
54
|
+
RR: 'color_pair_rr',
|
|
55
|
+
RL: 'color_pair_rl',
|
|
56
|
+
};
|
|
57
|
+
export function getColorWGBS(strand, base) {
|
|
58
|
+
if (strand === 1) {
|
|
59
|
+
if (base === 'C') {
|
|
60
|
+
return '#f00';
|
|
61
|
+
}
|
|
62
|
+
if (base === 'T') {
|
|
63
|
+
return '#00f';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else if (strand === -1) {
|
|
67
|
+
if (base === 'G') {
|
|
68
|
+
return '#f00';
|
|
69
|
+
}
|
|
70
|
+
if (base === 'A') {
|
|
71
|
+
return '#00f';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return '#888';
|
|
75
|
+
}
|
|
76
|
+
// fetches region sequence augmenting by +/- 1bp for CpG on either side of
|
|
77
|
+
// requested region
|
|
78
|
+
export async function fetchSequence(region, adapter) {
|
|
79
|
+
var _a;
|
|
80
|
+
const { start, end, originalRefName, refName } = region;
|
|
81
|
+
const feats = await firstValueFrom(adapter
|
|
82
|
+
.getFeatures({
|
|
83
|
+
...region,
|
|
84
|
+
refName: originalRefName || refName,
|
|
85
|
+
end: end + 1,
|
|
86
|
+
start: Math.max(0, start - 1),
|
|
87
|
+
})
|
|
88
|
+
.pipe(toArray()));
|
|
89
|
+
return (_a = feats[0]) === null || _a === void 0 ? void 0 : _a.get('seq');
|
|
90
|
+
}
|
|
91
|
+
// has to check underlying C-G (aka CpG) on the reference sequence
|
|
92
|
+
export function shouldFetchReferenceSequence(type) {
|
|
93
|
+
return type === 'methylation';
|
|
94
|
+
}
|
|
95
|
+
// adapted from IGV
|
|
96
|
+
// https://github.com/igvteam/igv/blob/e803e3af2d8c9ea049961dfd4628146bdde9a574/src/main/java/org/broad/igv/sam/mods/BaseModificationColors.java#L27
|
|
97
|
+
export const modificationColors = {
|
|
98
|
+
m: 'rgb(255,0,0)',
|
|
99
|
+
h: 'rgb(11, 132, 165)',
|
|
100
|
+
o: 'rgb(111, 78, 129)',
|
|
101
|
+
f: 'rgb(246, 200, 95)',
|
|
102
|
+
c: 'rgb(157, 216, 102)',
|
|
103
|
+
g: 'rgb(255, 160, 86)',
|
|
104
|
+
e: 'rgb(141, 221, 208)',
|
|
105
|
+
b: 'rgb(202, 71, 47)',
|
|
106
|
+
};
|
|
107
|
+
export function createAutorun(self, cb, opts) {
|
|
108
|
+
addDisposer(self, autorun(async () => {
|
|
109
|
+
try {
|
|
110
|
+
await cb();
|
|
111
|
+
}
|
|
112
|
+
catch (e) {
|
|
113
|
+
if (isAlive(self)) {
|
|
114
|
+
self.setError(e);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}, opts));
|
|
118
|
+
}
|
|
119
|
+
export function randomColor() {
|
|
120
|
+
return `hsl(${Math.random() * 200}, 50%, 50%)`;
|
|
121
|
+
}
|
package/esm/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
2
2
|
import LinearArcDisplayF from './LinearArcDisplay';
|
|
3
|
+
import LinearPairedArcDisplayF from './LinearPairedArcDisplay';
|
|
3
4
|
import ArcRendererF from './ArcRenderer';
|
|
5
|
+
import { set1 } from '@jbrowse/core/ui/colors';
|
|
4
6
|
export default class ArcPlugin extends Plugin {
|
|
5
7
|
constructor() {
|
|
6
8
|
super(...arguments);
|
|
@@ -9,8 +11,27 @@ export default class ArcPlugin extends Plugin {
|
|
|
9
11
|
install(pluginManager) {
|
|
10
12
|
ArcRendererF(pluginManager);
|
|
11
13
|
LinearArcDisplayF(pluginManager);
|
|
12
|
-
pluginManager
|
|
13
|
-
|
|
14
|
+
LinearPairedArcDisplayF(pluginManager);
|
|
15
|
+
pluginManager.jexl.addFunction('logThickness', (feature, attributeName) => Math.log(feature.get(attributeName) + 1));
|
|
16
|
+
pluginManager.jexl.addFunction('defaultPairedArcColor', (_feature, alt) => {
|
|
17
|
+
if (alt === null || alt === void 0 ? void 0 : alt.startsWith('<DEL')) {
|
|
18
|
+
return set1[0];
|
|
19
|
+
}
|
|
20
|
+
else if (alt === null || alt === void 0 ? void 0 : alt.startsWith('<DUP')) {
|
|
21
|
+
return set1[1];
|
|
22
|
+
}
|
|
23
|
+
else if (alt === null || alt === void 0 ? void 0 : alt.startsWith('<INV')) {
|
|
24
|
+
return set1[2];
|
|
25
|
+
}
|
|
26
|
+
else if (alt === null || alt === void 0 ? void 0 : alt.startsWith('<TRA')) {
|
|
27
|
+
return set1[3];
|
|
28
|
+
}
|
|
29
|
+
else if (alt === null || alt === void 0 ? void 0 : alt.startsWith('<CNV')) {
|
|
30
|
+
return set1[4];
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return set1[6]; // skip 5, yellow
|
|
34
|
+
}
|
|
14
35
|
});
|
|
15
36
|
}
|
|
16
37
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-arc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "JBrowse 2 arc adapters, tracks, etc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "ee8c2bdc8bd4f1a70b1eefda984f04a2830d9ca0"
|
|
60
60
|
}
|