jbrowse-plugin-tview 2.2.3 → 3.0.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.
Files changed (110) hide show
  1. package/README.md +317 -105
  2. package/dist/AddHighlightModel/index.js +2 -13
  3. package/dist/AddHighlightModel/index.js.map +1 -1
  4. package/dist/LaunchTView/TviewGetPlanRpc/TviewGetPlan.d.ts +44 -64
  5. package/dist/LaunchTView/TviewGetPlanRpc/TviewGetPlan.js +57 -81
  6. package/dist/LaunchTView/TviewGetPlanRpc/TviewGetPlan.js.map +1 -1
  7. package/dist/LaunchTView/TviewGetPlanRpc/index.d.ts +1 -1
  8. package/dist/LaunchTView/align.d.ts +11 -17
  9. package/dist/LaunchTView/align.js +190 -150
  10. package/dist/LaunchTView/align.js.map +1 -1
  11. package/dist/LaunchTView/alleles.d.ts +14 -0
  12. package/dist/LaunchTView/alleles.js +47 -0
  13. package/dist/LaunchTView/alleles.js.map +1 -1
  14. package/dist/LaunchTView/fetchTviewPlan.d.ts +5 -37
  15. package/dist/LaunchTView/fetchTviewPlan.js +7 -28
  16. package/dist/LaunchTView/fetchTviewPlan.js.map +1 -1
  17. package/dist/LaunchTView/index.js +45 -16
  18. package/dist/LaunchTView/index.js.map +1 -1
  19. package/dist/LaunchTView/launch.d.ts +50 -0
  20. package/dist/LaunchTView/launch.js +48 -0
  21. package/dist/LaunchTView/launch.js.map +1 -0
  22. package/dist/LaunchTView/launchView.d.ts +3 -8
  23. package/dist/LaunchTView/launchView.js +18 -12
  24. package/dist/LaunchTView/launchView.js.map +1 -1
  25. package/dist/LaunchTView/modifications.d.ts +64 -0
  26. package/dist/LaunchTView/modifications.js +131 -0
  27. package/dist/LaunchTView/modifications.js.map +1 -0
  28. package/dist/LaunchTView/readLayout.d.ts +35 -39
  29. package/dist/LaunchTView/readLayout.js +44 -24
  30. package/dist/LaunchTView/readLayout.js.map +1 -1
  31. package/dist/LaunchTView/repeatStats.d.ts +1 -1
  32. package/dist/LaunchTView/repeatStats.js +6 -21
  33. package/dist/LaunchTView/repeatStats.js.map +1 -1
  34. package/dist/LaunchTView/tview.d.ts +34 -23
  35. package/dist/LaunchTView/tview.js +127 -78
  36. package/dist/LaunchTView/tview.js.map +1 -1
  37. package/dist/TViewPanel/components/TViewPanel.js +9 -4
  38. package/dist/TViewPanel/components/TViewPanel.js.map +1 -1
  39. package/dist/TViewPanel/genome.d.ts +11 -0
  40. package/dist/TViewPanel/genome.js +32 -0
  41. package/dist/TViewPanel/genome.js.map +1 -0
  42. package/dist/TViewPanel/init.d.ts +38 -19
  43. package/dist/TViewPanel/init.js +66 -39
  44. package/dist/TViewPanel/init.js.map +1 -1
  45. package/dist/TViewPanel/initMenu.d.ts +28 -0
  46. package/dist/TViewPanel/initMenu.js +79 -0
  47. package/dist/TViewPanel/initMenu.js.map +1 -0
  48. package/dist/TViewPanel/model.d.ts +1057 -334
  49. package/dist/TViewPanel/model.js +298 -87
  50. package/dist/TViewPanel/model.js.map +1 -1
  51. package/dist/TViewPanel/modifications.d.ts +25 -0
  52. package/dist/TViewPanel/modifications.js +89 -0
  53. package/dist/TViewPanel/modifications.js.map +1 -0
  54. package/dist/index.d.ts +0 -1
  55. package/dist/index.js +0 -1
  56. package/dist/index.js.map +1 -1
  57. package/dist/jbrowse-plugin-tview.umd.production.min.js +125 -88
  58. package/dist/jbrowse-plugin-tview.umd.production.min.js.map +4 -4
  59. package/dist/version.d.ts +1 -1
  60. package/dist/version.js +1 -1
  61. package/package.json +8 -8
  62. package/src/AddHighlightModel/index.tsx +8 -14
  63. package/src/LaunchTView/TviewGetPlanRpc/TviewGetPlan.ts +119 -157
  64. package/src/LaunchTView/TviewGetPlanRpc/index.ts +0 -1
  65. package/src/LaunchTView/align.ts +225 -176
  66. package/src/LaunchTView/alleles.ts +66 -0
  67. package/src/LaunchTView/fetchTviewPlan.ts +11 -54
  68. package/src/LaunchTView/index.ts +74 -16
  69. package/src/LaunchTView/launch.ts +98 -0
  70. package/src/LaunchTView/launchView.ts +28 -20
  71. package/src/LaunchTView/modifications.ts +200 -0
  72. package/src/LaunchTView/readLayout.ts +65 -41
  73. package/src/LaunchTView/repeatStats.ts +7 -23
  74. package/src/LaunchTView/tview.ts +158 -91
  75. package/src/TViewPanel/components/TViewPanel.tsx +33 -4
  76. package/src/TViewPanel/genome.ts +41 -0
  77. package/src/TViewPanel/init.ts +104 -51
  78. package/src/TViewPanel/initMenu.ts +126 -0
  79. package/src/TViewPanel/model.ts +350 -97
  80. package/src/TViewPanel/modifications.ts +127 -0
  81. package/src/index.ts +0 -2
  82. package/src/version.ts +1 -1
  83. package/dist/AddHighlightModel/GenomeMouseoverHighlight.d.ts +0 -6
  84. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js +0 -23
  85. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js.map +0 -1
  86. package/dist/AddHighlightModel/HighlightComponents.d.ts +0 -7
  87. package/dist/AddHighlightModel/HighlightComponents.js +0 -11
  88. package/dist/AddHighlightModel/HighlightComponents.js.map +0 -1
  89. package/dist/LaunchTView/components/ArrayReport.d.ts +0 -10
  90. package/dist/LaunchTView/components/ArrayReport.js +0 -59
  91. package/dist/LaunchTView/components/ArrayReport.js.map +0 -1
  92. package/dist/LaunchTView/components/LaunchTViewDialog.d.ts +0 -6
  93. package/dist/LaunchTView/components/LaunchTViewDialog.js +0 -124
  94. package/dist/LaunchTView/components/LaunchTViewDialog.js.map +0 -1
  95. package/dist/LaunchTView/sampleTree.d.ts +0 -37
  96. package/dist/LaunchTView/sampleTree.js +0 -65
  97. package/dist/LaunchTView/sampleTree.js.map +0 -1
  98. package/dist/LaunchTView/useTviewMsa.d.ts +0 -18
  99. package/dist/LaunchTView/useTviewMsa.js +0 -24
  100. package/dist/LaunchTView/useTviewMsa.js.map +0 -1
  101. package/dist/TViewPanel/coords.d.ts +0 -25
  102. package/dist/TViewPanel/coords.js +0 -56
  103. package/dist/TViewPanel/coords.js.map +0 -1
  104. package/src/AddHighlightModel/GenomeMouseoverHighlight.tsx +0 -46
  105. package/src/AddHighlightModel/HighlightComponents.tsx +0 -25
  106. package/src/LaunchTView/components/ArrayReport.tsx +0 -64
  107. package/src/LaunchTView/components/LaunchTViewDialog.tsx +0 -212
  108. package/src/LaunchTView/sampleTree.ts +0 -73
  109. package/src/LaunchTView/useTviewMsa.ts +0 -39
  110. package/src/TViewPanel/coords.ts +0 -65
