@jbrowse/plugin-alignments 2.10.1 → 2.10.3
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/AlignmentsFeatureDetail/AlignmentsFeatureDetail.d.ts +2 -2
- package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +10 -113
- package/dist/AlignmentsFeatureDetail/BreakendOptionDialog.d.ts +12 -0
- package/dist/AlignmentsFeatureDetail/BreakendOptionDialog.js +89 -0
- package/dist/AlignmentsFeatureDetail/Formatter.d.ts +4 -0
- package/dist/AlignmentsFeatureDetail/Formatter.js +47 -0
- package/dist/AlignmentsFeatureDetail/LaunchBreakpointSplitViewPanel.d.ts +9 -0
- package/dist/AlignmentsFeatureDetail/LaunchBreakpointSplitViewPanel.js +92 -0
- package/dist/AlignmentsFeatureDetail/PairLink.d.ts +6 -0
- package/dist/AlignmentsFeatureDetail/PairLink.js +16 -0
- package/dist/AlignmentsFeatureDetail/SuppAlignments.d.ts +8 -0
- package/dist/AlignmentsFeatureDetail/SuppAlignments.js +26 -0
- package/dist/AlignmentsFeatureDetail/SuppAlignmentsLocStrings.d.ts +6 -0
- package/dist/AlignmentsFeatureDetail/{AlignmentsFeatureSuppAligns.js → SuppAlignmentsLocStrings.js} +8 -7
- package/dist/AlignmentsFeatureDetail/configSchema.d.ts +1 -0
- package/dist/AlignmentsFeatureDetail/configSchema.js +5 -0
- package/dist/AlignmentsFeatureDetail/getSAFeatures.d.ts +23 -0
- package/dist/AlignmentsFeatureDetail/getSAFeatures.js +41 -0
- package/dist/AlignmentsFeatureDetail/index.d.ts +1 -50
- package/dist/AlignmentsFeatureDetail/index.js +6 -17
- package/dist/AlignmentsFeatureDetail/launchBreakpointSplitView.d.ts +22 -0
- package/dist/AlignmentsFeatureDetail/launchBreakpointSplitView.js +50 -0
- package/dist/AlignmentsFeatureDetail/stateModelFactory.d.ts +51 -0
- package/dist/AlignmentsFeatureDetail/stateModelFactory.js +12 -0
- package/dist/AlignmentsFeatureDetail/tagInfo.d.ts +63 -0
- package/dist/AlignmentsFeatureDetail/tagInfo.js +66 -0
- package/dist/BamAdapter/BamAdapter.js +10 -9
- package/dist/CramAdapter/CramAdapter.js +17 -19
- package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +38 -24
- package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +8 -8
- package/dist/LinearPileupDisplay/model.d.ts +24 -26
- package/dist/LinearPileupDisplay/model.js +4 -4
- package/dist/LinearReadArcsDisplay/model.d.ts +8 -8
- package/dist/LinearReadArcsDisplay/model.js +2 -2
- package/dist/LinearReadCloudDisplay/model.d.ts +13 -7
- package/dist/LinearReadCloudDisplay/model.js +2 -2
- package/dist/LinearSNPCoverageDisplay/components/Tooltip.js +5 -2
- package/dist/LinearSNPCoverageDisplay/models/model.d.ts +11 -2
- package/dist/shared/BaseDisplayComponent.js +3 -1
- package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.d.ts +2 -2
- package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +12 -92
- package/esm/AlignmentsFeatureDetail/BreakendOptionDialog.d.ts +12 -0
- package/esm/AlignmentsFeatureDetail/BreakendOptionDialog.js +64 -0
- package/esm/AlignmentsFeatureDetail/Formatter.d.ts +4 -0
- package/esm/AlignmentsFeatureDetail/Formatter.js +18 -0
- package/esm/AlignmentsFeatureDetail/LaunchBreakpointSplitViewPanel.d.ts +9 -0
- package/esm/AlignmentsFeatureDetail/LaunchBreakpointSplitViewPanel.js +66 -0
- package/esm/AlignmentsFeatureDetail/PairLink.d.ts +6 -0
- package/esm/AlignmentsFeatureDetail/PairLink.js +10 -0
- package/esm/AlignmentsFeatureDetail/SuppAlignments.d.ts +8 -0
- package/esm/AlignmentsFeatureDetail/SuppAlignments.js +20 -0
- package/esm/AlignmentsFeatureDetail/SuppAlignmentsLocStrings.d.ts +6 -0
- package/esm/AlignmentsFeatureDetail/{AlignmentsFeatureSuppAligns.js → SuppAlignmentsLocStrings.js} +7 -6
- package/esm/AlignmentsFeatureDetail/configSchema.d.ts +1 -0
- package/esm/AlignmentsFeatureDetail/configSchema.js +2 -0
- package/esm/AlignmentsFeatureDetail/getSAFeatures.d.ts +23 -0
- package/esm/AlignmentsFeatureDetail/getSAFeatures.js +37 -0
- package/esm/AlignmentsFeatureDetail/index.d.ts +1 -50
- package/esm/AlignmentsFeatureDetail/index.js +4 -13
- package/esm/AlignmentsFeatureDetail/launchBreakpointSplitView.d.ts +22 -0
- package/esm/AlignmentsFeatureDetail/launchBreakpointSplitView.js +46 -0
- package/esm/AlignmentsFeatureDetail/stateModelFactory.d.ts +51 -0
- package/esm/AlignmentsFeatureDetail/stateModelFactory.js +8 -0
- package/esm/AlignmentsFeatureDetail/tagInfo.d.ts +63 -0
- package/esm/AlignmentsFeatureDetail/tagInfo.js +63 -0
- package/esm/BamAdapter/BamAdapter.js +10 -9
- package/esm/CramAdapter/CramAdapter.js +18 -20
- package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +38 -24
- package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +8 -8
- package/esm/LinearPileupDisplay/model.d.ts +24 -26
- package/esm/LinearPileupDisplay/model.js +4 -4
- package/esm/LinearReadArcsDisplay/model.d.ts +8 -8
- package/esm/LinearReadArcsDisplay/model.js +2 -2
- package/esm/LinearReadCloudDisplay/model.d.ts +13 -7
- package/esm/LinearReadCloudDisplay/model.js +2 -2
- package/esm/LinearSNPCoverageDisplay/components/Tooltip.js +5 -2
- package/esm/LinearSNPCoverageDisplay/models/model.d.ts +11 -2
- package/esm/shared/BaseDisplayComponent.js +3 -1
- package/package.json +2 -2
- package/dist/AlignmentsFeatureDetail/AlignmentsFeatureSuppAligns.d.ts +0 -6
- package/esm/AlignmentsFeatureDetail/AlignmentsFeatureSuppAligns.d.ts +0 -6
- /package/dist/AlignmentsFeatureDetail/{AlignmentsFeatureFlags.d.ts → Flags.d.ts} +0 -0
- /package/dist/AlignmentsFeatureDetail/{AlignmentsFeatureFlags.js → Flags.js} +0 -0
- /package/esm/AlignmentsFeatureDetail/{AlignmentsFeatureFlags.d.ts → Flags.d.ts} +0 -0
- /package/esm/AlignmentsFeatureDetail/{AlignmentsFeatureFlags.js → Flags.js} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Link } from '@mui/material';
|
|
3
|
+
import { navToLoc } from './util';
|
|
4
|
+
export default function PairLink({ locString, model, }) {
|
|
5
|
+
return (React.createElement(Link, { onClick: event => {
|
|
6
|
+
event.preventDefault();
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
8
|
+
navToLoc(locString, model);
|
|
9
|
+
}, href: "#" }, locString));
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SimpleFeatureSerialized } from '@jbrowse/core/util';
|
|
3
|
+
import { AlignmentFeatureWidgetModel } from './stateModelFactory';
|
|
4
|
+
export default function SuppAlignments(props: {
|
|
5
|
+
tag: string;
|
|
6
|
+
model: AlignmentFeatureWidgetModel;
|
|
7
|
+
feature: SimpleFeatureSerialized;
|
|
8
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseCard } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
|
|
3
|
+
import { getEnv, getSession } from '@jbrowse/core/util';
|
|
4
|
+
import SuppAlignmentsLocStrings from './SuppAlignmentsLocStrings';
|
|
5
|
+
import LaunchBreakpointSplitViewPanel from './LaunchBreakpointSplitViewPanel';
|
|
6
|
+
export default function SuppAlignments(props) {
|
|
7
|
+
const { model, tag, feature } = props;
|
|
8
|
+
const session = getSession(model);
|
|
9
|
+
const { pluginManager } = getEnv(session);
|
|
10
|
+
let viewType;
|
|
11
|
+
try {
|
|
12
|
+
viewType = pluginManager.getViewType('BreakpointSplitView');
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
// ignore
|
|
16
|
+
}
|
|
17
|
+
return (React.createElement(BaseCard, { ...props, title: "Supplementary alignments" },
|
|
18
|
+
React.createElement(SuppAlignmentsLocStrings, { model: model, tag: tag }),
|
|
19
|
+
viewType ? (React.createElement(LaunchBreakpointSplitViewPanel, { viewType: viewType, model: model, feature: feature })) : null));
|
|
20
|
+
}
|
package/esm/AlignmentsFeatureDetail/{AlignmentsFeatureSuppAligns.js → SuppAlignmentsLocStrings.js}
RENAMED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Typography, Link } from '@mui/material';
|
|
3
|
-
|
|
3
|
+
// locals
|
|
4
4
|
import { getLengthOnRef } from '../MismatchParser';
|
|
5
5
|
import { navToLoc } from './util';
|
|
6
|
-
export default function
|
|
7
|
-
|
|
8
|
-
return (React.createElement(BaseCard, { ...props, title: "Supplementary alignments" },
|
|
6
|
+
export default function SuppAlignmentsLocStrings({ tag, model, }) {
|
|
7
|
+
return (React.createElement("div", null,
|
|
9
8
|
React.createElement(Typography, null, "List of supplementary alignment locations"),
|
|
10
9
|
React.createElement("ul", null, tag
|
|
11
10
|
.split(';')
|
|
@@ -16,7 +15,9 @@ export default function SupplementaryAlignments(props) {
|
|
|
16
15
|
const extra = Math.floor(saLength / 5);
|
|
17
16
|
const start = +saStart;
|
|
18
17
|
const end = +saStart + saLength;
|
|
19
|
-
const
|
|
18
|
+
const sp = start - extra;
|
|
19
|
+
const ep = end + extra;
|
|
20
|
+
const locString = `${saRef}:${Math.max(1, sp)}-${ep}`;
|
|
20
21
|
const displayStart = start.toLocaleString('en-US');
|
|
21
22
|
const displayEnd = end.toLocaleString('en-US');
|
|
22
23
|
const displayString = `${saRef}:${displayStart}-${displayEnd} (${saStrand}) [${saLength}bp]`;
|
|
@@ -25,6 +26,6 @@ export default function SupplementaryAlignments(props) {
|
|
|
25
26
|
event.preventDefault();
|
|
26
27
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
27
28
|
navToLoc(locString, model);
|
|
28
|
-
}
|
|
29
|
+
} }, displayString)));
|
|
29
30
|
}))));
|
|
30
31
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Feature } from '@jbrowse/core/util';
|
|
2
|
+
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
3
|
+
export interface ReducedFeature {
|
|
4
|
+
refName: string;
|
|
5
|
+
start: number;
|
|
6
|
+
clipPos: number;
|
|
7
|
+
end: number;
|
|
8
|
+
strand: number;
|
|
9
|
+
seqLength: number;
|
|
10
|
+
syntenyId?: number;
|
|
11
|
+
uniqueId: string;
|
|
12
|
+
mate: {
|
|
13
|
+
refName: string;
|
|
14
|
+
start: number;
|
|
15
|
+
end: number;
|
|
16
|
+
syntenyId?: number;
|
|
17
|
+
uniqueId?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare function getSAFeatures({ view, feature, }: {
|
|
21
|
+
view: LinearGenomeViewModel;
|
|
22
|
+
feature: Feature;
|
|
23
|
+
}): Promise<ReducedFeature[]>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { getSession } from '@jbrowse/core/util';
|
|
2
|
+
// locals
|
|
3
|
+
import { featurizeSA, getClip, getLengthSansClipping } from '../MismatchParser';
|
|
4
|
+
import { getTag } from '../util';
|
|
5
|
+
export async function getSAFeatures({ view, feature, }) {
|
|
6
|
+
const { assemblyManager } = getSession(view);
|
|
7
|
+
const cigar = feature.get('CIGAR');
|
|
8
|
+
const origStrand = feature.get('strand');
|
|
9
|
+
const SA = getTag(feature, 'SA') || '';
|
|
10
|
+
const readName = feature.get('name');
|
|
11
|
+
const clipPos = getClip(cigar, 1);
|
|
12
|
+
// get the canonical refname for the read because if the
|
|
13
|
+
// read.get('refName') is chr1 and the actual fasta refName is 1 then no
|
|
14
|
+
// tracks can be opened on the top panel of the linear read vs ref
|
|
15
|
+
const assembly = await assemblyManager.waitForAssembly(view.assemblyNames[0]);
|
|
16
|
+
if (!assembly) {
|
|
17
|
+
throw new Error('assembly not found');
|
|
18
|
+
}
|
|
19
|
+
const suppAlns = featurizeSA(SA, feature.id(), origStrand, readName, true);
|
|
20
|
+
const feat = feature.toJSON();
|
|
21
|
+
feat.clipPos = clipPos;
|
|
22
|
+
feat.strand = 1;
|
|
23
|
+
feat.mate = {
|
|
24
|
+
refName: readName,
|
|
25
|
+
start: clipPos,
|
|
26
|
+
end: clipPos + getLengthSansClipping(cigar),
|
|
27
|
+
};
|
|
28
|
+
const features = [feat, ...suppAlns];
|
|
29
|
+
features.forEach((f, idx) => {
|
|
30
|
+
f.refName = (assembly === null || assembly === void 0 ? void 0 : assembly.getCanonicalRefName(f.refName)) || f.refName;
|
|
31
|
+
f.syntenyId = idx;
|
|
32
|
+
f.mate.syntenyId = idx;
|
|
33
|
+
f.mate.uniqueId = `${f.uniqueId}_mate`;
|
|
34
|
+
});
|
|
35
|
+
features.sort((a, b) => a.clipPos - b.clipPos);
|
|
36
|
+
return features;
|
|
37
|
+
}
|
|
@@ -1,51 +1,2 @@
|
|
|
1
1
|
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
-
|
|
3
|
-
export declare function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
4
|
-
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
5
|
-
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
6
|
-
featureData: import("mobx-state-tree").IType<any, any, any>;
|
|
7
|
-
formattedFields: import("mobx-state-tree").IType<any, any, any>;
|
|
8
|
-
unformattedFeatureData: import("mobx-state-tree").IType<any, any, any>;
|
|
9
|
-
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
10
|
-
track: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
11
|
-
trackId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
12
|
-
trackType: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
13
|
-
maxDepth: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
14
|
-
} & {
|
|
15
|
-
type: import("mobx-state-tree").ISimpleType<"AlignmentsFeatureWidget">;
|
|
16
|
-
}, {
|
|
17
|
-
error: unknown;
|
|
18
|
-
} & {
|
|
19
|
-
setFeatureData(featureData: Record<string, unknown>): void;
|
|
20
|
-
clearFeatureData(): void;
|
|
21
|
-
setFormattedData(feat: Record<string, unknown>): void;
|
|
22
|
-
setExtra(type?: string | undefined, trackId?: string | undefined, maxDepth?: number | undefined): void;
|
|
23
|
-
setError(e: unknown): void;
|
|
24
|
-
} & {
|
|
25
|
-
afterCreate(): void;
|
|
26
|
-
}, {
|
|
27
|
-
type: "BaseFeatureWidget";
|
|
28
|
-
} & Partial<import("mobx-state-tree/dist/internal").ExtractCFromProps<{
|
|
29
|
-
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
30
|
-
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
31
|
-
featureData: import("mobx-state-tree").IType<any, any, any>;
|
|
32
|
-
formattedFields: import("mobx-state-tree").IType<any, any, any>;
|
|
33
|
-
unformattedFeatureData: import("mobx-state-tree").IType<any, any, any>;
|
|
34
|
-
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
35
|
-
track: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
36
|
-
trackId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
37
|
-
trackType: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
38
|
-
maxDepth: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
39
|
-
}>> & import("mobx-state-tree/dist/internal").NonEmptyObject & import("mobx-state-tree")._NotCustomized, {
|
|
40
|
-
type: "BaseFeatureWidget";
|
|
41
|
-
id: string;
|
|
42
|
-
track: import("mobx-state-tree").ReferenceIdentifier | undefined;
|
|
43
|
-
view: import("mobx-state-tree").ReferenceIdentifier | undefined;
|
|
44
|
-
trackId: string | undefined;
|
|
45
|
-
trackType: string | undefined;
|
|
46
|
-
maxDepth: number | undefined;
|
|
47
|
-
formattedFields: any;
|
|
48
|
-
finalizedFeatureData: any;
|
|
49
|
-
} & import("mobx-state-tree")._NotCustomized>;
|
|
50
|
-
export default function register(pluginManager: PluginManager): void;
|
|
51
|
-
export { configSchema };
|
|
2
|
+
export default function AlignmentFeatureDetailsF(pluginManager: PluginManager): void;
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
|
-
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
3
|
-
import { types } from 'mobx-state-tree';
|
|
4
2
|
import WidgetType from '@jbrowse/core/pluggableElementTypes/WidgetType';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
export function
|
|
8
|
-
const baseModel = baseModelFactory(pluginManager);
|
|
9
|
-
return types.compose(baseModel, types.model('AlignmentsFeatureWidget', {
|
|
10
|
-
type: types.literal('AlignmentsFeatureWidget'),
|
|
11
|
-
}));
|
|
12
|
-
}
|
|
13
|
-
export default function register(pluginManager) {
|
|
3
|
+
import { configSchema } from './configSchema';
|
|
4
|
+
import { stateModelFactory } from './stateModelFactory';
|
|
5
|
+
export default function AlignmentFeatureDetailsF(pluginManager) {
|
|
14
6
|
pluginManager.addWidgetType(() => new WidgetType({
|
|
15
7
|
name: 'AlignmentsFeatureWidget',
|
|
16
8
|
heading: 'Feature details',
|
|
17
|
-
configSchema,
|
|
9
|
+
configSchema: configSchema,
|
|
18
10
|
stateModel: stateModelFactory(pluginManager),
|
|
19
11
|
ReactComponent: lazy(() => import('./AlignmentsFeatureDetail')),
|
|
20
12
|
}));
|
|
21
13
|
}
|
|
22
|
-
export { configSchema };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
2
|
+
import { ReducedFeature } from './getSAFeatures';
|
|
3
|
+
export declare function getBreakpointSplitView({ f1, f2, view, }: {
|
|
4
|
+
f1: ReducedFeature;
|
|
5
|
+
f2: ReducedFeature;
|
|
6
|
+
view: LinearGenomeViewModel;
|
|
7
|
+
}): {
|
|
8
|
+
type: string;
|
|
9
|
+
views: {
|
|
10
|
+
type: string;
|
|
11
|
+
displayedRegions: {
|
|
12
|
+
start: number;
|
|
13
|
+
end: number;
|
|
14
|
+
refName: string;
|
|
15
|
+
assemblyName: string;
|
|
16
|
+
}[];
|
|
17
|
+
hideHeader: boolean;
|
|
18
|
+
bpPerPx: number;
|
|
19
|
+
offsetPx: number;
|
|
20
|
+
}[];
|
|
21
|
+
displayName: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { getSession } from '@jbrowse/core/util';
|
|
2
|
+
export function getBreakpointSplitView({ f1, f2, view, }) {
|
|
3
|
+
const { assemblyName } = view.displayedRegions[0];
|
|
4
|
+
const { assemblyManager } = getSession(view);
|
|
5
|
+
const assembly = assemblyManager.get(assemblyName);
|
|
6
|
+
if (!assembly) {
|
|
7
|
+
throw new Error(`assembly ${assemblyName} not found`);
|
|
8
|
+
}
|
|
9
|
+
if (!assembly.regions) {
|
|
10
|
+
throw new Error(`assembly ${assemblyName} regions not loaded`);
|
|
11
|
+
}
|
|
12
|
+
const topRegion = assembly.regions.find(f => f.refName === f1.refName);
|
|
13
|
+
const bottomRegion = assembly.regions.find(f => f.refName === f2.refName);
|
|
14
|
+
if (!topRegion || !bottomRegion) {
|
|
15
|
+
throw new Error(`unable to find the refName for the top or bottom of the breakpoint view`);
|
|
16
|
+
}
|
|
17
|
+
const topMarkedRegion = [{ ...topRegion }, { ...topRegion }];
|
|
18
|
+
const bottomMarkedRegion = [{ ...bottomRegion }, { ...bottomRegion }];
|
|
19
|
+
const s = f1.strand === 1 ? f1.end : f1.start;
|
|
20
|
+
const e = f2.strand === 1 ? f2.start : f2.end;
|
|
21
|
+
topMarkedRegion[0].end = s;
|
|
22
|
+
topMarkedRegion[1].start = s + 1;
|
|
23
|
+
bottomMarkedRegion[0].end = e;
|
|
24
|
+
bottomMarkedRegion[1].start = e + 1;
|
|
25
|
+
const bpPerPx = 10;
|
|
26
|
+
return {
|
|
27
|
+
type: 'BreakpointSplitView',
|
|
28
|
+
views: [
|
|
29
|
+
{
|
|
30
|
+
type: 'LinearGenomeView',
|
|
31
|
+
displayedRegions: topMarkedRegion,
|
|
32
|
+
hideHeader: true,
|
|
33
|
+
bpPerPx,
|
|
34
|
+
offsetPx: (topRegion.start + s) / bpPerPx,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: 'LinearGenomeView',
|
|
38
|
+
displayedRegions: bottomMarkedRegion,
|
|
39
|
+
hideHeader: true,
|
|
40
|
+
bpPerPx,
|
|
41
|
+
offsetPx: (bottomRegion.start + e) / bpPerPx,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
displayName: `breakend split detail`,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
import { Instance } from 'mobx-state-tree';
|
|
3
|
+
export declare function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
4
|
+
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
5
|
+
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
6
|
+
featureData: import("mobx-state-tree").IType<any, any, any>;
|
|
7
|
+
formattedFields: import("mobx-state-tree").IType<any, any, any>;
|
|
8
|
+
unformattedFeatureData: import("mobx-state-tree").IType<any, any, any>;
|
|
9
|
+
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
10
|
+
track: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
11
|
+
trackId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
12
|
+
trackType: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
13
|
+
maxDepth: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
14
|
+
} & {
|
|
15
|
+
type: import("mobx-state-tree").ISimpleType<"AlignmentsFeatureWidget">;
|
|
16
|
+
}, {
|
|
17
|
+
error: unknown;
|
|
18
|
+
} & {
|
|
19
|
+
setFeatureData(featureData: Record<string, unknown>): void;
|
|
20
|
+
clearFeatureData(): void;
|
|
21
|
+
setFormattedData(feat: Record<string, unknown>): void;
|
|
22
|
+
setExtra(type?: string | undefined, trackId?: string | undefined, maxDepth?: number | undefined): void;
|
|
23
|
+
setError(e: unknown): void;
|
|
24
|
+
} & {
|
|
25
|
+
afterCreate(): void;
|
|
26
|
+
}, {
|
|
27
|
+
type: "BaseFeatureWidget";
|
|
28
|
+
} & Partial<import("mobx-state-tree/dist/internal").ExtractCFromProps<{
|
|
29
|
+
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
30
|
+
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
31
|
+
featureData: import("mobx-state-tree").IType<any, any, any>;
|
|
32
|
+
formattedFields: import("mobx-state-tree").IType<any, any, any>;
|
|
33
|
+
unformattedFeatureData: import("mobx-state-tree").IType<any, any, any>;
|
|
34
|
+
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
35
|
+
track: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
36
|
+
trackId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
37
|
+
trackType: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
38
|
+
maxDepth: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
39
|
+
}>> & import("mobx-state-tree/dist/internal").NonEmptyObject & import("mobx-state-tree")._NotCustomized, {
|
|
40
|
+
id: string;
|
|
41
|
+
type: "BaseFeatureWidget";
|
|
42
|
+
track: import("mobx-state-tree").ReferenceIdentifier | undefined;
|
|
43
|
+
view: import("mobx-state-tree").ReferenceIdentifier | undefined;
|
|
44
|
+
trackId: string | undefined;
|
|
45
|
+
trackType: string | undefined;
|
|
46
|
+
maxDepth: number | undefined;
|
|
47
|
+
formattedFields: any;
|
|
48
|
+
finalizedFeatureData: any;
|
|
49
|
+
} & import("mobx-state-tree")._NotCustomized>;
|
|
50
|
+
export type AlignmentFeatureWidgetStateModel = ReturnType<typeof stateModelFactory>;
|
|
51
|
+
export type AlignmentFeatureWidgetModel = Instance<AlignmentFeatureWidgetStateModel>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { types } from 'mobx-state-tree';
|
|
2
|
+
import { stateModelFactory as baseModelFactory } from '@jbrowse/core/BaseFeatureWidget';
|
|
3
|
+
export function stateModelFactory(pluginManager) {
|
|
4
|
+
const baseModel = baseModelFactory(pluginManager);
|
|
5
|
+
return types.compose(baseModel, types.model('AlignmentsFeatureWidget', {
|
|
6
|
+
type: types.literal('AlignmentsFeatureWidget'),
|
|
7
|
+
}));
|
|
8
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export declare const tags: {
|
|
2
|
+
AM: string;
|
|
3
|
+
AS: string;
|
|
4
|
+
BC: string;
|
|
5
|
+
BQ: string;
|
|
6
|
+
BZ: string;
|
|
7
|
+
CB: string;
|
|
8
|
+
CC: string;
|
|
9
|
+
CM: string;
|
|
10
|
+
CO: string;
|
|
11
|
+
CP: string;
|
|
12
|
+
CQ: string;
|
|
13
|
+
CR: string;
|
|
14
|
+
CS: string;
|
|
15
|
+
CT: string;
|
|
16
|
+
CY: string;
|
|
17
|
+
E2: string;
|
|
18
|
+
FI: string;
|
|
19
|
+
FS: string;
|
|
20
|
+
FZ: string;
|
|
21
|
+
GC: string;
|
|
22
|
+
GQ: string;
|
|
23
|
+
GS: string;
|
|
24
|
+
H0: string;
|
|
25
|
+
H1: string;
|
|
26
|
+
H2: string;
|
|
27
|
+
HI: string;
|
|
28
|
+
IH: string;
|
|
29
|
+
LB: string;
|
|
30
|
+
MC: string;
|
|
31
|
+
MD: string;
|
|
32
|
+
MF: string;
|
|
33
|
+
MI: string;
|
|
34
|
+
ML: string;
|
|
35
|
+
MM: string;
|
|
36
|
+
MQ: string;
|
|
37
|
+
NH: string;
|
|
38
|
+
NM: string;
|
|
39
|
+
OA: string;
|
|
40
|
+
OC: string;
|
|
41
|
+
OP: string;
|
|
42
|
+
OQ: string;
|
|
43
|
+
OX: string;
|
|
44
|
+
PG: string;
|
|
45
|
+
PQ: string;
|
|
46
|
+
PT: string;
|
|
47
|
+
PU: string;
|
|
48
|
+
Q2: string;
|
|
49
|
+
QT: string;
|
|
50
|
+
QX: string;
|
|
51
|
+
R2: string;
|
|
52
|
+
RG: string;
|
|
53
|
+
RT: string;
|
|
54
|
+
RX: string;
|
|
55
|
+
S2: string;
|
|
56
|
+
SA: string;
|
|
57
|
+
SM: string;
|
|
58
|
+
SQ: string;
|
|
59
|
+
TC: string;
|
|
60
|
+
TS: string;
|
|
61
|
+
U2: string;
|
|
62
|
+
UQ: string;
|
|
63
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export const tags = {
|
|
2
|
+
AM: 'The smallest template-independent mapping quality in the template',
|
|
3
|
+
AS: 'Alignment score generated by aligner',
|
|
4
|
+
BC: 'Barcode sequence identifying the sample',
|
|
5
|
+
BQ: 'Offset to base alignment quality (BAQ)',
|
|
6
|
+
BZ: 'Phred quality of the unique molecular barcode bases in the {OX} tag',
|
|
7
|
+
CB: 'Cell identifier',
|
|
8
|
+
CC: 'Reference name of the next hit',
|
|
9
|
+
CM: 'Edit distance between the color sequence and the color reference (see also {NM})',
|
|
10
|
+
CO: 'Free-text comments',
|
|
11
|
+
CP: 'Leftmost coordinate of the next hit',
|
|
12
|
+
CQ: 'Color read base qualities',
|
|
13
|
+
CR: 'Cellular barcode sequence bases (uncorrected)',
|
|
14
|
+
CS: 'Color read sequence',
|
|
15
|
+
CT: 'Complete read annotation tag, used for consensus annotation dummy features',
|
|
16
|
+
CY: 'Phred quality of the cellular barcode sequence in the {CR} tag',
|
|
17
|
+
E2: 'The 2nd most likely base calls',
|
|
18
|
+
FI: 'The index of segment in the template',
|
|
19
|
+
FS: 'Segment suffix',
|
|
20
|
+
FZ: 'Flow signal intensities',
|
|
21
|
+
GC: 'Reserved for backwards compatibility reasons',
|
|
22
|
+
GQ: 'Reserved for backwards compatibility reasons',
|
|
23
|
+
GS: 'Reserved for backwards compatibility reasons',
|
|
24
|
+
H0: 'Number of perfect hits',
|
|
25
|
+
H1: 'Number of 1-difference hits (see also {NM})',
|
|
26
|
+
H2: 'Number of 2-difference hits',
|
|
27
|
+
HI: 'Query hit index',
|
|
28
|
+
IH: 'Query hit total count',
|
|
29
|
+
LB: 'Library',
|
|
30
|
+
MC: 'CIGAR string for mate/next segment',
|
|
31
|
+
MD: 'String encoding mismatched and deleted reference bases',
|
|
32
|
+
MF: 'Reserved for backwards compatibility reasons',
|
|
33
|
+
MI: 'Molecular identifier; a string that uniquely identifies the molecule from which the record was derived',
|
|
34
|
+
ML: 'Base modification probabilities',
|
|
35
|
+
MM: 'Base modifications / methylation ',
|
|
36
|
+
MQ: 'Mapping quality of the mate/next segment',
|
|
37
|
+
NH: 'Number of reported alignments that contain the query in the current record',
|
|
38
|
+
NM: 'Edit distance to the reference',
|
|
39
|
+
OA: 'Original alignment',
|
|
40
|
+
OC: 'Original CIGAR (deprecated; use {OA} instead)',
|
|
41
|
+
OP: 'Original mapping position (deprecated; use {OA} instead)',
|
|
42
|
+
OQ: 'Original base quality',
|
|
43
|
+
OX: 'Original unique molecular barcode bases',
|
|
44
|
+
PG: 'Program',
|
|
45
|
+
PQ: 'Phred likelihood of the template',
|
|
46
|
+
PT: 'Read annotations for parts of the padded read sequence',
|
|
47
|
+
PU: 'Platform unit',
|
|
48
|
+
Q2: 'Phred quality of the mate/next segment sequence in the {R2} tag',
|
|
49
|
+
QT: 'Phred quality of the sample barcode sequence in the {BC} tag',
|
|
50
|
+
QX: 'Quality score of the unique molecular identifier in the {RX} tag',
|
|
51
|
+
R2: 'Sequence of the mate/next segment in the template',
|
|
52
|
+
RG: 'Read group',
|
|
53
|
+
RT: 'Reserved for backwards compatibility reasons',
|
|
54
|
+
RX: 'Sequence bases of the (possibly corrected) unique molecular identifier',
|
|
55
|
+
S2: 'Reserved for backwards compatibility reasons',
|
|
56
|
+
SA: 'Other canonical alignments in a chimeric alignment',
|
|
57
|
+
SM: 'Template-independent mapping quality',
|
|
58
|
+
SQ: 'Reserved for backwards compatibility reasons',
|
|
59
|
+
TC: 'The number of segments in the template',
|
|
60
|
+
TS: 'Transcript strand',
|
|
61
|
+
U2: 'Phred probability of the 2nd call being wrong conditional on the best being wrong',
|
|
62
|
+
UQ: 'Phred likelihood of the segment, conditional on the mapping being correct',
|
|
63
|
+
};
|
|
@@ -60,14 +60,13 @@ export default class BamAdapter extends BaseFeatureDataAdapter {
|
|
|
60
60
|
const idToName = [];
|
|
61
61
|
const nameToId = {};
|
|
62
62
|
samHeader === null || samHeader === void 0 ? void 0 : samHeader.filter(l => l.tag === 'SQ').forEach((sqLine, refId) => {
|
|
63
|
-
sqLine.data.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
});
|
|
63
|
+
const SN = sqLine.data.find(item => item.tag === 'SN');
|
|
64
|
+
if (SN) {
|
|
65
|
+
// this is the ref name
|
|
66
|
+
const refName = SN.value;
|
|
67
|
+
nameToId[refName] = refId;
|
|
68
|
+
idToName[refId] = refName;
|
|
69
|
+
}
|
|
71
70
|
});
|
|
72
71
|
return { idToName, nameToId };
|
|
73
72
|
});
|
|
@@ -139,7 +138,9 @@ export default class BamAdapter extends BaseFeatureDataAdapter {
|
|
|
139
138
|
}
|
|
140
139
|
if (tagFilter) {
|
|
141
140
|
const v = record.get(tagFilter.tag);
|
|
142
|
-
if (!(
|
|
141
|
+
if (!(tagFilter.value === '*'
|
|
142
|
+
? v !== undefined
|
|
143
|
+
: `${v}` === tagFilter.value)) {
|
|
143
144
|
continue;
|
|
144
145
|
}
|
|
145
146
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CraiIndex, IndexedCramFile } from '@gmod/cram';
|
|
2
2
|
import { BaseFeatureDataAdapter, } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
-
import { checkAbortSignal, updateStatus, } from '@jbrowse/core/util';
|
|
3
|
+
import { checkAbortSignal, updateStatus, toLocale, } from '@jbrowse/core/util';
|
|
4
4
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
5
5
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
6
6
|
import { toArray } from 'rxjs/operators';
|
|
@@ -17,12 +17,6 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
|
|
|
17
17
|
async configurePre() {
|
|
18
18
|
const cramLocation = this.getConf('cramLocation');
|
|
19
19
|
const craiLocation = this.getConf('craiLocation');
|
|
20
|
-
if (!cramLocation) {
|
|
21
|
-
throw new Error('missing cramLocation argument');
|
|
22
|
-
}
|
|
23
|
-
if (!craiLocation) {
|
|
24
|
-
throw new Error('missing craiLocation argument');
|
|
25
|
-
}
|
|
26
20
|
const pm = this.pluginManager;
|
|
27
21
|
const cram = new IndexedCramFile({
|
|
28
22
|
cramFilehandle: openLocation(cramLocation, pm),
|
|
@@ -35,6 +29,9 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
|
|
|
35
29
|
throw new Error('Error getting subadapter');
|
|
36
30
|
}
|
|
37
31
|
const seqConf = this.getConf('sequenceAdapter');
|
|
32
|
+
if (!seqConf) {
|
|
33
|
+
throw new Error('no sequenceAdapter supplied to CramAdapter config');
|
|
34
|
+
}
|
|
38
35
|
const subadapter = await this.getSubAdapter(seqConf);
|
|
39
36
|
return {
|
|
40
37
|
cram,
|
|
@@ -81,8 +78,9 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
|
|
|
81
78
|
return chunkSeq.slice(trimStart, trimStart + trimLength);
|
|
82
79
|
})
|
|
83
80
|
.join('');
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
const qlen = end - start;
|
|
82
|
+
if (sequence.length !== qlen) {
|
|
83
|
+
throw new Error(`fetching ${refName}:${toLocale(start - 1)}-${toLocale(end)} returned ${toLocale(sequence.length)} bases, should have returned ${toLocale(qlen)}`);
|
|
86
84
|
}
|
|
87
85
|
return sequence;
|
|
88
86
|
}
|
|
@@ -99,14 +97,12 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
|
|
|
99
97
|
samHeader
|
|
100
98
|
.filter(l => l.tag === 'SQ')
|
|
101
99
|
.forEach((sqLine, refId) => {
|
|
102
|
-
sqLine.data.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
});
|
|
100
|
+
const SN = sqLine.data.find(item => item.tag === 'SN');
|
|
101
|
+
if (SN) {
|
|
102
|
+
const refName = SN.value;
|
|
103
|
+
nameToId[refName] = refId;
|
|
104
|
+
idToName[refId] = refName;
|
|
105
|
+
}
|
|
110
106
|
});
|
|
111
107
|
const readGroups = samHeader
|
|
112
108
|
.filter(l => l.tag === 'RG')
|
|
@@ -156,7 +152,7 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
|
|
|
156
152
|
const { signal, filterBy, statusCallback = () => { } } = opts || {};
|
|
157
153
|
const { refName, start, end, originalRefName } = region;
|
|
158
154
|
return ObservableCreate(async (observer) => {
|
|
159
|
-
const { cram } = await this.setup(opts);
|
|
155
|
+
const { cram, samHeader } = await this.setup(opts);
|
|
160
156
|
const refId = this.refNameToId(refName);
|
|
161
157
|
if (refId === undefined) {
|
|
162
158
|
console.warn('Unknown refName', refName);
|
|
@@ -178,9 +174,11 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
|
|
|
178
174
|
}
|
|
179
175
|
if (tagFilter) {
|
|
180
176
|
const v = tagFilter.tag === 'RG'
|
|
181
|
-
? (_a =
|
|
177
|
+
? (_a = samHeader.readGroups) === null || _a === void 0 ? void 0 : _a[record.readGroupId]
|
|
182
178
|
: record.tags[tagFilter.tag];
|
|
183
|
-
if (!(
|
|
179
|
+
if (!(tagFilter.value === '*'
|
|
180
|
+
? v !== undefined
|
|
181
|
+
: `${v}` === tagFilter.value)) {
|
|
184
182
|
continue;
|
|
185
183
|
}
|
|
186
184
|
}
|