@jbrowse/plugin-sequence 3.7.0 → 4.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 (97) hide show
  1. package/esm/BgzipFastaAdapter/BgzipFastaAdapter.d.ts +1 -1
  2. package/esm/BgzipFastaAdapter/BgzipFastaAdapter.js +1 -1
  3. package/esm/BgzipFastaAdapter/configSchema.d.ts +2 -2
  4. package/esm/BgzipFastaAdapter/index.js +2 -2
  5. package/esm/ChromSizesAdapter/ChromSizesAdapter.js +1 -0
  6. package/esm/ChromSizesAdapter/configSchema.d.ts +2 -2
  7. package/esm/ChromSizesAdapter/index.js +2 -2
  8. package/esm/DivSequenceRenderer/components/DivSequenceRendering.js +24 -7
  9. package/esm/DivSequenceRenderer/components/Sequence.js +20 -10
  10. package/esm/DivSequenceRenderer/components/Translation.js +27 -19
  11. package/esm/DivSequenceRenderer/configSchema.d.ts +2 -2
  12. package/esm/DivSequenceRenderer/index.js +6 -12
  13. package/esm/IndexedFastaAdapter/IndexedFastaAdapter.js +15 -23
  14. package/esm/IndexedFastaAdapter/configSchema.d.ts +2 -2
  15. package/esm/IndexedFastaAdapter/index.js +2 -2
  16. package/esm/LinearReferenceSequenceDisplay/configSchema.d.ts +4 -4
  17. package/esm/LinearReferenceSequenceDisplay/configSchema.js +1 -1
  18. package/esm/LinearReferenceSequenceDisplay/index.js +2 -2
  19. package/esm/LinearReferenceSequenceDisplay/model.d.ts +1047 -104
  20. package/esm/LinearReferenceSequenceDisplay/model.js +16 -4
  21. package/esm/ReferenceSequenceTrack/configSchema.d.ts +6 -6
  22. package/esm/ReferenceSequenceTrack/configSchema.js +3 -3
  23. package/esm/ReferenceSequenceTrack/index.js +13 -2
  24. package/esm/SequenceSearchAdapter/SequenceSearchAdapter.d.ts +2 -2
  25. package/esm/SequenceSearchAdapter/SequenceSearchAdapter.js +3 -9
  26. package/esm/SequenceSearchAdapter/configSchema.d.ts +2 -2
  27. package/esm/SequenceSearchAdapter/index.js +2 -2
  28. package/esm/TwoBitAdapter/TwoBitAdapter.js +1 -0
  29. package/esm/TwoBitAdapter/configSchema.d.ts +2 -2
  30. package/esm/TwoBitAdapter/index.js +2 -2
  31. package/esm/UnindexedFastaAdapter/UnindexedFastaAdapter.js +1 -0
  32. package/esm/UnindexedFastaAdapter/configSchema.d.ts +2 -2
  33. package/esm/UnindexedFastaAdapter/index.js +2 -2
  34. package/esm/index.js +11 -14
  35. package/esm/saveTrackFormats/fasta.d.ts +4 -0
  36. package/esm/saveTrackFormats/fasta.js +13 -0
  37. package/package.json +28 -34
  38. package/dist/BgzipFastaAdapter/BgzipFastaAdapter.d.ts +0 -7
  39. package/dist/BgzipFastaAdapter/BgzipFastaAdapter.js +0 -22
  40. package/dist/BgzipFastaAdapter/configSchema.d.ts +0 -32
  41. package/dist/BgzipFastaAdapter/configSchema.js +0 -54
  42. package/dist/BgzipFastaAdapter/index.d.ts +0 -2
  43. package/dist/BgzipFastaAdapter/index.js +0 -54
  44. package/dist/ChromSizesAdapter/ChromSizesAdapter.d.ts +0 -15
  45. package/dist/ChromSizesAdapter/ChromSizesAdapter.js +0 -40
  46. package/dist/ChromSizesAdapter/configSchema.d.ts +0 -10
  47. package/dist/ChromSizesAdapter/configSchema.js +0 -27
  48. package/dist/ChromSizesAdapter/index.d.ts +0 -2
  49. package/dist/ChromSizesAdapter/index.js +0 -52
  50. package/dist/DivSequenceRenderer/components/DivSequenceRendering.d.ts +0 -18
  51. package/dist/DivSequenceRenderer/components/DivSequenceRendering.js +0 -44
  52. package/dist/DivSequenceRenderer/components/Sequence.d.ts +0 -10
  53. package/dist/DivSequenceRenderer/components/Sequence.js +0 -25
  54. package/dist/DivSequenceRenderer/components/Translation.d.ts +0 -14
  55. package/dist/DivSequenceRenderer/components/Translation.js +0 -49
  56. package/dist/DivSequenceRenderer/configSchema.d.ts +0 -8
  57. package/dist/DivSequenceRenderer/configSchema.js +0 -12
  58. package/dist/DivSequenceRenderer/index.d.ts +0 -2
  59. package/dist/DivSequenceRenderer/index.js +0 -30
  60. package/dist/IndexedFastaAdapter/IndexedFastaAdapter.d.ts +0 -25
  61. package/dist/IndexedFastaAdapter/IndexedFastaAdapter.js +0 -112
  62. package/dist/IndexedFastaAdapter/configSchema.d.ts +0 -25
  63. package/dist/IndexedFastaAdapter/configSchema.js +0 -40
  64. package/dist/IndexedFastaAdapter/index.d.ts +0 -2
  65. package/dist/IndexedFastaAdapter/index.js +0 -54
  66. package/dist/LinearReferenceSequenceDisplay/configSchema.d.ts +0 -9
  67. package/dist/LinearReferenceSequenceDisplay/configSchema.js +0 -12
  68. package/dist/LinearReferenceSequenceDisplay/index.d.ts +0 -2
  69. package/dist/LinearReferenceSequenceDisplay/index.js +0 -21
  70. package/dist/LinearReferenceSequenceDisplay/model.d.ts +0 -338
  71. package/dist/LinearReferenceSequenceDisplay/model.js +0 -132
  72. package/dist/ReferenceSequenceTrack/configSchema.d.ts +0 -37
  73. package/dist/ReferenceSequenceTrack/configSchema.js +0 -83
  74. package/dist/ReferenceSequenceTrack/index.d.ts +0 -2
  75. package/dist/ReferenceSequenceTrack/index.js +0 -20
  76. package/dist/SequenceSearchAdapter/SequenceSearchAdapter.d.ts +0 -8
  77. package/dist/SequenceSearchAdapter/SequenceSearchAdapter.js +0 -84
  78. package/dist/SequenceSearchAdapter/configSchema.d.ts +0 -24
  79. package/dist/SequenceSearchAdapter/configSchema.js +0 -28
  80. package/dist/SequenceSearchAdapter/index.d.ts +0 -2
  81. package/dist/SequenceSearchAdapter/index.js +0 -54
  82. package/dist/TwoBitAdapter/TwoBitAdapter.d.ts +0 -28
  83. package/dist/TwoBitAdapter/TwoBitAdapter.js +0 -85
  84. package/dist/TwoBitAdapter/configSchema.d.ts +0 -18
  85. package/dist/TwoBitAdapter/configSchema.js +0 -43
  86. package/dist/TwoBitAdapter/index.d.ts +0 -2
  87. package/dist/TwoBitAdapter/index.js +0 -52
  88. package/dist/UnindexedFastaAdapter/UnindexedFastaAdapter.d.ts +0 -31
  89. package/dist/UnindexedFastaAdapter/UnindexedFastaAdapter.js +0 -86
  90. package/dist/UnindexedFastaAdapter/configSchema.d.ts +0 -23
  91. package/dist/UnindexedFastaAdapter/configSchema.js +0 -40
  92. package/dist/UnindexedFastaAdapter/index.d.ts +0 -2
  93. package/dist/UnindexedFastaAdapter/index.js +0 -54
  94. package/dist/createExtensionPoints.d.ts +0 -2
  95. package/dist/createExtensionPoints.js +0 -86
  96. package/dist/index.d.ts +0 -6
  97. package/dist/index.js +0 -35
