jbrowse-plugin-mafviewer 1.4.3 → 1.4.5
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/README.md +1 -1
- package/dist/LinearMafDisplay/components/InsertionSequenceDialog/InsertionSequenceDialog.d.ts +14 -0
- package/dist/LinearMafDisplay/components/InsertionSequenceDialog/InsertionSequenceDialog.js +69 -0
- package/dist/LinearMafDisplay/components/InsertionSequenceDialog/InsertionSequenceDialog.js.map +1 -0
- package/dist/LinearMafDisplay/components/LinearMafDisplayComponent.js +4 -4
- package/dist/LinearMafDisplay/components/LinearMafDisplayComponent.js.map +1 -1
- package/dist/LinearMafDisplay/components/Sidebar/ColorLegend.js +2 -2
- package/dist/LinearMafDisplay/components/Sidebar/ColorLegend.js.map +1 -1
- package/dist/LinearMafDisplay/components/Sidebar/RectBg.d.ts +1 -1
- package/dist/LinearMafDisplay/components/Sidebar/RectBg.js +2 -3
- package/dist/LinearMafDisplay/components/Sidebar/RectBg.js.map +1 -1
- package/dist/LinearMafDisplay/components/Sidebar/SvgWrapper.js +81 -11
- package/dist/LinearMafDisplay/components/Sidebar/SvgWrapper.js.map +1 -1
- package/dist/LinearMafDisplay/components/Sidebar/Tree.js +30 -9
- package/dist/LinearMafDisplay/components/Sidebar/Tree.js.map +1 -1
- package/dist/LinearMafDisplay/components/Sidebar/YScaleBars.d.ts +0 -1
- package/dist/LinearMafDisplay/components/Sidebar/YScaleBars.js.map +1 -1
- package/dist/LinearMafDisplay/renderSvg.js +1 -1
- package/dist/LinearMafDisplay/renderSvg.js.map +1 -1
- package/dist/LinearMafDisplay/stateModel.d.ts +69 -3
- package/dist/LinearMafDisplay/stateModel.js +96 -1
- package/dist/LinearMafDisplay/stateModel.js.map +1 -1
- package/dist/LinearMafDisplay/util.d.ts +1 -0
- package/dist/LinearMafDisplay/util.js +3 -2
- package/dist/LinearMafDisplay/util.js.map +1 -1
- package/dist/LinearMafRenderer/LinearMafRenderer.d.ts +4 -7
- package/dist/LinearMafRenderer/LinearMafRenderer.js.map +1 -1
- package/dist/LinearMafRenderer/components/LinearMafRendering.js +27 -9
- package/dist/LinearMafRenderer/components/LinearMafRendering.js.map +1 -1
- package/dist/LinearMafRenderer/makeImageData.js +6 -7
- package/dist/LinearMafRenderer/makeImageData.js.map +1 -1
- package/dist/LinearMafRenderer/rendering/features.d.ts +0 -1
- package/dist/LinearMafRenderer/rendering/features.js +1 -14
- package/dist/LinearMafRenderer/rendering/features.js.map +1 -1
- package/dist/LinearMafRenderer/rendering/insertions.js +8 -6
- package/dist/LinearMafRenderer/rendering/insertions.js.map +1 -1
- package/dist/LinearMafRenderer/rendering/matches.d.ts +1 -1
- package/dist/LinearMafRenderer/rendering/matches.js +3 -15
- package/dist/LinearMafRenderer/rendering/matches.js.map +1 -1
- package/dist/LinearMafRenderer/rendering/spatialIndex.js +8 -2
- package/dist/LinearMafRenderer/rendering/spatialIndex.js.map +1 -1
- package/dist/LinearMafRenderer/rendering/text.js +1 -3
- package/dist/LinearMafRenderer/rendering/text.js.map +1 -1
- package/dist/LinearMafRenderer/rendering/types.d.ts +5 -4
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js +7 -7
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js.map +4 -4
- package/dist/util/fastaUtils.js +23 -50
- package/dist/util/fastaUtils.js.map +1 -1
- package/package.json +7 -7
- package/src/LinearMafDisplay/components/InsertionSequenceDialog/InsertionSequenceDialog.tsx +105 -0
- package/src/LinearMafDisplay/components/LinearMafDisplayComponent.tsx +4 -4
- package/src/LinearMafDisplay/components/Sidebar/ColorLegend.tsx +2 -6
- package/src/LinearMafDisplay/components/Sidebar/RectBg.tsx +8 -3
- package/src/LinearMafDisplay/components/Sidebar/SvgWrapper.tsx +117 -15
- package/src/LinearMafDisplay/components/Sidebar/Tree.tsx +53 -8
- package/src/LinearMafDisplay/components/Sidebar/YScaleBars.tsx +0 -1
- package/src/LinearMafDisplay/renderSvg.tsx +1 -1
- package/src/LinearMafDisplay/stateModel.ts +109 -1
- package/src/LinearMafDisplay/util.ts +4 -2
- package/src/LinearMafRenderer/LinearMafRenderer.ts +2 -4
- package/src/LinearMafRenderer/components/LinearMafRendering.tsx +49 -29
- package/src/LinearMafRenderer/makeImageData.ts +5 -14
- package/src/LinearMafRenderer/rendering/features.ts +2 -36
- package/src/LinearMafRenderer/rendering/insertions.ts +11 -6
- package/src/LinearMafRenderer/rendering/matches.ts +2 -27
- package/src/LinearMafRenderer/rendering/spatialIndex.ts +9 -2
- package/src/LinearMafRenderer/rendering/text.ts +1 -2
- package/src/LinearMafRenderer/rendering/types.ts +7 -4
- package/src/util/fastaUtils.ts +28 -54
- package/dist/LinearMafRenderer/components/util.d.ts +0 -1
- package/dist/LinearMafRenderer/components/util.js +0 -13
- package/dist/LinearMafRenderer/components/util.js.map +0 -1
- package/src/LinearMafRenderer/components/util.ts +0 -13
package/src/util/fastaUtils.ts
CHANGED
|
@@ -25,72 +25,44 @@ export function processFeaturesToFasta({
|
|
|
25
25
|
const region = regions[0]!
|
|
26
26
|
const sampleToRowMap = new Map(samples.map((s, i) => [s.id, i]))
|
|
27
27
|
const rlen = region.end - region.start
|
|
28
|
-
|
|
28
|
+
|
|
29
|
+
// Use character arrays instead of strings for O(1) mutations
|
|
30
|
+
const outputRowsArrays = samples.map(() => new Array(rlen).fill('-'))
|
|
31
|
+
|
|
29
32
|
for (const feature of features.values()) {
|
|
30
33
|
const leftCoord = feature.get('start')
|
|
31
34
|
const vals = feature.get('alignments') as Record<string, AlignmentRecord>
|
|
32
35
|
const seq = feature.get('seq')
|
|
33
|
-
for (const [sample, val] of Object.entries(vals)) {
|
|
34
|
-
const origAlignment = val.seq
|
|
35
|
-
const alignment = origAlignment
|
|
36
36
|
|
|
37
|
+
for (const [sample, val] of Object.entries(vals)) {
|
|
38
|
+
const alignment = val.seq
|
|
37
39
|
const row = sampleToRowMap.get(sample)
|
|
38
40
|
if (row === undefined) {
|
|
39
41
|
continue
|
|
40
42
|
}
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
for (let i = 0, o = 0, l = alignment.length; i < l; i++) {
|
|
44
|
-
if (seq[i] !== '-') {
|
|
45
|
-
if (alignment[i] === '-') {
|
|
46
|
-
const l = leftCoord + o - region.start
|
|
47
|
-
if (l >= 0 && l < rlen) {
|
|
48
|
-
outputRows[row] =
|
|
49
|
-
outputRows[row]!.slice(0, l) +
|
|
50
|
-
'-' +
|
|
51
|
-
outputRows[row]!.slice(l + 1)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
o++
|
|
55
|
-
}
|
|
56
|
-
}
|
|
44
|
+
const rowArray = outputRowsArrays[row]!
|
|
57
45
|
|
|
58
|
-
|
|
59
|
-
// matches
|
|
60
|
-
for (let i = 0, o = 0, l = alignment.length; i < l; i++) {
|
|
61
|
-
if (seq[i] !== '-') {
|
|
62
|
-
const c = alignment[i]
|
|
63
|
-
const l = leftCoord + o - region.start
|
|
64
|
-
if (l >= 0 && l < rlen) {
|
|
65
|
-
if (seq[i] === c && c !== '-' && c !== ' ') {
|
|
66
|
-
outputRows[row] =
|
|
67
|
-
outputRows[row]!.slice(0, l) +
|
|
68
|
-
'.' +
|
|
69
|
-
outputRows[row]!.slice(l + 1)
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
o++
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// mismatches
|
|
46
|
+
// Single-pass processing: handle gaps, matches, and mismatches together
|
|
78
47
|
for (let i = 0, o = 0, l = alignment.length; i < l; i++) {
|
|
79
|
-
const c = alignment[i]
|
|
80
48
|
if (seq[i] !== '-') {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
49
|
+
const c = alignment[i]
|
|
50
|
+
const pos = leftCoord + o - region.start
|
|
51
|
+
|
|
52
|
+
if (pos >= 0 && pos < rlen) {
|
|
53
|
+
if (c === '-') {
|
|
54
|
+
// Gap
|
|
55
|
+
rowArray[pos] = '-'
|
|
56
|
+
} else if (c !== ' ') {
|
|
57
|
+
if (showAllLetters) {
|
|
58
|
+
// Show all letters mode: write character directly
|
|
59
|
+
rowArray[pos] = c
|
|
60
|
+
} else if (seq[i] === c) {
|
|
61
|
+
// Match: use dot notation
|
|
62
|
+
rowArray[pos] = '.'
|
|
63
|
+
} else {
|
|
64
|
+
// Mismatch: write character
|
|
65
|
+
rowArray[pos] = c
|
|
94
66
|
}
|
|
95
67
|
}
|
|
96
68
|
}
|
|
@@ -99,5 +71,7 @@ export function processFeaturesToFasta({
|
|
|
99
71
|
}
|
|
100
72
|
}
|
|
101
73
|
}
|
|
102
|
-
|
|
74
|
+
|
|
75
|
+
// Convert character arrays back to strings
|
|
76
|
+
return outputRowsArrays.map(arr => arr.join(''))
|
|
103
77
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function minElt<T>(arr: Iterable<T>, cb: (arg: T) => number): T | undefined;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/LinearMafRenderer/components/util.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,MAAM,CAAI,GAAgB,EAAE,EAAsB;IAChE,IAAI,GAAG,GAAG,QAAQ,CAAA;IAClB,IAAI,UAAyB,CAAA;IAC7B,KAAK,MAAM,KAAK,IAAI,GAAG,EAAE,CAAC;QACxB,MAAM,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,CAAA;QAErB,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC;YACd,GAAG,GAAG,GAAG,CAAA;YACT,UAAU,GAAG,KAAK,CAAA;QACpB,CAAC;IACH,CAAC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export function minElt<T>(arr: Iterable<T>, cb: (arg: T) => number) {
|
|
2
|
-
let min = Infinity
|
|
3
|
-
let minElement: T | undefined
|
|
4
|
-
for (const entry of arr) {
|
|
5
|
-
const val = cb(entry)
|
|
6
|
-
|
|
7
|
-
if (val < min) {
|
|
8
|
-
min = val
|
|
9
|
-
minElement = entry
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return minElement
|
|
13
|
-
}
|