@jbrowse/plugin-breakpoint-split-view 2.16.1 → 2.17.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/BreakpointSplitView/components/AlignmentConnections.js +3 -3
- package/dist/BreakpointSplitView/components/util.js +2 -5
- package/dist/BreakpointSplitView/model.d.ts +2 -0
- package/dist/BreakpointSplitView/model.js +9 -0
- package/esm/BreakpointSplitView/components/AlignmentConnections.js +3 -3
- package/esm/BreakpointSplitView/components/util.js +2 -5
- package/esm/BreakpointSplitView/model.d.ts +2 -0
- package/esm/BreakpointSplitView/model.js +8 -0
- package/package.json +2 -2
|
@@ -49,9 +49,9 @@ const AlignmentConnections = (0, mobx_react_1.observer)(function ({ model, track
|
|
|
49
49
|
? (0, util_2.getBadlyPairedAlignments)(allFeatures)
|
|
50
50
|
: (0, util_2.getMatchedAlignmentFeatures)(allFeatures));
|
|
51
51
|
if (!hasPaired) {
|
|
52
|
-
|
|
53
|
-
m.sort((a, b) => a.
|
|
54
|
-
}
|
|
52
|
+
for (const m of layoutMatches) {
|
|
53
|
+
m.sort((a, b) => a.clipPos - b.clipPos);
|
|
54
|
+
}
|
|
55
55
|
}
|
|
56
56
|
return layoutMatches;
|
|
57
57
|
}, [allFeatures, trackId, hasPaired, model]);
|
|
@@ -33,20 +33,17 @@ function getBadlyPairedAlignments(features) {
|
|
|
33
33
|
}
|
|
34
34
|
return [...candidates.values()].filter(v => v.length > 1);
|
|
35
35
|
}
|
|
36
|
-
function getTag(f, tag) {
|
|
37
|
-
const tags = f.get('tags');
|
|
38
|
-
return tags ? tags[tag] : f.get(tag);
|
|
39
|
-
}
|
|
40
36
|
// this finds candidate alignment features, aimed at plotting split reads from
|
|
41
37
|
// BAM/CRAM files
|
|
42
38
|
function getMatchedAlignmentFeatures(features) {
|
|
39
|
+
var _a;
|
|
43
40
|
const candidates = new Map();
|
|
44
41
|
const alreadySeen = new Set();
|
|
45
42
|
// this finds candidate features that share the same name
|
|
46
43
|
for (const feature of features.values()) {
|
|
47
44
|
const id = feature.id();
|
|
48
45
|
const unmapped = feature.get('flags') & 4;
|
|
49
|
-
const hasSA = !!
|
|
46
|
+
const hasSA = !!((_a = feature.get('tags')) === null || _a === void 0 ? void 0 : _a.SA);
|
|
50
47
|
if (!alreadySeen.has(id) && !unmapped && hasSA) {
|
|
51
48
|
const n = feature.get('name');
|
|
52
49
|
let val = candidates.get(n);
|
|
@@ -3,6 +3,7 @@ import { Instance } from 'mobx-state-tree';
|
|
|
3
3
|
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
4
4
|
import PluginManager from '@jbrowse/core/PluginManager';
|
|
5
5
|
import { Feature } from '@jbrowse/core/util';
|
|
6
|
+
export declare function getClip(cigar: string, strand: number): number;
|
|
6
7
|
export interface ExportSvgOptions {
|
|
7
8
|
rasterizeLayers?: boolean;
|
|
8
9
|
filename?: string;
|
|
@@ -319,6 +320,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
319
320
|
feature: Feature;
|
|
320
321
|
layout: LayoutRecord | undefined;
|
|
321
322
|
level: number;
|
|
323
|
+
clipPos: number;
|
|
322
324
|
}[][];
|
|
323
325
|
} & {
|
|
324
326
|
afterAttach(): void;
|
|
@@ -26,6 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.getClip = getClip;
|
|
29
30
|
exports.default = stateModelFactory;
|
|
30
31
|
const react_1 = require("react");
|
|
31
32
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
@@ -41,6 +42,13 @@ const Link_1 = __importDefault(require("@mui/icons-material/Link"));
|
|
|
41
42
|
const util_2 = require("./util");
|
|
42
43
|
// lazies
|
|
43
44
|
const ExportSvgDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/ExportSvgDialog'))));
|
|
45
|
+
const startClip = new RegExp(/(\d+)[SH]$/);
|
|
46
|
+
const endClip = new RegExp(/^(\d+)([SH])/);
|
|
47
|
+
function getClip(cigar, strand) {
|
|
48
|
+
return strand === -1
|
|
49
|
+
? +(startClip.exec(cigar) || [])[1] || 0
|
|
50
|
+
: +(endClip.exec(cigar) || [])[1] || 0;
|
|
51
|
+
}
|
|
44
52
|
function calc(track, f) {
|
|
45
53
|
var _a, _b;
|
|
46
54
|
return (_b = (_a = track.displays[0]).searchFeatureByID) === null || _b === void 0 ? void 0 : _b.call(_a, f.id());
|
|
@@ -178,6 +186,7 @@ function stateModelFactory(pluginManager) {
|
|
|
178
186
|
feature,
|
|
179
187
|
layout: calc(tracks[level], feature),
|
|
180
188
|
level,
|
|
189
|
+
clipPos: getClip(feature.get('CIGAR'), feature.get('strand')),
|
|
181
190
|
}
|
|
182
191
|
: undefined;
|
|
183
192
|
})
|
|
@@ -24,9 +24,9 @@ const AlignmentConnections = observer(function ({ model, trackId, parentRef, get
|
|
|
24
24
|
? getBadlyPairedAlignments(allFeatures)
|
|
25
25
|
: getMatchedAlignmentFeatures(allFeatures));
|
|
26
26
|
if (!hasPaired) {
|
|
27
|
-
|
|
28
|
-
m.sort((a, b) => a.
|
|
29
|
-
}
|
|
27
|
+
for (const m of layoutMatches) {
|
|
28
|
+
m.sort((a, b) => a.clipPos - b.clipPos);
|
|
29
|
+
}
|
|
30
30
|
}
|
|
31
31
|
return layoutMatches;
|
|
32
32
|
}, [allFeatures, trackId, hasPaired, model]);
|
|
@@ -24,20 +24,17 @@ export function getBadlyPairedAlignments(features) {
|
|
|
24
24
|
}
|
|
25
25
|
return [...candidates.values()].filter(v => v.length > 1);
|
|
26
26
|
}
|
|
27
|
-
function getTag(f, tag) {
|
|
28
|
-
const tags = f.get('tags');
|
|
29
|
-
return tags ? tags[tag] : f.get(tag);
|
|
30
|
-
}
|
|
31
27
|
// this finds candidate alignment features, aimed at plotting split reads from
|
|
32
28
|
// BAM/CRAM files
|
|
33
29
|
export function getMatchedAlignmentFeatures(features) {
|
|
30
|
+
var _a;
|
|
34
31
|
const candidates = new Map();
|
|
35
32
|
const alreadySeen = new Set();
|
|
36
33
|
// this finds candidate features that share the same name
|
|
37
34
|
for (const feature of features.values()) {
|
|
38
35
|
const id = feature.id();
|
|
39
36
|
const unmapped = feature.get('flags') & 4;
|
|
40
|
-
const hasSA = !!
|
|
37
|
+
const hasSA = !!((_a = feature.get('tags')) === null || _a === void 0 ? void 0 : _a.SA);
|
|
41
38
|
if (!alreadySeen.has(id) && !unmapped && hasSA) {
|
|
42
39
|
const n = feature.get('name');
|
|
43
40
|
let val = candidates.get(n);
|
|
@@ -3,6 +3,7 @@ import { Instance } from 'mobx-state-tree';
|
|
|
3
3
|
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
4
4
|
import PluginManager from '@jbrowse/core/PluginManager';
|
|
5
5
|
import { Feature } from '@jbrowse/core/util';
|
|
6
|
+
export declare function getClip(cigar: string, strand: number): number;
|
|
6
7
|
export interface ExportSvgOptions {
|
|
7
8
|
rasterizeLayers?: boolean;
|
|
8
9
|
filename?: string;
|
|
@@ -319,6 +320,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
319
320
|
feature: Feature;
|
|
320
321
|
layout: LayoutRecord | undefined;
|
|
321
322
|
level: number;
|
|
323
|
+
clipPos: number;
|
|
322
324
|
}[][];
|
|
323
325
|
} & {
|
|
324
326
|
afterAttach(): void;
|
|
@@ -12,6 +12,13 @@ import LinkIcon from '@mui/icons-material/Link';
|
|
|
12
12
|
import { intersect } from './util';
|
|
13
13
|
// lazies
|
|
14
14
|
const ExportSvgDialog = lazy(() => import('./components/ExportSvgDialog'));
|
|
15
|
+
const startClip = new RegExp(/(\d+)[SH]$/);
|
|
16
|
+
const endClip = new RegExp(/^(\d+)([SH])/);
|
|
17
|
+
export function getClip(cigar, strand) {
|
|
18
|
+
return strand === -1
|
|
19
|
+
? +(startClip.exec(cigar) || [])[1] || 0
|
|
20
|
+
: +(endClip.exec(cigar) || [])[1] || 0;
|
|
21
|
+
}
|
|
15
22
|
function calc(track, f) {
|
|
16
23
|
var _a, _b;
|
|
17
24
|
return (_b = (_a = track.displays[0]).searchFeatureByID) === null || _b === void 0 ? void 0 : _b.call(_a, f.id());
|
|
@@ -149,6 +156,7 @@ export default function stateModelFactory(pluginManager) {
|
|
|
149
156
|
feature,
|
|
150
157
|
layout: calc(tracks[level], feature),
|
|
151
158
|
level,
|
|
159
|
+
clipPos: getClip(feature.get('CIGAR'), feature.get('strand')),
|
|
152
160
|
}
|
|
153
161
|
: undefined;
|
|
154
162
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-breakpoint-split-view",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.17.0",
|
|
4
4
|
"description": "JBrowse 2 breakpoint detail split view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "eed30b5e671f8f7823652d7cecc51aa89226de46"
|
|
62
62
|
}
|