@@ -1,6 +1,6 @@
1
1
  /** the subset of an @jbrowse/core Feature that the layout reads */
2
2
  export interface AlignmentFeature {
3
- get: (key: string) => any;
3
+ get: (key: string) => unknown;
4
4
  }
5
5
  /**
6
6
  * Only '-' and '.' are treated as gaps by react-msaview (anything else counts
@@ -14,35 +14,43 @@ export interface AlignmentFeature {
14
14
  */
15
15
  export declare const SPANNED_GAP = "-";
16
16
  export declare const ABSENT = ".";
17
+ export declare const GAPS: RegExp;
17
18
  export interface ReadLayout {
18
19
  /**
19
- * Identity. Every per-row lookup is keyed by this — the array blocks, the
20
- * tree — so it is fixed once, here, and nothing downstream rewrites it.
20
+ * Identity, and the row's name in the alignment. Every per-row lookup is
21
+ * keyed by this — the array blocks, the row table — so it is fixed once,
22
+ * here, and nothing downstream rewrites it.
21
23
  */
22
24
  name: string;
23
- /**
24
- * What the row is called on screen, when that is not just its name. Kept
25
- * apart from `name` because the copy-number label is added after the array
26
- * blocks are built and keyed: renaming in place instead left every labelled
27
- * row unable to find its own block, and the block fell back to gaps — a row
28
- * that silently loses its sequence while keeping its label.
29
- */
30
- label?: string;
31
- /**
32
- * The sample the row belongs to, when several were loaded at once. Already
33
- * Newick-safe, and the same string the row's own name is prefixed with, so
34
- * the clade label and its leaves agree.
35
- */
25
+ /** the sample the row belongs to, as the caller named it */
36
26
  sample?: string;
37
27
  start: number;
38
28
  /** one char per reference position consumed: the aligned base, or a gap */
39
29
  refChars: string;
40
30
  /** reference position -> bases inserted immediately before that position */
41
31
  insertions: Map<number, string>;
32
+ /** where the row's bases came from in the read, for a row parsed from one */
33
+ query?: ReadQuery;
34
+ }
35
+ /**
36
+ * The read's own sequence, SEQ as the file stores it, and enough of its CIGAR
37
+ * to find any base of the row in it: the query index of the first base at
38
+ * `start`, and how many bases the aligner inserted before each position. Kept
39
+ * as parsed, since the layout later moves and drops insertions.
40
+ */
41
+ export interface ReadQuery {
42
+ seq: string;
43
+ offset: number;
44
+ inserted: Map<number, number>;
42
45
  }