@@ -1,5 +1,5 @@
1
1
  import { BgzipIndexedFasta } from '@gmod/indexedfasta';
2
- import IndexedFasta from '../IndexedFastaAdapter/IndexedFastaAdapter';
2
+ import IndexedFasta from '../IndexedFastaAdapter/IndexedFastaAdapter.ts';
3
3
  export default class BgzipFastaAdapter extends IndexedFasta {
4
4
  setupPre(): Promise<{
5
5
  fasta: BgzipIndexedFasta;
@@ -1,6 +1,6 @@
1
1
  import { BgzipIndexedFasta } from '@gmod/indexedfasta';
2
2
  import { openLocation } from '@jbrowse/core/util/io';
3
- import IndexedFasta from '../IndexedFastaAdapter/IndexedFastaAdapter';
3
+ import IndexedFasta from "../IndexedFastaAdapter/IndexedFastaAdapter.js";
4
4
  export default class BgzipFastaAdapter extends IndexedFasta {
5
5
  async setupPre() {
6
6
  const fastaLocation = this.getConf('fastaLocation');
@@ -1,4 +1,4 @@
1
- declare const BgzipFastaAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ declare const BgzipFastaAdapter: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  fastaLocation: {
3
3
  type: string;
4
4
  defaultValue: {
@@ -28,5 +28,5 @@ declare const BgzipFastaAdapter: import("@jbrowse/core/configuration/configurati
28
28
  locationType: string;
29
29
  };
30
30
  };
31
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
31
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
32
32
  export default BgzipFastaAdapter;
@@ -1,5 +1,5 @@
1
1
  import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
2
- import configSchema from './configSchema';
2
+ import configSchema from "./configSchema.js";
3
3
  export default function BgzipFastaAdapterF(pluginManager) {
4
4
  pluginManager.addAdapterType(() => {
5
5
  return new AdapterType({
@@ -9,7 +9,7 @@ export default function BgzipFastaAdapterF(pluginManager) {
9
9
  adapterMetadata: {
10
10
  hiddenFromGUI: true,
11
11
  },
12
- getAdapterClass: () => import('./BgzipFastaAdapter').then(r => r.default),
12
+ getAdapterClass: () => import("./BgzipFastaAdapter.js").then(r => r.default),
13
13
  });
14
14
  });
15
15
  }
@@ -1,6 +1,7 @@
1
1
  import { BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
2
2
  import { openLocation } from '@jbrowse/core/util/io';
3
3
  export default class ChromSizesAdapter extends BaseAdapter {
4
+ setupP;
4
5
  async setupPre() {
5
6
  const pm = this.pluginManager;
6
7
  const file = openLocation(this.getConf('chromSizesLocation'), pm);
@@ -1,4 +1,4 @@
1
- declare const ChromSizesAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ declare const ChromSizesAdapter: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  chromSizesLocation: {
3
3
  type: string;
4
4
  defaultValue: {
@@ -6,5 +6,5 @@ declare const ChromSizesAdapter: import("@jbrowse/core/configuration/configurati
6
6
  locationType: string;
7
7
  };
8
8
  };
9
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
9
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
10
10
  export default ChromSizesAdapter;
@@ -1,5 +1,5 @@
1
1
  import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
2
- import configSchema from './configSchema';
2
+ import configSchema from "./configSchema.js";
3
3
  export default function ChromSizesAdapterF(pluginManager) {
4
4
  pluginManager.addAdapterType(() => new AdapterType({
5
5
  name: 'ChromSizesAdapter',
@@ -8,6 +8,6 @@ export default function ChromSizesAdapterF(pluginManager) {
8
8
  adapterMetadata: {
9
9
  hiddenFromGUI: true,
10
10
  },
11
- getAdapterClass: () => import('./ChromSizesAdapter').then(r => r.default),
11
+ getAdapterClass: () => import("./ChromSizesAdapter.js").then(r => r.default),
12
12
  }));
13
13
  }
@@ -1,9 +1,9 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { complement, defaultCodonTable, generateCodonTable, } from '@jbrowse/core/util';
3
3
  import { observer } from 'mobx-react';
4
- import Sequence from './Sequence';
5
- import Translation from './Translation';
6
- function SequenceSVG({ regions, width, colorByCDS, features = new Map(), showReverse = true, showForward = true, showTranslation = true, sequenceType = 'dna', bpPerPx, rowHeight, }) {
4
+ import Sequence from "./Sequence.js";
5
+ import Translation from "./Translation.js";
6
+ function SequenceSVG({ regions, width, colorByCDS, features, showReverse = true, showForward = true, showTranslation = true, sequenceType = 'dna', bpPerPx, rowHeight, }) {
7
7
  const region = regions[0];
8
8
  const codonTable = generateCodonTable(defaultCodonTable);
9
9
  const [feature] = [...features.values()];
@@ -14,14 +14,31 @@ function SequenceSVG({ regions, width, colorByCDS, features = new Map(), showRev
14
14
  if (!seq) {
15
15
  return null;
16
16
  }
17
- let currY = -rowHeight;
18
17
  const showSequence = bpPerPx <= 1;
19
18
  const forwardFrames = showTranslation && showForward ? [3, 2, 1] : [];
20
19
  const reverseFrames = showTranslation && showReverse ? [-1, -2, -3] : [];
21
20
  const [topFrames, bottomFrames] = region.reversed
22
21
  ? [reverseFrames.toReversed(), forwardFrames.toReversed()]
23
22
  : [forwardFrames, reverseFrames];
24
- return (_jsxs(_Fragment, { children: [topFrames.map(index => (_jsx(Translation, { width: width, colorByCDS: colorByCDS, seq: seq, y: (currY += rowHeight), codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, seqStart: feature.get('start'), height: rowHeight, reverse: region.reversed }, `translation-${index}`))), showForward && showSequence ? (_jsx(Sequence, { height: rowHeight, sequenceType: sequenceType, y: (currY += rowHeight), feature: feature, region: region, seq: region.reversed ? complement(seq) : seq, bpPerPx: bpPerPx })) : null, showReverse && showSequence ? (_jsx(Sequence, { height: rowHeight, sequenceType: sequenceType, y: (currY += rowHeight), feature: feature, region: region, seq: region.reversed ? seq : complement(seq), bpPerPx: bpPerPx })) : null, bottomFrames.map(index => (_jsx(Translation, { width: width, colorByCDS: colorByCDS, seq: seq, y: (currY += rowHeight), codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, seqStart: feature.get('start'), height: rowHeight, reverse: !region.reversed }, `rev-translation-${index}`)))] }));
23
+ const elements = [];
24
+ let currentY = 0;
25
+ for (const index of topFrames) {
26
+ elements.push(_jsx(Translation, { width: width, colorByCDS: colorByCDS, seq: seq, y: currentY, codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, seqStart: feature.get('start'), height: rowHeight, reverse: region.reversed }, `translation-${index}`));
27
+ currentY += rowHeight;
28
+ }
29
+ if (showForward && showSequence) {
30
+ elements.push(_jsx(Sequence, { height: rowHeight, sequenceType: sequenceType, y: currentY, feature: feature, region: region, seq: region.reversed ? complement(seq) : seq, bpPerPx: bpPerPx }, "forward_seq"));
31
+ currentY += rowHeight;
32
+ }
33
+ if (showReverse && showSequence) {
34
+ elements.push(_jsx(Sequence, { height: rowHeight, sequenceType: sequenceType, y: currentY, feature: feature, region: region, seq: region.reversed ? seq : complement(seq), bpPerPx: bpPerPx }, "reverse_seq"));
35
+ currentY += rowHeight;
36
+ }
37
+ for (const index of bottomFrames) {
38
+ elements.push(_jsx(Translation, { width: width, colorByCDS: colorByCDS, seq: seq, y: currentY, codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, seqStart: feature.get('start'), height: rowHeight, reverse: !region.reversed }, `rev-translation-${index}`));
39
+ currentY += rowHeight;
40
+ }
41
+ return _jsx(_Fragment, { children: elements });
25
42
  }
26
43
  function Wrapper({ exportSVG, width, totalHeight, children, }) {
27
44
  return exportSVG ? (children) : (_jsx("svg", { "data-testid": "sequence_track", width: width, height: totalHeight, style: {
@@ -31,7 +48,7 @@ function Wrapper({ exportSVG, width, totalHeight, children, }) {
31
48
  userSelect: 'none',
32
49
  }, children: children }));
33
50
  }
34
- const DivSequenceRendering = observer(function ({ exportSVG, features, regions, colorByCDS, bpPerPx, rowHeight, sequenceHeight, showForward, showReverse, showTranslation, }) {
51
+ const DivSequenceRendering = observer(function DivSequenceRendering({ exportSVG, features, regions, colorByCDS, bpPerPx, rowHeight, sequenceHeight, showForward, showReverse, showTranslation, }) {
35
52
  const region = regions[0];
36
53
  const width = Math.ceil((region.end - region.start) / bpPerPx);
37
54
  return (_jsx(Wrapper, { exportSVG: exportSVG, totalHeight: sequenceHeight, width: width, children: _jsx(SequenceSVG, { width: width, showReverse: showReverse, showForward: showForward, showTranslation: showTranslation, colorByCDS: colorByCDS, bpPerPx: bpPerPx, rowHeight: rowHeight, features: features, regions: regions }) }));
@@ -1,5 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Fragment } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import { bpSpanPx } from '@jbrowse/core/util';
4
3
  import { useTheme } from '@mui/material';
5
4
  export default function Sequence({ bpPerPx, region, feature, sequenceType, height, seq, y, }) {
@@ -11,12 +10,23 @@ export default function Sequence({ bpPerPx, region, feature, sequenceType, heigh
11
10
  const reverse = region.reversed;
12
11
  const len = e - s;
13
12
  const w = Math.max((rightPx - leftPx) / len, 0.8);
14
- return (_jsx(_Fragment, { children: seq.split('').map((letter, index) => {
15
- const color = sequenceType === 'dna'
16
- ?
17
- theme.palette.bases[letter.toUpperCase()]
18
- : undefined;
19
- const x = reverse ? rightPx - (index + 1) * w : leftPx + index * w;
20
- return (_jsxs(Fragment, { children: [_jsx("rect", { x: x, y: y, width: w, height: height, fill: color ? color.main : '#aaa', stroke: render ? '#555' : 'none' }), render ? (_jsx("text", { x: x + w / 2, y: y + height / 2, dominantBaseline: "middle", textAnchor: "middle", fontSize: height - 2, fill: color ? theme.palette.getContrastText(color.main) : 'black', children: letter })) : null] }, `${letter}-${index}`));
21
- }) }));
13
+ let svg = '';
14
+ for (let i = 0, l = seq.length; i < l; i++) {
15
+ const letter = seq[i];
16
+ const color = sequenceType === 'dna'
17
+ ?
18
+ theme.palette.bases[letter.toUpperCase()]
19
+ : undefined;
20
+ const x = reverse ? rightPx - (i + 1) * w : leftPx + i * w;
21
+ const fill = color ? color.main : '#aaa';
22
+ const stroke = render ? '#555' : 'none';
23
+ svg += `<rect x="${x}" y="${y}" width="${w}" height="${height}" fill="${fill}" stroke="${stroke}"/>`;
24
+ if (render) {
25
+ const textFill = color
26
+ ? theme.palette.getContrastText(color.main)
27
+ : 'black';
28
+ svg += `<text x="${x + w / 2}" y="${y + height / 2}" dominant-baseline="middle" text-anchor="middle" font-size="${height - 2}" fill="${textFill}">${letter}</text>`;
29
+ }
30
+ }
31
+ return _jsx("g", { dangerouslySetInnerHTML: { __html: svg } });
22
32
  }
@@ -1,9 +1,7 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Fragment } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import { defaultStarts, defaultStops, revcom } from '@jbrowse/core/util';
4
3
  import { useTheme } from '@mui/material';
5
4
  export default function Translation({ codonTable, seq, frame, width, bpPerPx, colorByCDS, region, seqStart, height, y, reverse = false, }) {
6
- var _a, _b;
7
5
  const theme = useTheme();
8
6
  const normalizedFrame = Math.abs(frame) - 1;
9
7
  const seqFrame = seqStart % 3;
@@ -27,20 +25,30 @@ export default function Translation({ codonTable, seq, frame, width, bpPerPx, co
27
25
  const startOffset = (region.start - seqStart) / bpPerPx;
28
26
  const offset = frameOffset - startOffset;
29
27
  const defaultFill = colorByCDS
30
- ? (_a = theme.palette.framesCDS.at(frame)) === null || _a === void 0 ? void 0 : _a.main
31
- : (_b = theme.palette.frames.at(frame)) === null || _b === void 0 ? void 0 : _b.main;
32
- return (_jsxs(_Fragment, { children: [_jsx("rect", { x: 0, y: y, width: width, height: height, fill: defaultFill }), translated.map((element, index) => {
33
- const x = region.reversed
34
- ? width - (index + 1) * codonWidth - offset
35
- : codonWidth * index + offset;
36
- const { letter, codon } = element;
37
- const codonFill = defaultStarts.includes(codon)
38
- ? theme.palette.startCodon
39
- : defaultStops.includes(codon)
40
- ? theme.palette.stopCodon
41
- : undefined;
42
- return !(renderLetter || codonFill) ? null : (_jsxs(Fragment, { children: [_jsx("rect", { x: x, y: y, width: renderLetter
43
- ? codonWidth
44
- : codonWidth + 0.7, height: height, stroke: renderLetter ? '#555' : 'none', fill: codonFill || 'none' }), renderLetter ? (_jsx("text", { x: x + codonWidth / 2, fontSize: height - 2, y: y + height / 2, dominantBaseline: "middle", textAnchor: "middle", children: letter })) : null] }, `${index}-${letter}`));
45
- })] }));
28
+ ? theme.palette.framesCDS.at(frame)?.main
29
+ : theme.palette.frames.at(frame)?.main;
30
+ let svg = `<rect x="0" y="${y}" width="${width}" height="${height}" fill="${defaultFill}"/>`;
31
+ for (let i = 0, l = translated.length; i < l; i++) {
32
+ const element = translated[i];
33
+ const x = region.reversed
34
+ ? width - (i + 1) * codonWidth - offset
35
+ : codonWidth * i + offset;
36
+ const { letter, codon } = element;
37
+ const codonFill = defaultStarts.includes(codon)
38
+ ? theme.palette.startCodon
39
+ : defaultStops.includes(codon)
40
+ ? theme.palette.stopCodon
41
+ : undefined;
42
+ if (renderLetter || codonFill) {
43
+ const rectWidth = renderLetter
44
+ ? codonWidth
45
+ : codonWidth + 0.7;
46
+ const stroke = renderLetter ? '#555' : 'none';
47
+ svg += `<rect x="${x}" y="${y}" width="${rectWidth}" height="${height}" stroke="${stroke}" fill="${codonFill || 'none'}"/>`;
48
+ if (renderLetter) {
49
+ svg += `<text x="${x + codonWidth / 2}" font-size="${height - 2}" y="${y + height / 2}" dominant-baseline="middle" text-anchor="middle">${letter}</text>`;
50
+ }
51
+ }
52
+ }
53
+ return _jsx("g", { dangerouslySetInnerHTML: { __html: svg } });
46
54
  }
@@ -1,8 +1,8 @@
1
- declare const DivSequenceRenderer: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ declare const DivSequenceRenderer: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  height: {
3
3
  type: string;
4
4
  description: string;
5
5
  defaultValue: number;
6
6
  };
7
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
7
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
8
8
  export default DivSequenceRenderer;
@@ -1,23 +1,17 @@
1
+ import { lazy } from 'react';
1
2
  import FeatureRendererType from '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType';
2
- import ReactComponent from './components/DivSequenceRendering';
3
- import configSchema from './configSchema';
3
+ import { expandRegion } from '@jbrowse/core/pluggableElementTypes/renderers/util';
4
+ import configSchema from "./configSchema.js";
4
5
  class DivSequenceRenderer extends FeatureRendererType {
5
- constructor() {
6
- super(...arguments);
7
- this.supportsSVG = true;
8
- }
6
+ supportsSVG = true;
9
7
  getExpandedRegion(region) {
10
- return {
11
- ...region,
12
- start: Math.max(region.start - 3, 0),
13
- end: region.end + 3,
14
- };
8
+ return expandRegion(region, 3);
15
9
  }
16
10
  }
17
11
  export default function DivSequenceRendererF(pluginManager) {
18
12
  pluginManager.addRendererType(() => new DivSequenceRenderer({
19
13
  name: 'DivSequenceRenderer',
20
- ReactComponent,
14
+ ReactComponent: lazy(() => import("./components/DivSequenceRendering.js")),
21
15
  configSchema,
22
16
  pluginManager,
23
17
  }));
@@ -7,16 +7,14 @@ import { openLocation } from '@jbrowse/core/util/io';
7
7
  import { ObservableCreate } from '@jbrowse/core/util/rxjs';
8
8
  import { checkStopToken } from '@jbrowse/core/util/stopToken';
9
9
  export default class IndexedFastaAdapter extends BaseSequenceAdapter {
10
- constructor() {
11
- super(...arguments);
12
- this.seqCache = new AbortablePromiseCache({
13
- cache: new QuickLRU({ maxSize: 200 }),
14
- fill: async (args) => {
15
- const { refName, start, end, fasta } = args;
16
- return fasta.getSequence(refName, start, end);
17
- },
18
- });
19
- }
10
+ setupP;
11
+ seqCache = new AbortablePromiseCache({
12
+ cache: new QuickLRU({ maxSize: 200 }),
13
+ fill: async (args) => {
14
+ const { refName, start, end, fasta } = args;
15
+ return fasta.getSequence(refName, start, end);
16
+ },
17
+ });
20
18
  async getRefNames(_opts) {
21
19
  const { fasta } = await this.setup();
22
20
  return fasta.getSequenceNames();
@@ -63,31 +61,25 @@ export default class IndexedFastaAdapter extends BaseSequenceAdapter {
63
61
  const { fasta } = await this.setup();
64
62
  const size = await fasta.getSequenceSize(refName);
65
63
  const regionEnd = Math.min(size || 0, end);
66
- const chunks = [];
67
64
  const chunkSize = 128000;
68
65
  const s = start - (start % chunkSize);
69
66
  const e = end + (chunkSize - (end % chunkSize));
67
+ const chunkPromises = [];
70
68
  for (let chunkStart = s; chunkStart < e; chunkStart += chunkSize) {
71
69
  const r = {
72
70
  refName,
73
71
  start: chunkStart,
74
72
  end: chunkStart + chunkSize,
75
73
  };
76
- checkStopToken(stopToken);
77
- const res = await this.seqCache.get(JSON.stringify(r), {
74
+ chunkPromises.push(this.seqCache.get(`${refName}-${chunkStart}-${r.end}`, {
78
75
  ...r,
79
76
  fasta,
80
- });
81
- if (!res) {
82
- break;
83
- }
84
- chunks.push(res);
77
+ }));
85
78
  }
86
- const seq = chunks
87
- .filter(f => !!f)
88
- .join('')
89
- .slice(start - s)
90
- .slice(0, end - start);
79
+ checkStopToken(stopToken);
80
+ const chunks = await Promise.all(chunkPromises);
81
+ const len = end - start;
82
+ const seq = chunks.join('').slice(start - s, start - s + len);
91
83
  if (seq) {
92
84
  observer.next(new SimpleFeature({
93
85
  id: `${refName}-${start}-${regionEnd}`,
@@ -1,4 +1,4 @@
1
- declare const IndexedFastaAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ declare const IndexedFastaAdapter: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  fastaLocation: {
3
3
  type: string;
4
4
  defaultValue: {
@@ -21,5 +21,5 @@ declare const IndexedFastaAdapter: import("@jbrowse/core/configuration/configura
21
21
  locationType: string;
22
22
  };
23
23
  };
24
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
24
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
25
25
  export default IndexedFastaAdapter;
@@ -1,5 +1,5 @@
1
1
  import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
2
- import configSchema from './configSchema';
2
+ import configSchema from "./configSchema.js";
3
3
  export default function IndexedFastaAdapterF(pluginManager) {
4
4
  pluginManager.addAdapterType(() => {
5
5
  return new AdapterType({
@@ -9,7 +9,7 @@ export default function IndexedFastaAdapterF(pluginManager) {
9
9
  adapterMetadata: {
10
10
  hiddenFromGUI: true,
11
11
  },
12
- getAdapterClass: () => import('./IndexedFastaAdapter').then(r => r.default),
12
+ getAdapterClass: () => import("./IndexedFastaAdapter.js").then(r => r.default),
13
13
  });
14
14
  });
15
15
  }
@@ -1,9 +1,9 @@
1
- export declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- renderer: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ export declare const configSchema: import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaType<{
2
+ renderer: import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaType<{
3
3
  height: {
4
4
  type: string;
5
5
  description: string;
6
6
  defaultValue: number;
7
7
  };
8
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
9
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
8
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaOptions<undefined, undefined>>;
9
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaOptions<undefined, "displayId">>;
@@ -1,5 +1,5 @@
1
1
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
2
- import divSequenceRendererConfigSchema from '../DivSequenceRenderer/configSchema';
2
+ import divSequenceRendererConfigSchema from "../DivSequenceRenderer/configSchema.js";
3
3
  function x() { }
4
4
  export const configSchema = ConfigurationSchema('LinearReferenceSequenceDisplay', {
5
5
  renderer: divSequenceRendererConfigSchema,
@@ -1,7 +1,7 @@
1
1
  import { DisplayType } from '@jbrowse/core/pluggableElementTypes';
2
2
  import { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view';
3
- import { configSchema } from './configSchema';
4
- import { modelFactory } from './model';
3
+ import { configSchema } from "./configSchema.js";
4
+ import { modelFactory } from "./model.js";
5
5
  export default function LinearReferenceSequenceDisplayF(pluginManager) {
6
6
  pluginManager.addDisplayType(() => {
7
7
  const stateModel = modelFactory(configSchema);