jbrowse-plugin-tview 2.2.3 → 3.1.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/README.md +325 -106
- package/dist/AddHighlightModel/index.js +2 -13
- package/dist/AddHighlightModel/index.js.map +1 -1
- package/dist/LaunchTView/TviewGetPlanRpc/TviewGetPlan.d.ts +44 -64
- package/dist/LaunchTView/TviewGetPlanRpc/TviewGetPlan.js +57 -81
- package/dist/LaunchTView/TviewGetPlanRpc/TviewGetPlan.js.map +1 -1
- package/dist/LaunchTView/TviewGetPlanRpc/index.d.ts +1 -1
- package/dist/LaunchTView/align.d.ts +11 -17
- package/dist/LaunchTView/align.js +190 -150
- package/dist/LaunchTView/align.js.map +1 -1
- package/dist/LaunchTView/alleles.d.ts +51 -0
- package/dist/LaunchTView/alleles.js +213 -0
- package/dist/LaunchTView/alleles.js.map +1 -1
- package/dist/LaunchTView/fetchTviewPlan.d.ts +5 -37
- package/dist/LaunchTView/fetchTviewPlan.js +7 -28
- package/dist/LaunchTView/fetchTviewPlan.js.map +1 -1
- package/dist/LaunchTView/index.js +45 -16
- package/dist/LaunchTView/index.js.map +1 -1
- package/dist/LaunchTView/launch.d.ts +50 -0
- package/dist/LaunchTView/launch.js +48 -0
- package/dist/LaunchTView/launch.js.map +1 -0
- package/dist/LaunchTView/launchView.d.ts +3 -8
- package/dist/LaunchTView/launchView.js +18 -12
- package/dist/LaunchTView/launchView.js.map +1 -1
- package/dist/LaunchTView/modifications.d.ts +64 -0
- package/dist/LaunchTView/modifications.js +131 -0
- package/dist/LaunchTView/modifications.js.map +1 -0
- package/dist/LaunchTView/readLayout.d.ts +35 -39
- package/dist/LaunchTView/readLayout.js +44 -24
- package/dist/LaunchTView/readLayout.js.map +1 -1
- package/dist/LaunchTView/repeatStats.d.ts +1 -1
- package/dist/LaunchTView/repeatStats.js +6 -21
- package/dist/LaunchTView/repeatStats.js.map +1 -1
- package/dist/LaunchTView/tview.d.ts +34 -23
- package/dist/LaunchTView/tview.js +133 -78
- package/dist/LaunchTView/tview.js.map +1 -1
- package/dist/TViewPanel/components/TViewPanel.js +9 -4
- package/dist/TViewPanel/components/TViewPanel.js.map +1 -1
- package/dist/TViewPanel/genome.d.ts +11 -0
- package/dist/TViewPanel/genome.js +32 -0
- package/dist/TViewPanel/genome.js.map +1 -0
- package/dist/TViewPanel/init.d.ts +38 -19
- package/dist/TViewPanel/init.js +66 -39
- package/dist/TViewPanel/init.js.map +1 -1
- package/dist/TViewPanel/initMenu.d.ts +28 -0
- package/dist/TViewPanel/initMenu.js +79 -0
- package/dist/TViewPanel/initMenu.js.map +1 -0
- package/dist/TViewPanel/model.d.ts +1090 -334
- package/dist/TViewPanel/model.js +295 -89
- package/dist/TViewPanel/model.js.map +1 -1
- package/dist/TViewPanel/modifications.d.ts +25 -0
- package/dist/TViewPanel/modifications.js +94 -0
- package/dist/TViewPanel/modifications.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/jbrowse-plugin-tview.umd.production.min.js +125 -88
- package/dist/jbrowse-plugin-tview.umd.production.min.js.map +4 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +8 -8
- package/src/AddHighlightModel/index.tsx +8 -14
- package/src/LaunchTView/TviewGetPlanRpc/TviewGetPlan.ts +119 -157
- package/src/LaunchTView/TviewGetPlanRpc/index.ts +0 -1
- package/src/LaunchTView/align.ts +225 -176
- package/src/LaunchTView/alleles.ts +272 -0
- package/src/LaunchTView/fetchTviewPlan.ts +11 -54
- package/src/LaunchTView/index.ts +74 -16
- package/src/LaunchTView/launch.ts +98 -0
- package/src/LaunchTView/launchView.ts +28 -20
- package/src/LaunchTView/modifications.ts +200 -0
- package/src/LaunchTView/readLayout.ts +65 -41
- package/src/LaunchTView/repeatStats.ts +7 -23
- package/src/LaunchTView/tview.ts +165 -91
- package/src/TViewPanel/components/TViewPanel.tsx +30 -5
- package/src/TViewPanel/genome.ts +41 -0
- package/src/TViewPanel/init.ts +104 -51
- package/src/TViewPanel/initMenu.ts +126 -0
- package/src/TViewPanel/model.ts +346 -97
- package/src/TViewPanel/modifications.ts +132 -0
- package/src/index.ts +0 -2
- package/src/version.ts +1 -1
- package/dist/AddHighlightModel/GenomeMouseoverHighlight.d.ts +0 -6
- package/dist/AddHighlightModel/GenomeMouseoverHighlight.js +0 -23
- package/dist/AddHighlightModel/GenomeMouseoverHighlight.js.map +0 -1
- package/dist/AddHighlightModel/HighlightComponents.d.ts +0 -7
- package/dist/AddHighlightModel/HighlightComponents.js +0 -11
- package/dist/AddHighlightModel/HighlightComponents.js.map +0 -1
- package/dist/LaunchTView/components/ArrayReport.d.ts +0 -10
- package/dist/LaunchTView/components/ArrayReport.js +0 -59
- package/dist/LaunchTView/components/ArrayReport.js.map +0 -1
- package/dist/LaunchTView/components/LaunchTViewDialog.d.ts +0 -6
- package/dist/LaunchTView/components/LaunchTViewDialog.js +0 -124
- package/dist/LaunchTView/components/LaunchTViewDialog.js.map +0 -1
- package/dist/LaunchTView/sampleTree.d.ts +0 -37
- package/dist/LaunchTView/sampleTree.js +0 -65
- package/dist/LaunchTView/sampleTree.js.map +0 -1
- package/dist/LaunchTView/useTviewMsa.d.ts +0 -18
- package/dist/LaunchTView/useTviewMsa.js +0 -24
- package/dist/LaunchTView/useTviewMsa.js.map +0 -1
- package/dist/TViewPanel/coords.d.ts +0 -25
- package/dist/TViewPanel/coords.js +0 -56
- package/dist/TViewPanel/coords.js.map +0 -1
- package/src/AddHighlightModel/GenomeMouseoverHighlight.tsx +0 -46
- package/src/AddHighlightModel/HighlightComponents.tsx +0 -25
- package/src/LaunchTView/components/ArrayReport.tsx +0 -64
- package/src/LaunchTView/components/LaunchTViewDialog.tsx +0 -212
- package/src/LaunchTView/sampleTree.ts +0 -73
- package/src/LaunchTView/useTviewMsa.ts +0 -39
- package/src/TViewPanel/coords.ts +0 -65
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { MAX_MODIFICATION_CALLS } from '../LaunchTView/modifications'
|
|
2
|
+
|
|
3
|
+
import type { TviewModifications } from '../LaunchTView/modifications'
|
|
4
|
+
import type { MenuItem } from '@jbrowse/core/ui'
|
|
5
|
+
import type { AlignmentMarkSpec, Annotation, ResidueColor } from 'react-msaview'
|
|
6
|
+
|
|
7
|
+
/** the SAMtags codes, and the ChEBI ids JBrowse names */
|
|
8
|
+
const NAMES: Record<string, string> = {
|
|
9
|
+
m: '5mC',
|
|
10
|
+
h: '5hmC',
|
|
11
|
+
f: '5fC',
|
|
12
|
+
c: '5caC',
|
|
13
|
+
g: '5hmU',
|
|
14
|
+
e: '5fU',
|
|
15
|
+
b: '5caU',
|
|
16
|
+
a: '6mA',
|
|
17
|
+
o: '8oxoG',
|
|
18
|
+
n: 'xao',
|
|
19
|
+
17082: 'pseU',
|
|
20
|
+
17596: 'inosine',
|
|
21
|
+
21839: '4mC',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** the calls a load placed, and the ones it could not show */
|
|
25
|
+
export interface ModificationSummary {
|
|
26
|
+
shown: number
|
|
27
|
+
dropped: number
|
|
28
|
+
unplaced: number
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const MODIFICATION_MARK: AlignmentMarkSpec = {
|
|
32
|
+
kind: 'features',
|
|
33
|
+
height: { band: 1 },
|
|
34
|
+
encoding: {
|
|
35
|
+
fill: {
|
|
36
|
+
field: 'probability',
|
|
37
|
+
scale: {
|
|
38
|
+
type: 'linear',
|
|
39
|
+
domainMin: 0,
|
|
40
|
+
domainMax: 100,
|
|
41
|
+
range: ['#0000ff', '#ff0000'],
|
|
42
|
+
},
|
|
43
|
+
legend: { title: 'modification %' },
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function modificationName(type: string) {
|
|
49
|
+
return NAMES[type] ?? type
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function modificationAnnotations({
|
|
53
|
+
rows,
|
|
54
|
+
types,
|
|
55
|
+
row,
|
|
56
|
+
residue,
|
|
57
|
+
type,
|
|
58
|
+
prob,
|
|
59
|
+
}: TviewModifications): Annotation[] {
|
|
60
|
+
return Array.from(row, (r, i) => {
|
|
61
|
+
const name = modificationName(types[type[i]!]!)
|
|
62
|
+
const percent = Math.round(((prob[i]! + 0.5) / 256) * 100)
|
|
63
|
+
return {
|
|
64
|
+
id: rows[r]!,
|
|
65
|
+
accession: name,
|
|
66
|
+
name,
|
|
67
|
+
description: `${name} ${percent}%`,
|
|
68
|
+
featureType: 'modified_base',
|
|
69
|
+
start: residue[i]!,
|
|
70
|
+
end: residue[i]!,
|
|
71
|
+
attributes: { probability: String(percent) },
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const n = (x: number) => x.toLocaleString('en-US')
|
|
77
|
+
|
|
78
|
+
export function modificationSummaryLine({
|
|
79
|
+
shown,
|
|
80
|
+
dropped,
|
|
81
|
+
unplaced,
|
|
82
|
+
}: ModificationSummary) {
|
|
83
|
+
return [
|
|
84
|
+
`${n(shown)} calls shown`,
|
|
85
|
+
...(dropped
|
|
86
|
+
? [
|
|
87
|
+
`${n(dropped)} less probable over the ${n(MAX_MODIFICATION_CALLS)} cap`,
|
|
88
|
+
]
|
|
89
|
+
: []),
|
|
90
|
+
...(unplaced
|
|
91
|
+
? [`${n(unplaced)} ${unplaced === 1 ? 'row' : 'rows'} not annotated`]
|
|
92
|
+
: []),
|
|
93
|
+
].join(', ')
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface ColoredView {
|
|
97
|
+
residueColor: ResidueColor
|
|
98
|
+
resolvedResidueColor: { field: string }
|
|
99
|
+
setResidueColor: (color: ResidueColor) => void
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function modificationMenu(
|
|
103
|
+
summary: ModificationSummary,
|
|
104
|
+
view: ColoredView,
|
|
105
|
+
) {
|
|
106
|
+
const alone = view.resolvedResidueColor.field === 'feature'
|
|
107
|
+
const colorBy = (field: 'residue' | 'feature') => () => {
|
|
108
|
+
view.setResidueColor({ ...view.residueColor, field })
|
|
109
|
+
}
|
|
110
|
+
const summaryLine: MenuItem[] =
|
|
111
|
+
summary.dropped || summary.unplaced
|
|
112
|
+
? [{ type: 'subHeader', label: modificationSummaryLine(summary) }]
|
|
113
|
+
: []
|
|
114
|
+
return {
|
|
115
|
+
label: 'Base modifications',
|
|
116
|
+
subMenu: [
|
|
117
|
+
{
|
|
118
|
+
label: 'Over base colors',
|
|
119
|
+
type: 'radio',
|
|
120
|
+
checked: !alone,
|
|
121
|
+
onClick: colorBy('residue'),
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
label: 'Without base colors',
|
|
125
|
+
type: 'radio',
|
|
126
|
+
checked: alone,
|
|
127
|
+
onClick: colorBy('feature'),
|
|
128
|
+
},
|
|
129
|
+
...summaryLine,
|
|
130
|
+
],
|
|
131
|
+
} satisfies MenuItem
|
|
132
|
+
}
|
package/src/index.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '
|
|
1
|
+
export const version = '3.1.0'
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
3
|
-
declare const GenomeMouseoverHighlight: ({ model, }: {
|
|
4
|
-
model: LinearGenomeViewModel;
|
|
5
|
-
}) => React.JSX.Element | null;
|
|
6
|
-
export default GenomeMouseoverHighlight;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { getSession } from '@jbrowse/core/util';
|
|
3
|
-
import { observer } from 'mobx-react';
|
|
4
|
-
import Highlight from './Highlight';
|
|
5
|
-
function getHoverPosition(hovered) {
|
|
6
|
-
const pos = !!hovered && typeof hovered === 'object' && 'hoverPosition' in hovered
|
|
7
|
-
? hovered.hoverPosition
|
|
8
|
-
: undefined;
|
|
9
|
-
return !!pos &&
|
|
10
|
-
typeof pos === 'object' &&
|
|
11
|
-
'coord' in pos &&
|
|
12
|
-
typeof pos.coord === 'number' &&
|
|
13
|
-
'refName' in pos &&
|
|
14
|
-
typeof pos.refName === 'string'
|
|
15
|
-
? { coord: pos.coord, refName: pos.refName }
|
|
16
|
-
: undefined;
|
|
17
|
-
}
|
|
18
|
-
const GenomeMouseoverHighlight = observer(function GenomeMouseoverHighlight2({ model, }) {
|
|
19
|
-
const hoverPosition = getHoverPosition(getSession(model).hovered);
|
|
20
|
-
return hoverPosition ? (React.createElement(Highlight, { model: model, refName: hoverPosition.refName, start: hoverPosition.coord - 1, end: hoverPosition.coord })) : null;
|
|
21
|
-
});
|
|
22
|
-
export default GenomeMouseoverHighlight;
|
|
23
|
-
//# sourceMappingURL=GenomeMouseoverHighlight.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GenomeMouseoverHighlight.js","sourceRoot":"","sources":["../../src/AddHighlightModel/GenomeMouseoverHighlight.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,OAAO,SAAS,MAAM,aAAa,CAAA;AASnC,SAAS,gBAAgB,CAAC,OAAgB;IACxC,MAAM,GAAG,GACP,CAAC,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,eAAe,IAAI,OAAO;QACpE,CAAC,CAAC,OAAO,CAAC,aAAa;QACvB,CAAC,CAAC,SAAS,CAAA;IACf,OAAO,CAAC,CAAC,GAAG;QACV,OAAO,GAAG,KAAK,QAAQ;QACvB,OAAO,IAAI,GAAG;QACd,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ;QAC7B,SAAS,IAAI,GAAG;QAChB,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ;QAC/B,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE;QAC5C,CAAC,CAAC,SAAS,CAAA;AACf,CAAC;AAED,MAAM,wBAAwB,GAAG,QAAQ,CAAC,SAAS,yBAAyB,CAAC,EAC3E,KAAK,GAGN;IACC,MAAM,aAAa,GAAG,gBAAgB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAA;IACjE,OAAO,aAAa,CAAC,CAAC,CAAC,CACrB,oBAAC,SAAS,IACR,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,aAAa,CAAC,OAAO,EAC9B,KAAK,EAAE,aAAa,CAAC,KAAK,GAAG,CAAC,EAC9B,GAAG,EAAE,aAAa,CAAC,KAAK,GACxB,CACH,CAAC,CAAC,CAAC,IAAI,CAAA;AACV,CAAC,CAAC,CAAA;AAEF,eAAe,wBAAwB,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
3
|
-
type LGV = LinearGenomeViewModel;
|
|
4
|
-
declare const HighlightComponents: ({ model, }: {
|
|
5
|
-
model: LGV;
|
|
6
|
-
}) => React.JSX.Element;
|
|
7
|
-
export default HighlightComponents;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { observer } from 'mobx-react';
|
|
3
|
-
import GenomeMouseoverHighlight from './GenomeMouseoverHighlight';
|
|
4
|
-
import MsaToGenomeHighlight from './MsaToGenomeHighlight';
|
|
5
|
-
const HighlightComponents = observer(function HighlightComponents2({ model, }) {
|
|
6
|
-
return (React.createElement(React.Fragment, null,
|
|
7
|
-
React.createElement(MsaToGenomeHighlight, { model: model }),
|
|
8
|
-
React.createElement(GenomeMouseoverHighlight, { model: model })));
|
|
9
|
-
});
|
|
10
|
-
export default HighlightComponents;
|
|
11
|
-
//# sourceMappingURL=HighlightComponents.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HighlightComponents.js","sourceRoot":"","sources":["../../src/AddHighlightModel/HighlightComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,OAAO,wBAAwB,MAAM,4BAA4B,CAAA;AACjE,OAAO,oBAAoB,MAAM,wBAAwB,CAAA;AAMzD,MAAM,mBAAmB,GAAG,QAAQ,CAAC,SAAS,oBAAoB,CAAC,EACjE,KAAK,GAGN;IACC,OAAO,CACL;QACE,oBAAC,oBAAoB,IAAC,KAAK,EAAE,KAAK,GAAI;QACtC,oBAAC,wBAAwB,IAAC,KAAK,EAAE,KAAK,GAAI,CACzC,CACJ,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,mBAAmB,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { TviewPlanResult } from '../TviewGetPlanRpc';
|
|
3
|
-
/**
|
|
4
|
-
* What the reads say about the arrays before the view is opened, since the
|
|
5
|
-
* number is often the whole reason for opening it and a picture of 400 columns
|
|
6
|
-
* is a slow way to read one off.
|
|
7
|
-
*/
|
|
8
|
-
export default function ArrayReport({ data }: {
|
|
9
|
-
data: TviewPlanResult;
|
|
10
|
-
}): React.JSX.Element | null;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Typography } from '@mui/material';
|
|
3
|
-
/** allele lengths seen, commonest first, as `63bp x12` */
|
|
4
|
-
function alleleTally(lengths) {
|
|
5
|
-
const counts = new Map();
|
|
6
|
-
for (const [, length] of lengths) {
|
|
7
|
-
counts.set(length, (counts.get(length) ?? 0) + 1);
|
|
8
|
-
}
|
|
9
|
-
return [...counts]
|
|
10
|
-
.sort((a, b) => b[1] - a[1] || a[0] - b[0])
|
|
11
|
-
.map(([length, n]) => `${length}bp x${n}`);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* What the reads say about the arrays before the view is opened, since the
|
|
15
|
-
* number is often the whole reason for opening it and a picture of 400 columns
|
|
16
|
-
* is a slow way to read one off.
|
|
17
|
-
*/
|
|
18
|
-
export default function ArrayReport({ data }) {
|
|
19
|
-
const { arrays, subjectIndex, region } = data;
|
|
20
|
-
const subject = subjectIndex === undefined ? undefined : arrays[subjectIndex];
|
|
21
|
-
if (!subject) {
|
|
22
|
-
return arrays.length ? null : (React.createElement(Typography, { variant: "body2" }, "No tandem array in the reference here, so the reads are laid out base by base."));
|
|
23
|
-
}
|
|
24
|
-
const copies = subject.copies;
|
|
25
|
-
return (React.createElement(React.Fragment, null,
|
|
26
|
-
React.createElement(Typography, { variant: "subtitle2" },
|
|
27
|
-
"Tandem array at ",
|
|
28
|
-
region.refName,
|
|
29
|
-
":",
|
|
30
|
-
subject.start.toLocaleString('en-US'),
|
|
31
|
-
"-",
|
|
32
|
-
subject.end.toLocaleString('en-US'),
|
|
33
|
-
", ",
|
|
34
|
-
subject.period,
|
|
35
|
-
"bp unit",
|
|
36
|
-
' ',
|
|
37
|
-
subject.unit),
|
|
38
|
-
React.createElement(Typography, { variant: "body2" },
|
|
39
|
-
copies.length,
|
|
40
|
-
" of ",
|
|
41
|
-
data.rowCount,
|
|
42
|
-
" rows span it end to end and carry",
|
|
43
|
-
' ',
|
|
44
|
-
Math.min(...copies.map(c => c[1])),
|
|
45
|
-
"\u2013",
|
|
46
|
-
Math.max(...copies.map(c => c[1])),
|
|
47
|
-
" copies. Allele lengths:",
|
|
48
|
-
' ',
|
|
49
|
-
alleleTally(subject.lengths).join(', '),
|
|
50
|
-
"."),
|
|
51
|
-
React.createElement(Typography, { variant: "body2" }, "Each copy gets its own block of columns, so one divergent copy shows up as a column rather than shifting every copy after it. Blocks are array order, not homology: copies are counted from the left edge, and arrays expand and contract anywhere inside themselves, so the 9th copy of one row need not be the 9th of another. Read down a row, not across two."),
|
|
52
|
-
arrays.length > 1 ? (React.createElement(Typography, { variant: "body2" },
|
|
53
|
-
arrays.length - 1,
|
|
54
|
-
" shorter",
|
|
55
|
-
' ',
|
|
56
|
-
arrays.length === 2 ? 'array is' : 'arrays are',
|
|
57
|
-
" also laid out per copy; rows are ordered by this one.")) : null));
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=ArrayReport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayReport.js","sourceRoot":"","sources":["../../../src/LaunchTView/components/ArrayReport.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAI1C,0DAA0D;AAC1D,SAAS,WAAW,CAAC,OAA2B;IAC9C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAA;IACxC,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACjC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IACnD,CAAC;IACD,OAAO,CAAC,GAAG,MAAM,CAAC;SACf,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SAC1C,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,EAAE,CAAC,CAAA;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,IAAI,EAA6B;IACrE,MAA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UAAU,IAAC,OAAO,EAAC,OAAO;YACxB,MAAM,CAAC,MAAM,GAAG,CAAC;;YAAU,GAAG;YAC9B,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;qEAErC,CACd,CAAC,CAAC,CAAC,IAAI,CACP,CACJ,CAAA;AACH,CAAC"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { getConf } from '@jbrowse/core/configuration';
|
|
3
|
-
import { Dialog, ErrorMessage } from '@jbrowse/core/ui';
|
|
4
|
-
import { assembleLocString, getContainingView, getSession, } from '@jbrowse/core/util';
|
|
5
|
-
import { Button, Checkbox, DialogActions, DialogContent, FormControlLabel, Typography, } from '@mui/material';
|
|
6
|
-
import ArrayReport from './ArrayReport';
|
|
7
|
-
import { MAX_BP } from '../limits';
|
|
8
|
-
import { useTviewMsa } from '../useTviewMsa';
|
|
9
|
-
// how much of the alignment the default column width aims to put on screen
|
|
10
|
-
const FIT_WIDTH_PX = 3000;
|
|
11
|
-
function trackLabel(track) {
|
|
12
|
-
return (getConf(track, 'name') || getConf(track, 'trackId'));
|
|
13
|
-
}
|
|
14
|
-
/** every alignments track open in the same view, the launching one first */
|
|
15
|
-
function peerTracks(view, model) {
|
|
16
|
-
const alignments = view.tracks.filter(track => track.displays.some((display) => display.type === 'LinearAlignmentsDisplay'));
|
|
17
|
-
return [model, ...alignments.filter(t => t.id !== model.id)];
|
|
18
|
-
}
|
|
19
|
-
export default function LaunchTViewDialog({ handleClose, model, }) {
|
|
20
|
-
const view = getContainingView(model);
|
|
21
|
-
const session = getSession(model);
|
|
22
|
-
const block = view.dynamicBlocks.contentBlocks[0];
|
|
23
|
-
const region = block
|
|
24
|
-
? {
|
|
25
|
-
assemblyName: block.assemblyName,
|
|
26
|
-
refName: block.refName,
|
|
27
|
-
start: Math.floor(block.start),
|
|
28
|
-
end: Math.ceil(block.end),
|
|
29
|
-
}
|
|
30
|
-
: undefined;
|
|
31
|
-
const width = region ? region.end - region.start : 0;
|
|
32
|
-
const tooWide = width > MAX_BP;
|
|
33
|
-
const candidates = peerTracks(view, model);
|
|
34
|
-
// the launching track is always in; the others are opt-in, because pulling
|
|
35
|
-
// every open pileup into one alignment is a much bigger fetch than the menu
|
|
36
|
-
// item that got here suggests
|
|
37
|
-
const [extra, setExtra] = useState([]);
|
|
38
|
-
const chosen = candidates.filter(t => t.id === model.id || extra.includes(t.id));
|
|
39
|
-
// The dialog's whole output. Everything below either previews what this
|
|
40
|
-
// resolves to or hands it to a view, so what the button opens is the same
|
|
41
|
-
// blob a session could have been authored with.
|
|
42
|
-
const init = region
|
|
43
|
-
? {
|
|
44
|
-
assembly: region.assemblyName,
|
|
45
|
-
loc: assembleLocString(region),
|
|
46
|
-
tracks: chosen.map(t => ({
|
|
47
|
-
trackId: getConf(t, 'trackId'),
|
|
48
|
-
sample: trackLabel(t),
|
|
49
|
-
})),
|
|
50
|
-
}
|
|
51
|
-
: undefined;
|
|
52
|
-
const { data, error, isLoading } = useTviewMsa({
|
|
53
|
-
session,
|
|
54
|
-
init: tooWide ? undefined : init,
|
|
55
|
-
});
|
|
56
|
-
// 10 is comfortable for an ordinary pileup, but an unrolled tandem array runs
|
|
57
|
-
// to hundreds of columns and at 10 almost none of it is on screen at once.
|
|
58
|
-
// Fits the alignment to roughly two screen-widths; a no-op for the narrow
|
|
59
|
-
// regions that already fitted.
|
|
60
|
-
const totalColumns = data?.columnCount ?? 0;
|
|
61
|
-
const colWidth = totalColumns
|
|
62
|
-
? Math.max(1, Math.min(10, Math.floor(FIT_WIDTH_PX / totalColumns)))
|
|
63
|
-
: 10;
|
|
64
|
-
return (React.createElement(Dialog, { maxWidth: "xl", title: "Launch tview", onClose: () => {
|
|
65
|
-
handleClose();
|
|
66
|
-
}, open: true },
|
|
67
|
-
React.createElement(DialogContent, null,
|
|
68
|
-
React.createElement(Typography, null,
|
|
69
|
-
"Create a view similar to \"samtools tview\" for the reads in the current region: ",
|
|
70
|
-
init?.loc ?? 'Unknown'),
|
|
71
|
-
candidates.length > 1 ? (React.createElement("div", null,
|
|
72
|
-
React.createElement(Typography, { variant: "subtitle2" }, "Include reads from other alignment tracks in this view"),
|
|
73
|
-
candidates.slice(1).map(track => (React.createElement(FormControlLabel, { key: track.id, control: React.createElement(Checkbox, { checked: extra.includes(track.id), onChange: event => {
|
|
74
|
-
setExtra(event.target.checked
|
|
75
|
-
? [...extra, track.id]
|
|
76
|
-
: extra.filter(id => id !== track.id));
|
|
77
|
-
} }), label: trackLabel(track) }))))) : null,
|
|
78
|
-
tooWide ? (React.createElement(Typography, null,
|
|
79
|
-
"Region is ",
|
|
80
|
-
width.toLocaleString('en-US'),
|
|
81
|
-
"bp, wider than the",
|
|
82
|
-
' ',
|
|
83
|
-
MAX_BP.toLocaleString('en-US'),
|
|
84
|
-
"bp limit. Zoom in and try again.")) : error ? (React.createElement(ErrorMessage, { error: error })) : isLoading ? (React.createElement(Typography, null, "Loading...")) : data?.tooLarge ? (React.createElement(Typography, null,
|
|
85
|
-
data.rowCount.toLocaleString('en-US'),
|
|
86
|
-
" rows over",
|
|
87
|
-
' ',
|
|
88
|
-
data.columnCount.toLocaleString('en-US'),
|
|
89
|
-
" columns is",
|
|
90
|
-
' ',
|
|
91
|
-
data.cellCount.toLocaleString('en-US'),
|
|
92
|
-
" cells, which is too large to render. Zoom in and try again.")) : data ? (React.createElement(React.Fragment, null,
|
|
93
|
-
React.createElement(Typography, null,
|
|
94
|
-
data.rowCount,
|
|
95
|
-
" rows",
|
|
96
|
-
data.referenceName
|
|
97
|
-
? ' (the reference plus every read with sequence)'
|
|
98
|
-
: ' of reads with sequence data',
|
|
99
|
-
data.samples.length > 1
|
|
100
|
-
? `, from ${data.samples.length} tracks`
|
|
101
|
-
: ''),
|
|
102
|
-
React.createElement(ArrayReport, { data: data }))) : (React.createElement(Typography, null, "No region is currently visible."))),
|
|
103
|
-
React.createElement(DialogActions, null,
|
|
104
|
-
React.createElement(Button, { variant: "contained", color: "primary", disabled: !data?.msa || !init, onClick: () => {
|
|
105
|
-
if (init) {
|
|
106
|
-
session.addView('TView', {
|
|
107
|
-
type: 'TView',
|
|
108
|
-
displayName: init.loc,
|
|
109
|
-
init,
|
|
110
|
-
colWidth,
|
|
111
|
-
rowHeight: 12,
|
|
112
|
-
labelsAlignRight: true,
|
|
113
|
-
colorSchemeName: 'jbrowse_dna',
|
|
114
|
-
drawTree: init.tracks.length > 1,
|
|
115
|
-
connectedViewId: view.id,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
handleClose();
|
|
119
|
-
} }, "Submit"),
|
|
120
|
-
React.createElement(Button, { variant: "contained", color: "secondary", onClick: () => {
|
|
121
|
-
handleClose();
|
|
122
|
-
} }, "Cancel"))));
|
|
123
|
-
}
|
|
124
|
-
//# sourceMappingURL=LaunchTViewDialog.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LaunchTViewDialog.js","sourceRoot":"","sources":["../../../src/LaunchTView/components/LaunchTViewDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,GACX,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,MAAM,EACN,QAAQ,EACR,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,UAAU,GACX,MAAM,eAAe,CAAA;AAEtB,OAAO,WAAW,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAM5C,2EAA2E;AAC3E,MAAM,YAAY,GAAG,IAAI,CAAA;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J,QAAQ;4BACR,SAAS,EAAE,EAAE;4BACb,gBAAgB,EAAE,IAAI;4BACtB,eAAe,EAAE,aAAa;4BAC9B,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;4BAChC,eAAe,EAAE,IAAI,CAAC,EAAE;yBACzB,CAAC,CAAA;oBACJ,CAAC;oBACD,WAAW,EAAE,CAAA;gBACf,CAAC,aAGM;YACT,oBAAC,MAAM,IACL,OAAO,EAAC,WAAW,EACnB,KAAK,EAAC,WAAW,EACjB,OAAO,EAAE,GAAG,EAAE;oBACZ,WAAW,EAAE,CAAA;gBACf,CAAC,aAGM,CACK,CACT,CACV,CAAA;AACH,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A Newick tree whose only job is to group rows.
|
|
3
|
-
*
|
|
4
|
-
* With one file the rows are a pileup and their order is the whole structure.
|
|
5
|
-
* With several, the rows of two samples interleave into a list nothing separates
|
|
6
|
-
* — and react-msaview already draws a tree, collapses its clades and can show
|
|
7
|
-
* one branch alone, all of it keyed off a Newick string it is currently never
|
|
8
|
-
* given. Handing it one grouped by sample turns those controls on for free: a
|
|
9
|
-
* clade per sample, collapsible, and the allele ladder inside each.
|
|
10
|
-
*
|
|
11
|
-
* The tree is a grouping, not a phylogeny. Branch lengths are all 1 and say
|
|
12
|
-
* nothing; the topology is the sample the row came from, and the leaf order
|
|
13
|
-
* inside a clade is the copy-number order the rows were already in.
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* Newick reserves these, and a name is not quoted when it goes in.
|
|
17
|
-
*
|
|
18
|
-
* **Applied where the row name is built, not here.** react-msaview joins a tree
|
|
19
|
-
* leaf to an alignment row by name, so sanitizing on the way into the Newick
|
|
20
|
-
* and leaving the FASTA defline alone matches nothing: every row whose name
|
|
21
|
-
* needed fixing renders blank, with its label still in the tree, which looks
|
|
22
|
-
* like a rendering bug rather than a naming one. A track named `HG004 (mother)`
|
|
23
|
-
* is enough to trigger it.
|
|
24
|
-
*/
|
|
25
|
-
export declare function newickSafe(name: string): string;
|
|
26
|
-
export interface TreeRow {
|
|
27
|
-
name: string;
|
|
28
|
-
/** what the defline says, when that is not just the name */
|
|
29
|
-
label?: string;
|
|
30
|
-
sample?: string;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Groups rows by sample, keeping the order they arrive in both for the clades
|
|
34
|
-
* and inside them. Returns undefined when there is nothing to group — one
|
|
35
|
-
* sample, or none — since a tree of one clade is a line drawn beside a list.
|
|
36
|
-
*/
|
|
37
|
-
export declare function buildSampleTree(rows: TreeRow[]): string | undefined;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A Newick tree whose only job is to group rows.
|
|
3
|
-
*
|
|
4
|
-
* With one file the rows are a pileup and their order is the whole structure.
|
|
5
|
-
* With several, the rows of two samples interleave into a list nothing separates
|
|
6
|
-
* — and react-msaview already draws a tree, collapses its clades and can show
|
|
7
|
-
* one branch alone, all of it keyed off a Newick string it is currently never
|
|
8
|
-
* given. Handing it one grouped by sample turns those controls on for free: a
|
|
9
|
-
* clade per sample, collapsible, and the allele ladder inside each.
|
|
10
|
-
*
|
|
11
|
-
* The tree is a grouping, not a phylogeny. Branch lengths are all 1 and say
|
|
12
|
-
* nothing; the topology is the sample the row came from, and the leaf order
|
|
13
|
-
* inside a clade is the copy-number order the rows were already in.
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* Newick reserves these, and a name is not quoted when it goes in.
|
|
17
|
-
*
|
|
18
|
-
* **Applied where the row name is built, not here.** react-msaview joins a tree
|
|
19
|
-
* leaf to an alignment row by name, so sanitizing on the way into the Newick
|
|
20
|
-
* and leaving the FASTA defline alone matches nothing: every row whose name
|
|
21
|
-
* needed fixing renders blank, with its label still in the tree, which looks
|
|
22
|
-
* like a rendering bug rather than a naming one. A track named `HG004 (mother)`
|
|
23
|
-
* is enough to trigger it.
|
|
24
|
-
*/
|
|
25
|
-
export function newickSafe(name) {
|
|
26
|
-
return name.replaceAll(/[(),:;[\]'\s]+/g, '_').replace(/_+$/, '');
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Groups rows by sample, keeping the order they arrive in both for the clades
|
|
30
|
-
* and inside them. Returns undefined when there is nothing to group — one
|
|
31
|
-
* sample, or none — since a tree of one clade is a line drawn beside a list.
|
|
32
|
-
*/
|
|
33
|
-
export function buildSampleTree(rows) {
|
|
34
|
-
const bySample = new Map();
|
|
35
|
-
const ungrouped = [];
|
|
36
|
-
for (const row of rows) {
|
|
37
|
-
// the leaf is the row's *defline*, already Newick-safe from getReadNames.
|
|
38
|
-
// The tree must not rewrite it, and must not use the identity where the
|
|
39
|
-
// defline carries a label — react-msaview joins the two by string, and a
|
|
40
|
-
// leaf naming no row leaves that row blank with its label still drawn
|
|
41
|
-
const leaf = row.label ?? row.name;
|
|
42
|
-
if (row.sample === undefined) {
|
|
43
|
-
ungrouped.push(leaf);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
const group = bySample.get(row.sample);
|
|
47
|
-
if (group) {
|
|
48
|
-
group.push(leaf);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
bySample.set(row.sample, [leaf]);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
if (bySample.size < 2) {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
const clades = [
|
|
59
|
-
// the reference has no sample and belongs above all of them
|
|
60
|
-
...ungrouped.map(name => `${name}:1`),
|
|
61
|
-
...[...bySample].map(([sample, names]) => `(${names.map(n => `${n}:1`).join(',')})${sample}:1`),
|
|
62
|
-
];
|
|
63
|
-
return `(${clades.join(',')});`;
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=sampleTree.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sampleTree.js","sourceRoot":"","sources":["../../src/LaunchTView/sampleTree.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AClB,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,MAAM,IAAI,CAC1E;KACF,CAAA;IACD,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAA;AACjC,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { TviewInit } from '../TViewPanel/init';
|
|
2
|
-
import type { AbstractSessionModel } from '@jbrowse/core/util';
|
|
3
|
-
/**
|
|
4
|
-
* A preview of what a `TviewInit` resolves to, for the dialog to report before
|
|
5
|
-
* the view is opened.
|
|
6
|
-
*
|
|
7
|
-
* Resolved through the same two functions the view itself uses, so what the
|
|
8
|
-
* dialog states and what the view then builds cannot disagree.
|
|
9
|
-
*/
|
|
10
|
-
export declare function useTviewMsa({ session, init, }: {
|
|
11
|
-
session: AbstractSessionModel;
|
|
12
|
-
init?: TviewInit;
|
|
13
|
-
}): import("swr").SWRResponse<import("./TviewGetPlanRpc").TviewPlanResult, any, {
|
|
14
|
-
revalidateOnFocus: boolean;
|
|
15
|
-
revalidateOnReconnect: boolean;
|
|
16
|
-
revalidateIfStale: boolean;
|
|
17
|
-
shouldRetryOnError: boolean;
|
|
18
|
-
}>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import useSWR from 'swr';
|
|
2
|
-
import { fetchTviewPlan } from './fetchTviewPlan';
|
|
3
|
-
import { initRegion, initSources } from '../TViewPanel/init';
|
|
4
|
-
const staticSwrConfig = {
|
|
5
|
-
revalidateOnFocus: false,
|
|
6
|
-
revalidateOnReconnect: false,
|
|
7
|
-
revalidateIfStale: false,
|
|
8
|
-
shouldRetryOnError: false,
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* A preview of what a `TviewInit` resolves to, for the dialog to report before
|
|
12
|
-
* the view is opened.
|
|
13
|
-
*
|
|
14
|
-
* Resolved through the same two functions the view itself uses, so what the
|
|
15
|
-
* dialog states and what the view then builds cannot disagree.
|
|
16
|
-
*/
|
|
17
|
-
export function useTviewMsa({ session, init, }) {
|
|
18
|
-
const region = init ? initRegion(session, init) : undefined;
|
|
19
|
-
const sources = init ? initSources(session, init) : undefined;
|
|
20
|
-
return useSWR(region && sources
|
|
21
|
-
? { tag: 'tview', loc: init.loc, tracks: init.tracks, region, sources }
|
|
22
|
-
: null, ({ region, sources }) => fetchTviewPlan({ session, sources, region }), staticSwrConfig);
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=useTviewMsa.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTviewMsa.js","sourceRoot":"","sources":["../../src/LaunchTView/useTviewMsa.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,KAAK,CAAA;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAK5D,MAAM,eAAe,GAAG;IACtB,iBAAiB,EAAE,KAAK;IACxB,qBAAqB,EAAE,KAAK;IAC5B,iBAAiB,EAAE,KAAK;IACxB,kBAAkB,EAAE,KAAK;CAC1B,CAAA;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,EAC1B,OAAO,EACP,IAAI,GAIL;IACC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC3D,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC7D,OAAO,MAAM,CACX,MAAM,IAAI,OAAO;QACf,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,IAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAK,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;QACzE,CAAC,CAAC,IAAI,EACR,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EACrE,eAAe,CAChB,CAAA;AACH,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Inverse of the column layout built by buildTviewMsa: the alignment emits each
|
|
3
|
-
* reference position's insertion columns followed by its reference column, so a
|
|
4
|
-
* flat column -> reference position array recovers the mapping.
|
|
5
|
-
*
|
|
6
|
-
* An array block is the exception. Its columns are copies rather than positions,
|
|
7
|
-
* and a copy is not at any one reference base — the whole point of the block is
|
|
8
|
-
* that reads disagree about where the bases are. Its columns therefore ramp
|
|
9
|
-
* evenly across the interval the array covers, which is right at the two edges
|
|
10
|
-
* and an interpolation in between; hovering a copy lands in the array, which is
|
|
11
|
-
* the honest answer.
|
|
12
|
-
*/
|
|
13
|
-
export declare function buildColumnToRefPos({ start, end, insertionWidths, arraySpans, }: {
|
|
14
|
-
start: number;
|
|
15
|
-
end: number;
|
|
16
|
-
insertionWidths: [number, number][];
|
|
17
|
-
arraySpans?: [number, number, number][];
|
|
18
|
-
}): number[];
|
|
19
|
-
/**
|
|
20
|
-
* react-msaview drops all-gap columns from the rendering when hideGaps is
|
|
21
|
-
* effective (a row is collapsed, or allowedGappyness < 100), so the column
|
|
22
|
-
* index its mouse handlers report counts only visible columns. Expand it back
|
|
23
|
-
* to an index into the full alignment. `blanks` is ascending.
|
|
24
|
-
*/
|
|
25
|
-
export declare function renderedColToMsaCol(blanks: number[], col: number): number;
|