43
46
  export declare const byStart: (a: ReadLayout, b: ReadLayout) => number;
44
47
  export declare function parseCigar(cigar: string): string[];
45
48
  export declare function parseRead(feature: AlignmentFeature, name: string, sample?: string): ReadLayout;
49
+ /**
50
+ * The query index of the first base a parsed read has at or after reference
51
+ * position `pos`, counting what it inserted at `pos` itself as coming first.
52
+ */
53
+ export declare function queryIndexAt(read: ReadLayout, query: ReadQuery, pos: number): number;
46
54
  /**
47
55
  * Reads are fetched by overlap, so they carry insertions on either side of the
48
56
  * region. Those get no columns and are never rendered, so dropping them keeps
@@ -51,35 +59,23 @@ export declare function parseRead(feature: AlignmentFeature, name: string, sampl
51
59
  export declare function clipInsertions(reads: ReadLayout[], start: number, end: number): {
52
60
  insertions: Map<number, string>;
53
61
  /**
54
- * Identity. Every per-row lookup is keyed by this — the array blocks, the
55
- * tree — so it is fixed once, here, and nothing downstream rewrites it.
62
+ * Identity, and the row's name in the alignment. Every per-row lookup is
63
+ * keyed by this — the array blocks, the row table — so it is fixed once,
64
+ * here, and nothing downstream rewrites it.
56
65
  */
57
66
  name: string;
58
- /**
59
- * What the row is called on screen, when that is not just its name. Kept
60
- * apart from `name` because the copy-number label is added after the array
61
- * blocks are built and keyed: renaming in place instead left every labelled
62
- * row unable to find its own block, and the block fell back to gaps — a row
63
- * that silently loses its sequence while keeping its label.
64
- */
65
- label?: string;
66
- /**
67
- * The sample the row belongs to, when several were loaded at once. Already
68
- * Newick-safe, and the same string the row's own name is prefixed with, so
69
- * the clade label and its leaves agree.
70
- */
67
+ /** the sample the row belongs to, as the caller named it */
71
68
  sample?: string;
72
69
  start: number;
73
70
  /** one char per reference position consumed: the aligned base, or a gap */
74
71
  refChars: string;
72
+ /** where the row's bases came from in the read, for a row parsed from one */
73
+ query?: ReadQuery;
75
74
  }[];
76
75
  /**
77
- * MSA rows are keyed by name, so mates and duplicate names need disambiguating.
78
- * With several samples loaded at once the same read name can also arrive twice
79
- * from two files, which the sample prefix separates before the counter has to.
80
- *
81
- * The name is made Newick-safe here rather than where the tree is written,
82
- * because the tree names the same rows the FASTA does and the two have to agree
83
- * exactly. '|' separates the parts because ':' opens a branch length.
76
+ * MSA rows are keyed by name, and a FASTA defline names its row by the first
77
+ * whitespace-delimited word, dropping any later row whose word repeats. So a
78
+ * name loses its whitespace, mates are told apart by flag, and whatever still
79
+ * collides (the same read in two files, or a name in `reserved`) is numbered.
84
80
  */
85
- export declare function getReadNames(features: AlignmentFeature[], sampleOf?: (index: number) => string | undefined): string[];
81
+ export declare function getReadNames(features: AlignmentFeature[], reserved?: string[]): string[];
@@ -1,4 +1,4 @@
1
- import { newickSafe } from './sampleTree';
1
+ const text = (value) => (typeof value === 'string' ? value : '');
2
2
  /**
3
3
  * Only '-' and '.' are treated as gaps by react-msaview (anything else counts
4
4
  * as a base in the conservation track and column stats), so the two of them
@@ -11,21 +11,27 @@ import { newickSafe } from './sampleTree';
11
11
  */
12
12
  export const SPANNED_GAP = '-';
13
13
  export const ABSENT = '.';
14
+ export const GAPS = /[-.]/g;
14
15
  const cigarRegex = /([MIDNSHPX=])/;
15
16
  export const byStart = (a, b) => a.start - b.start;
16
17
  export function parseCigar(cigar) {
17
18
  return cigar.split(cigarRegex).slice(0, -1);
18
19
  }
19
20
  export function parseRead(feature, name, sample) {
20
- const seq = feature.get('seq');
21
- const ops = parseCigar(feature.get('CIGAR'));
22
- const start = feature.get('start');
21
+ const seq = text(feature.get('seq'));
22
+ const ops = parseCigar(text(feature.get('CIGAR')));
23
+ const start = Number(feature.get('start'));
23
24
  const insertions = new Map();
25
+ const inserted = new Map();
24
26
  let refChars = '';
25
27
  let seqOffset = 0;
28
+ let offset;
26
29
  for (let i = 0; i < ops.length; i += 2) {
27
30
  const len = +ops[i];
28
31
  const op = ops[i + 1];
32
+ if (op !== 'S' && op !== 'H' && op !== 'P') {
33
+ offset ??= seqOffset;
34
+ }
29
35
  if (op === 'S') {
30
36
  seqOffset += len;
31
37
  }
@@ -34,6 +40,7 @@ export function parseRead(feature, name, sample) {
34
40
  const pos = start + refChars.length;
35
41
  const prev = insertions.get(pos) ?? '';
36
42
  insertions.set(pos, prev + seq.slice(seqOffset, seqOffset + len));
43
+ inserted.set(pos, (inserted.get(pos) ?? 0) + len);
37
44
  seqOffset += len;
38
45
  }
39
46
  else if (op === 'D') {
@@ -48,16 +55,31 @@ export function parseRead(feature, name, sample) {
48
55
  }
49
56
  // H and P consume neither the read sequence nor the reference
50
57
  }
51
- // sanitized here, the same way getReadNames sanitizes the prefix it builds
52
- // from it, so the clade label and the leaves inside it are one string
53
58
  return {
54
59
  name,
55
- sample: sample === undefined ? undefined : newickSafe(sample),
60
+ sample,
56
61
  start,
57
62
  refChars,
58
63
  insertions,
64
+ query: { seq, offset: offset ?? seqOffset, inserted },
59
65
  };
60
66
  }
67
+ /**
68
+ * The query index of the first base a parsed read has at or after reference
69
+ * position `pos`, counting what it inserted at `pos` itself as coming first.
70
+ */
71
+ export function queryIndexAt(read, query, pos) {
72
+ const aligned = read.refChars
73
+ .slice(0, Math.max(0, pos - read.start))
74
+ .replaceAll(GAPS, '').length;
75
+ let insertedBefore = 0;
76
+ for (const [at, len] of query.inserted) {
77
+ if (at < pos) {
78
+ insertedBefore += len;
79
+ }
80
+ }
81
+ return query.offset + aligned + insertedBefore;
82
+ }
61
83
  /**
62
84
  * Reads are fetched by overlap, so they carry insertions on either side of the
63
85
  * region. Those get no columns and are never rendered, so dropping them keeps
@@ -73,24 +95,22 @@ function mateSuffix(flags) {
73
95
  return flags === undefined || !(flags & 1) ? '' : flags & 64 ? '/1' : '/2';
74
96
  }
75
97
  /**
76
- * MSA rows are keyed by name, so mates and duplicate names need disambiguating.
77
- * With several samples loaded at once the same read name can also arrive twice
78
- * from two files, which the sample prefix separates before the counter has to.
79
- *
80
- * The name is made Newick-safe here rather than where the tree is written,
81
- * because the tree names the same rows the FASTA does and the two have to agree
82
- * exactly. '|' separates the parts because ':' opens a branch length.
98
+ * MSA rows are keyed by name, and a FASTA defline names its row by the first
99
+ * whitespace-delimited word, dropping any later row whose word repeats. So a
100
+ * name loses its whitespace, mates are told apart by flag, and whatever still
101
+ * collides (the same read in two files, or a name in `reserved`) is numbered.
83
102
  */
84
- export function getReadNames(features, sampleOf) {
85
- const counts = new Map();
86
- return features.map((f, i) => {
87
- const sample = sampleOf?.(i);
88
- const prefix = sample ? `${newickSafe(sample)}|` : '';
89
- const name = newickSafe(String(f.get('name')));
90
- const base = `${prefix}${name}${mateSuffix(f.get('flags'))}`;
91
- const n = (counts.get(base) ?? 0) + 1;
92
- counts.set(base, n);
93
- return n === 1 ? base : `${base}_${n}`;
103
+ export function getReadNames(features, reserved = []) {
104
+ const taken = new Set(reserved);
105
+ return features.map(f => {
106
+ const flags = f.get('flags');
107
+ const base = `${String(f.get('name')).replaceAll(/\s+/g, '_')}${mateSuffix(typeof flags === 'number' ? flags : undefined)}`;
108
+ let name = base;
109
+ for (let n = 2; taken.has(name); n++) {
110
+ name = `${base}_${n}`;
111
+ }
112
+ taken.add(name);
113
+ return name;
94
114
  });
95
115
  }
96
116
  //# sourceMappingURL=readLayout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"readLayout.js","sourceRoot":"","sources":["../../src/LaunchTView/readLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAOzC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAA;AAC9B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;AA6BzB,MAAM,UAAU,GAAG,eAAe,CAAA;AAElC,MAAM,CAAC,MAAM,OAAO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AAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;AAC5E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAC1B,QAA4B,EAC5B,WAAqB,EAAE;IAEvB,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAA;IAC/B,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACtB,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAC5B,MAAM,IAAI,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,UAAU,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAA;QAC3H,IAAI,IAAI,GAAG,IAAI,CAAA;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,IAAI,GAAG,GAAG,IAAI,IAAI,CAAC,EAAE,CAAA;QACvB,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACf,OAAO,IAAI,CAAA;IACb,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -43,7 +43,7 @@ export interface ArrayStats {
43
43
  width: number;
44
44
  /** the reference's own copy count, when the reference was a row */
45
45
  referenceCopies?: number;
46
- /** whether the rows were ordered and labelled by this array */
46
+ /** whether the rows were ordered by this array */
47
47
  subject: boolean;
48
48
  samples: SampleArrayStats[];
49
49
  }
@@ -8,7 +8,6 @@
8
8
  * back counts, which is what makes it testable without the network.
9
9
  */
10
10
  import { ABSENT, SPANNED_GAP } from './readLayout';
11
- import { newickSafe } from './sampleTree';
12
11
  import { renderRow } from './tview';
13
12
  /**
14
13
  * Least support an allele needs before it is reported as one of a sample's,
@@ -92,25 +91,11 @@ export function alleleModes(copies) {
92
91
  }
93
92
  return peaks.filter(p => p.reads >= floor).sort((a, b) => a.value - b.value);
94
93
  }
95
- function sampleOfRow(name) {
96
- const i = name.indexOf('|');
97
- return i < 0 ? undefined : name.slice(0, i);
98
- }
99
- /**
100
- * Rows are prefixed with the Newick-safe form of their sample's name, so a
101
- * caller naming the samples it wants reported has to be met there rather than
102
- * taken at its word. A track called `HG004 (mother)` otherwise matched no row
103
- * and came back with nought spanning reads and no alleles — which is what a
104
- * locus nobody sequenced looks like, not what a misspelt name should.
105
- *
106
- * The name the caller gave is what gets reported back; only the matching is
107
- * sanitized.
108
- */
109
- function rowsOfSample(copiesByName, sample) {
110
- const key = newickSafe(sample);
111
- return [...copiesByName]
112
- .filter(([name]) => sampleOfRow(name) === key)
113
- .map(([, n]) => n);
94
+ function rowsOfSample(array, plan, sample) {
95
+ return plan.reads
96
+ .filter(read => read.sample === sample)
97
+ .map(read => array.copiesByName.get(read.name))
98
+ .filter(copies => copies !== undefined);
114
99
  }
115
100
  function arrayStats(array, plan, samples) {
116
101
  return {
@@ -125,7 +110,7 @@ function arrayStats(array, plan, samples) {
125
110
  : undefined,
126
111
  subject: array === plan.subject,
127
112
  samples: samples.map(sample => {
128
- const copies = rowsOfSample(array.copiesByName, sample);
113
+ const copies = rowsOfSample(array, plan, sample);
129
114
  const modes = alleleModes(copies);
130
115
  return {
131
116
  sample,
@@ -1 +1 @@
1
- {"version":3,"file":"repeatStats.js","sourceRoot":"","sources":["../../src/LaunchTView/repeatStats.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO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AI,KAAK,KAAK,CAAC,EAAE,CAAC;YACvB,gBAAgB,EAAE,CAAA;QACpB,CAAC;IACH,CAAC;IACD,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;QACvB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;QACjC,gBAAgB;QAChB,YAAY;QACZ,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAC9B,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,CACjD;KACF,CAAA;AACH,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { ArrayBlock } from './alleles';
2
2
  import type { AlignmentFeature, ReadLayout } from './readLayout';
3
+ import type { Highlight, RowDataInput } from 'react-msaview';
3
4
  export type { AlignmentFeature, ReadLayout } from './readLayout';
4
5
  export { clipInsertions, parseCigar, parseRead } from './readLayout';
5
6
  /**
@@ -12,10 +13,10 @@ export { clipInsertions, parseCigar, parseRead } from './readLayout';
12
13
  export declare function alignInsertionColumns(reads: ReadLayout[], ownedByArray: Set<number>): {
13
14
  insertions: Map<number, string>;
14
15
  name: string;
15
- label?: string;
16
16
  sample?: string;
17
17
  start: number;
18
18
  refChars: string;
19
+ query?: import("./readLayout").ReadQuery;
19
20
  }[];
20
21
  /** widest insertion any read has at each reference position (sparse) */
21
22
  export declare function maxInsertionWidths(reads: ReadLayout[], ownedByArray: Set<number>): Map<number, number>;
@@ -50,6 +51,15 @@ export interface ColumnLayout {
50
51
  * contributes one run of columns for the whole interval it covers.
51
52
  */
52
53
  export declare function buildColumnLayout(start: number, end: number, insWidths: Map<number, number>, arrays?: ArrayBlock[]): ColumnLayout;
54
+ /**
55
+ * The reference positions a row is walked over, from inclusive to exclusive. A
56
+ * trailing insertion is keyed one past the last position the read spans, so
57
+ * that slot is in it.
58
+ */
59
+ export declare function rowSpan(read: ReadLayout, layout: ColumnLayout): {
60
+ from: number;
61
+ to: number;
62
+ };
53
63
  /**
54
64
  * Lays a single row out across the whole region. Rows are typically a tiny
55
65
  * fraction of the region, so the columns on either side are filled in one shot
@@ -60,29 +70,17 @@ export declare function buildColumnLayout(start: number, end: number, insWidths:
60
70
  */
61
71
  export declare function renderRow(read: ReadLayout, layout: ColumnLayout): string;
62
72
  /**
63
- * What a row is called on screen. The one place `label` falls back to `name`,
64
- * so the defline and the tree leaf cannot disagree about it — react-msaview
65
- * joins them by string, and a row the tree names differently renders blank.
66
- */
67
- export declare function rowLabel(read: ReadLayout): string;
68
- /**
69
- * Rows ordered longest-allele-first and labelled with their copy count.
70
- *
71
- * Copy number is the measurement at a tandem array, and reading it off where a
72
- * row runs out is the thing the unit-per-block layout exists to avoid, so it is
73
- * stated in the label. Ordering by it puts the alleles in a ladder, which is
74
- * what makes one row's array comparable to the next at a glance. Rows that do
75
- * not span the array keep genomic order, below the ones that do; the reference
76
- * stays on top whatever its allele, since it is what the columns are named
77
- * after rather than one of the observations.
73
+ * The reference row's name, and the sample its row table entry gives it. Not
74
+ * the sequence's own name: react-msaview prints a row's residues as
75
+ * `<row>:<index>`, and `chr4:25` would read as a genome coordinate when it is an
76
+ * index into the window.
78
77
  */
79
- export declare function labelAndOrderByCopies(reads: ReadLayout[], array: ArrayBlock, referenceName?: string): ReadLayout[];
78
+ export declare const REFERENCE = "reference";
80
79
  export interface TviewPlan {
81
80
  reads: ReadLayout[];
81
+ /** the row each feature became, parallel to the features planned */
82
+ featureNames: string[];
82
83
  layout: ColumnLayout;
83
- insertionWidths: [number, number][];
84
- /** [start, end, width] per array block, to rebuild the column mapping */
85
- arraySpans: [number, number, number][];
86
84
  region: {
87
85
  refName: string;
88
86
  start: number;
@@ -92,7 +90,7 @@ export interface TviewPlan {
92
90
  cellCount: number;
93
91
  /** tandem arrays the reference carries here, left to right */
94
92
  arrays: ArrayBlock[];
95
- /** the array the rows are ordered and labelled by, when there is one */
93
+ /** the array the rows are ordered by, when there is one */
96
94
  subject?: ArrayBlock;
97
95
  /** name of the reference row, when the reference sequence was available */
98
96
  referenceName?: string;
@@ -115,11 +113,24 @@ export interface PlanArgs {
115
113
  * proportional to rows x columns and can be far larger.
116
114
  */
117
115
  export declare function planTviewMsa({ features, refName, start, end, sequence, sampleOf, }: PlanArgs): TviewPlan;
118
- export declare function renderTviewMsa({ reads, layout }: TviewPlan): string;
116
+ export declare function renderRows({ reads, layout }: TviewPlan): string[];
117
+ export declare function toFasta({ reads }: TviewPlan, rows: string[]): string;
118
+ export declare function renderTviewMsa(plan: TviewPlan): string;
119
+ /**
120
+ * What each row is, keyed by its name: the sample it came from and, where there
121
+ * is a subject array, the copies it carries there and their length in bp.
122
+ */
123
+ export declare function planRowData({ reads, subject }: TviewPlan): RowDataInput;
124
+ /**
125
+ * A bracket over the runs of columns that are not one reference base: the
126
+ * insertion sites, and each array block. Columns are the file's, 1-based.
127
+ */
128
+ export declare function planHighlights({ reads, layout, region, referenceName, }: TviewPlan): Highlight[];
119
129
  export declare function buildTviewMsa(args: PlanArgs): {
120
130
  msa: string;
131
+ rowData: RowDataInput;
132
+ highlights: Highlight[];
121
133
  insertionWidths: [number, number][];
122
- arraySpans: [number, number, number][];
123
134
  region: {
124
135
  refName: string;
125
136
  start: number;