@jbrowse/plugin-sequence 3.6.5 → 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 (95) 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 +25 -70
  9. package/esm/DivSequenceRenderer/components/Sequence.d.ts +10 -0
  10. package/esm/DivSequenceRenderer/components/Sequence.js +32 -0
  11. package/esm/DivSequenceRenderer/components/Translation.d.ts +14 -0
  12. package/esm/DivSequenceRenderer/components/Translation.js +54 -0
  13. package/esm/DivSequenceRenderer/configSchema.d.ts +2 -2
  14. package/esm/DivSequenceRenderer/index.js +6 -12
  15. package/esm/IndexedFastaAdapter/IndexedFastaAdapter.js +15 -23
  16. package/esm/IndexedFastaAdapter/configSchema.d.ts +2 -2
  17. package/esm/IndexedFastaAdapter/index.js +2 -2
  18. package/esm/LinearReferenceSequenceDisplay/configSchema.d.ts +4 -4
  19. package/esm/LinearReferenceSequenceDisplay/configSchema.js +1 -1
  20. package/esm/LinearReferenceSequenceDisplay/index.js +2 -2
  21. package/esm/LinearReferenceSequenceDisplay/model.d.ts +1049 -91
  22. package/esm/LinearReferenceSequenceDisplay/model.js +16 -4
  23. package/esm/ReferenceSequenceTrack/configSchema.d.ts +6 -6
  24. package/esm/ReferenceSequenceTrack/configSchema.js +3 -3
  25. package/esm/ReferenceSequenceTrack/index.js +13 -2
  26. package/esm/SequenceSearchAdapter/SequenceSearchAdapter.d.ts +2 -2
  27. package/esm/SequenceSearchAdapter/SequenceSearchAdapter.js +3 -9
  28. package/esm/SequenceSearchAdapter/configSchema.d.ts +2 -2
  29. package/esm/SequenceSearchAdapter/index.js +2 -2
  30. package/esm/TwoBitAdapter/TwoBitAdapter.js +1 -0
  31. package/esm/TwoBitAdapter/configSchema.d.ts +2 -2
  32. package/esm/TwoBitAdapter/index.js +2 -2
  33. package/esm/UnindexedFastaAdapter/UnindexedFastaAdapter.js +1 -0
  34. package/esm/UnindexedFastaAdapter/configSchema.d.ts +2 -2
  35. package/esm/UnindexedFastaAdapter/index.js +2 -2
  36. package/esm/index.js +11 -14
  37. package/esm/saveTrackFormats/fasta.d.ts +4 -0
  38. package/esm/saveTrackFormats/fasta.js +13 -0
  39. package/package.json +28 -34
  40. package/dist/BgzipFastaAdapter/BgzipFastaAdapter.d.ts +0 -7
  41. package/dist/BgzipFastaAdapter/BgzipFastaAdapter.js +0 -22
  42. package/dist/BgzipFastaAdapter/configSchema.d.ts +0 -32
  43. package/dist/BgzipFastaAdapter/configSchema.js +0 -54
  44. package/dist/BgzipFastaAdapter/index.d.ts +0 -2
  45. package/dist/BgzipFastaAdapter/index.js +0 -54
  46. package/dist/ChromSizesAdapter/ChromSizesAdapter.d.ts +0 -15
  47. package/dist/ChromSizesAdapter/ChromSizesAdapter.js +0 -40
  48. package/dist/ChromSizesAdapter/configSchema.d.ts +0 -10
  49. package/dist/ChromSizesAdapter/configSchema.js +0 -27
  50. package/dist/ChromSizesAdapter/index.d.ts +0 -2
  51. package/dist/ChromSizesAdapter/index.js +0 -52
  52. package/dist/DivSequenceRenderer/components/DivSequenceRendering.d.ts +0 -18
  53. package/dist/DivSequenceRenderer/components/DivSequenceRendering.js +0 -103
  54. package/dist/DivSequenceRenderer/configSchema.d.ts +0 -8
  55. package/dist/DivSequenceRenderer/configSchema.js +0 -12
  56. package/dist/DivSequenceRenderer/index.d.ts +0 -2
  57. package/dist/DivSequenceRenderer/index.js +0 -30
  58. package/dist/IndexedFastaAdapter/IndexedFastaAdapter.d.ts +0 -25
  59. package/dist/IndexedFastaAdapter/IndexedFastaAdapter.js +0 -112
  60. package/dist/IndexedFastaAdapter/configSchema.d.ts +0 -25
  61. package/dist/IndexedFastaAdapter/configSchema.js +0 -40
  62. package/dist/IndexedFastaAdapter/index.d.ts +0 -2
  63. package/dist/IndexedFastaAdapter/index.js +0 -54
  64. package/dist/LinearReferenceSequenceDisplay/configSchema.d.ts +0 -9
  65. package/dist/LinearReferenceSequenceDisplay/configSchema.js +0 -12
  66. package/dist/LinearReferenceSequenceDisplay/index.d.ts +0 -2
  67. package/dist/LinearReferenceSequenceDisplay/index.js +0 -21
  68. package/dist/LinearReferenceSequenceDisplay/model.d.ts +0 -323
  69. package/dist/LinearReferenceSequenceDisplay/model.js +0 -132
  70. package/dist/ReferenceSequenceTrack/configSchema.d.ts +0 -37
  71. package/dist/ReferenceSequenceTrack/configSchema.js +0 -83
  72. package/dist/ReferenceSequenceTrack/index.d.ts +0 -2
  73. package/dist/ReferenceSequenceTrack/index.js +0 -20
  74. package/dist/SequenceSearchAdapter/SequenceSearchAdapter.d.ts +0 -8
  75. package/dist/SequenceSearchAdapter/SequenceSearchAdapter.js +0 -84
  76. package/dist/SequenceSearchAdapter/configSchema.d.ts +0 -24
  77. package/dist/SequenceSearchAdapter/configSchema.js +0 -28
  78. package/dist/SequenceSearchAdapter/index.d.ts +0 -2
  79. package/dist/SequenceSearchAdapter/index.js +0 -54
  80. package/dist/TwoBitAdapter/TwoBitAdapter.d.ts +0 -28
  81. package/dist/TwoBitAdapter/TwoBitAdapter.js +0 -85
  82. package/dist/TwoBitAdapter/configSchema.d.ts +0 -18
  83. package/dist/TwoBitAdapter/configSchema.js +0 -43
  84. package/dist/TwoBitAdapter/index.d.ts +0 -2
  85. package/dist/TwoBitAdapter/index.js +0 -52
  86. package/dist/UnindexedFastaAdapter/UnindexedFastaAdapter.d.ts +0 -31
  87. package/dist/UnindexedFastaAdapter/UnindexedFastaAdapter.js +0 -86
  88. package/dist/UnindexedFastaAdapter/configSchema.d.ts +0 -23
  89. package/dist/UnindexedFastaAdapter/configSchema.js +0 -40
  90. package/dist/UnindexedFastaAdapter/index.d.ts +0 -2
  91. package/dist/UnindexedFastaAdapter/index.js +0 -54
  92. package/dist/createExtensionPoints.d.ts +0 -2
  93. package/dist/createExtensionPoints.js +0 -86
  94. package/dist/index.d.ts +0 -6
  95. package/dist/index.js +0 -35
@@ -1,9 +1,9 @@
1
1
  import { ConfigurationReference, getConf } from '@jbrowse/core/configuration';
2
2
  import { getContainingTrack, getContainingView } from '@jbrowse/core/util';
3
3
  import { getParentRenderProps } from '@jbrowse/core/util/tracks';
4
+ import { addDisposer, types } from '@jbrowse/mobx-state-tree';
4
5
  import { BaseLinearDisplay } from '@jbrowse/plugin-linear-genome-view';
5
6
  import { autorun } from 'mobx';
6
- import { addDisposer, types } from 'mobx-state-tree';
7
7
  export function modelFactory(configSchema) {
8
8
  return types
9
9
  .compose('LinearReferenceSequenceDisplay', BaseLinearDisplay, types.model({
@@ -81,7 +81,7 @@ export function modelFactory(configSchema) {
81
81
  self.showTranslation = !self.showTranslation;
82
82
  },
83
83
  afterAttach() {
84
- addDisposer(self, autorun(() => {
84
+ addDisposer(self, autorun(function sequenceHeightAutorun() {
85
85
  const view = getContainingView(self);
86
86
  if (view.bpPerPx > 3) {
87
87
  self.setHeight(50);
@@ -89,7 +89,7 @@ export function modelFactory(configSchema) {
89
89
  else {
90
90
  self.setHeight(self.sequenceHeight);
91
91
  }
92
- }));
92
+ }, { name: 'SequenceHeight' }));
93
93
  },
94
94
  }))
95
95
  .views(self => ({
@@ -125,5 +125,17 @@ export function modelFactory(configSchema) {
125
125
  : []),
126
126
  ];
127
127
  },
128
- }));
128
+ }))
129
+ .postProcessSnapshot(snap => {
130
+ if (!snap) {
131
+ return snap;
132
+ }
133
+ const { showForward, showReverse, showTranslation, ...rest } = snap;
134
+ return {
135
+ ...rest,
136
+ ...(!showForward ? { showForward } : {}),
137
+ ...(!showReverse ? { showReverse } : {}),
138
+ ...(!showTranslation ? { showTranslation } : {}),
139
+ };
140
+ });
129
141
  }
@@ -1,7 +1,7 @@
1
1
  import type PluginManager from '@jbrowse/core/PluginManager';
2
- export declare function createReferenceSeqTrackConfig(pluginManager: PluginManager): import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
3
- adapter: import("mobx-state-tree").IAnyModelType;
4
- displays: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
2
+ export declare function createReferenceSeqTrackConfig(pluginManager: PluginManager): import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
3
+ adapter: import("@jbrowse/mobx-state-tree").IAnyModelType;
4
+ displays: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IAnyModelType>;
5
5
  name: {
6
6
  type: string;
7
7
  description: string;
@@ -22,7 +22,7 @@ export declare function createReferenceSeqTrackConfig(pluginManager: PluginManag
22
22
  description: string;
23
23
  defaultValue: {};
24
24
  };
25
- formatAbout: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
25
+ formatAbout: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
26
26
  config: {
27
27
  type: string;
28
28
  description: string;
@@ -33,5 +33,5 @@ export declare function createReferenceSeqTrackConfig(pluginManager: PluginManag
33
33
  type: string;
34
34
  defaultValue: boolean;
35
35
  };
36
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
37
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "trackId">>;
36
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
37
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "trackId">>;
@@ -1,5 +1,5 @@
1
1
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
2
- import { types } from 'mobx-state-tree';
2
+ import { types } from '@jbrowse/mobx-state-tree';
3
3
  function x() { }
4
4
  export function createReferenceSeqTrackConfig(pluginManager) {
5
5
  return ConfigurationSchema('ReferenceSequenceTrack', {
@@ -49,7 +49,7 @@ export function createReferenceSeqTrackConfig(pluginManager) {
49
49
  }
50
50
  }
51
51
  const trackType = pluginManager.getTrackType(snap.type);
52
- for (const displayType of (trackType === null || trackType === void 0 ? void 0 : trackType.displayTypes) || []) {
52
+ for (const displayType of trackType?.displayTypes || []) {
53
53
  if (!displayTypes.has(displayType.name)) {
54
54
  displays.push({
55
55
  displayId: `${snap.trackId}-${displayType.name}`,
@@ -68,7 +68,7 @@ export function createReferenceSeqTrackConfig(pluginManager) {
68
68
  if (!type) {
69
69
  throw new Error(`unknown display type ${type}`);
70
70
  }
71
- const display = self.displays.find((d) => d && d.displayId === displayConf.displayId);
71
+ const display = self.displays.find((d) => d?.displayId === displayConf.displayId);
72
72
  if (display) {
73
73
  return display;
74
74
  }
@@ -1,6 +1,7 @@
1
1
  import TrackType from '@jbrowse/core/pluggableElementTypes/TrackType';
2
2
  import { createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models';
3
- import { createReferenceSeqTrackConfig } from './configSchema';
3
+ import { createReferenceSeqTrackConfig } from "./configSchema.js";
4
+ import { stringifyFASTA } from "../saveTrackFormats/fasta.js";
4
5
  export default function ReferenceSequenceTrackF(pluginManager) {
5
6
  pluginManager.addTrackType(() => {
6
7
  const configSchema = createReferenceSeqTrackConfig(pluginManager);
@@ -8,7 +9,17 @@ export default function ReferenceSequenceTrackF(pluginManager) {
8
9
  name: 'ReferenceSequenceTrack',
9
10
  displayName: 'Reference sequence track',
10
11
  configSchema,
11
- stateModel: createBaseTrackModel(pluginManager, 'ReferenceSequenceTrack', configSchema),
12
+ stateModel: createBaseTrackModel(pluginManager, 'ReferenceSequenceTrack', configSchema).views(() => ({
13
+ saveTrackFileFormatOptions() {
14
+ return {
15
+ fasta: {
16
+ name: 'FASTA',
17
+ extension: 'fa',
18
+ callback: stringifyFASTA,
19
+ },
20
+ };
21
+ },
22
+ })),
12
23
  });
13
24
  });
14
25
  }
@@ -1,8 +1,8 @@
1
1
  import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
2
+ import type { BaseOptions, BaseSequenceAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
3
3
  import type { Feature, Region } from '@jbrowse/core/util';
4
4
  export default class SequenceSearchAdapter extends BaseFeatureDataAdapter {
5
- configure(): Promise<BaseFeatureDataAdapter>;
5
+ configure(): Promise<BaseSequenceAdapter>;
6
6
  getRefNames(): Promise<string[]>;
7
7
  getFeatures(query: Region, opts: BaseOptions): import("rxjs").Observable<Feature>;
8
8
  }
@@ -1,12 +1,9 @@
1
1
  import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
2
2
  import { SimpleFeature, doesIntersect2, revcom } from '@jbrowse/core/util';
3
3
  import { ObservableCreate } from '@jbrowse/core/util/rxjs';
4
- import { firstValueFrom } from 'rxjs';
5
- import { toArray } from 'rxjs/operators';
6
4
  export default class SequenceSearchAdapter extends BaseFeatureDataAdapter {
7
5
  async configure() {
8
- var _a;
9
- const adapter = await ((_a = this.getSubAdapter) === null || _a === void 0 ? void 0 : _a.call(this, this.getConf('sequenceAdapter')));
6
+ const adapter = await this.getSubAdapter?.(this.getConf('sequenceAdapter'));
10
7
  if (!adapter) {
11
8
  throw new Error('Error getting subadapter');
12
9
  }
@@ -18,7 +15,6 @@ export default class SequenceSearchAdapter extends BaseFeatureDataAdapter {
18
15
  }
19
16
  getFeatures(query, opts) {
20
17
  return ObservableCreate(async (observer) => {
21
- var _a;
22
18
  const sequenceAdapter = await this.configure();
23
19
  const hw = 10000;
24
20
  const queryEnd = query.end + hw;
@@ -27,13 +23,11 @@ export default class SequenceSearchAdapter extends BaseFeatureDataAdapter {
27
23
  observer.complete();
28
24
  return;
29
25
  }
30
- const ret = sequenceAdapter.getFeatures({
26
+ const residues = (await sequenceAdapter.getSequence({
31
27
  ...query,
32
28
  start: queryStart,
33
29
  end: queryEnd,
34
- }, opts);
35
- const feats = await firstValueFrom(ret.pipe(toArray()));
36
- const residues = ((_a = feats[0]) === null || _a === void 0 ? void 0 : _a.get('seq')) || '';
30
+ }, opts)) ?? '';
37
31
  const search = this.getConf('search');
38
32
  const searchForward = this.getConf('searchForward');
39
33
  const searchReverse = this.getConf('searchReverse');
@@ -1,4 +1,4 @@
1
- declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ declare const configSchema: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  search: {
3
3
  type: string;
4
4
  defaultValue: string;
@@ -20,5 +20,5 @@ declare const configSchema: import("@jbrowse/core/configuration/configurationSch
20
20
  type: string;
21
21
  defaultValue: boolean;
22
22
  };
23
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
23
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
24
24
  export default configSchema;
@@ -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 SequenceSearchAdapterF(pluginManager) {
4
4
  pluginManager.addAdapterType(() => {
5
5
  return new AdapterType({
@@ -9,7 +9,7 @@ export default function SequenceSearchAdapterF(pluginManager) {
9
9
  hiddenFromGUI: true,
10
10
  },
11
11
  configSchema,
12
- getAdapterClass: () => import('./SequenceSearchAdapter').then(r => r.default),
12
+ getAdapterClass: () => import("./SequenceSearchAdapter.js").then(r => r.default),
13
13
  });
14
14
  });
15
15
  }
@@ -5,6 +5,7 @@ import { openLocation } from '@jbrowse/core/util/io';
5
5
  import { ObservableCreate } from '@jbrowse/core/util/rxjs';
6
6
  import SimpleFeature from '@jbrowse/core/util/simpleFeature';
7
7
  export default class TwoBitAdapter extends BaseSequenceAdapter {
8
+ setupP;
8
9
  async initChromSizes() {
9
10
  const conf = readConfObject(this.config, 'chromSizesLocation');
10
11
  if (conf.uri !== '/path/to/default.chrom.sizes' && conf.uri !== '') {
@@ -1,4 +1,4 @@
1
- declare const TwoBitAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ declare const TwoBitAdapter: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  twoBitLocation: {
3
3
  type: string;
4
4
  defaultValue: {
@@ -14,5 +14,5 @@ declare const TwoBitAdapter: import("@jbrowse/core/configuration/configurationSc
14
14
  };
15
15
  description: string;
16
16
  };
17
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
17
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
18
18
  export default TwoBitAdapter;
@@ -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 TwoBitAdapterF(pluginManager) {
4
4
  pluginManager.addAdapterType(() => new AdapterType({
5
5
  name: 'TwoBitAdapter',
@@ -8,6 +8,6 @@ export default function TwoBitAdapterF(pluginManager) {
8
8
  adapterMetadata: {
9
9
  hiddenFromGUI: true,
10
10
  },
11
- getAdapterClass: () => import('./TwoBitAdapter').then(r => r.default),
11
+ getAdapterClass: () => import("./TwoBitAdapter.js").then(r => r.default),
12
12
  }));
13
13
  }
@@ -21,6 +21,7 @@ function parseSmallFasta(text) {
21
21
  }));
22
22
  }
23
23
  export default class UnindexedFastaAdapter extends BaseSequenceAdapter {
24
+ setupP;
24
25
  async getRefNames(opts) {
25
26
  const { fasta } = await this.setup(opts);
26
27
  return [...fasta.keys()];
@@ -1,4 +1,4 @@
1
- declare const UnindexedFastaAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ declare const UnindexedFastaAdapter: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  rewriteRefNames: {
3
3
  type: string;
4
4
  defaultValue: string;
@@ -19,5 +19,5 @@ declare const UnindexedFastaAdapter: import("@jbrowse/core/configuration/configu
19
19
  locationType: string;
20
20
  };
21
21
  };
22
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
22
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
23
23
  export default UnindexedFastaAdapter;
@@ -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 UnindexedFastaAdapterF(pluginManager) {
4
4
  pluginManager.addAdapterType(() => {
5
5
  return new AdapterType({
@@ -9,7 +9,7 @@ export default function UnindexedFastaAdapterF(pluginManager) {
9
9
  adapterMetadata: {
10
10
  hiddenFromGUI: true,
11
11
  },
12
- getAdapterClass: () => import('./UnindexedFastaAdapter').then(r => r.default),
12
+ getAdapterClass: () => import("./UnindexedFastaAdapter.js").then(r => r.default),
13
13
  });
14
14
  });
15
15
  }
package/esm/index.js CHANGED
@@ -1,19 +1,16 @@
1
1
  import Plugin from '@jbrowse/core/Plugin';
2
- import BgzipFastaAdapterF from './BgzipFastaAdapter';
3
- import ChromSizesAdapterF from './ChromSizesAdapter';
4
- import DivSequenceRendererF from './DivSequenceRenderer';
5
- import IndexedFastaAdapterF from './IndexedFastaAdapter';
6
- import LinearReferenceSequenceDisplayF from './LinearReferenceSequenceDisplay';
7
- import ReferenceSequenceTrackF from './ReferenceSequenceTrack';
8
- import SequenceSearchAdapterF from './SequenceSearchAdapter';
9
- import TwoBitAdapterF from './TwoBitAdapter';
10
- import UnindexedFastaAdapterF from './UnindexedFastaAdapter';
11
- import createExtensionPoints from './createExtensionPoints';
2
+ import BgzipFastaAdapterF from "./BgzipFastaAdapter/index.js";
3
+ import ChromSizesAdapterF from "./ChromSizesAdapter/index.js";
4
+ import DivSequenceRendererF from "./DivSequenceRenderer/index.js";
5
+ import IndexedFastaAdapterF from "./IndexedFastaAdapter/index.js";
6
+ import LinearReferenceSequenceDisplayF from "./LinearReferenceSequenceDisplay/index.js";
7
+ import ReferenceSequenceTrackF from "./ReferenceSequenceTrack/index.js";
8
+ import SequenceSearchAdapterF from "./SequenceSearchAdapter/index.js";
9
+ import TwoBitAdapterF from "./TwoBitAdapter/index.js";
10
+ import UnindexedFastaAdapterF from "./UnindexedFastaAdapter/index.js";
11
+ import createExtensionPoints from "./createExtensionPoints.js";
12
12
  export default class SequencePlugin extends Plugin {
13
- constructor() {
14
- super(...arguments);
15
- this.name = 'SequencePlugin';
16
- }
13
+ name = 'SequencePlugin';
17
14
  install(pluginManager) {
18
15
  DivSequenceRendererF(pluginManager);
19
16
  TwoBitAdapterF(pluginManager);
@@ -0,0 +1,4 @@
1
+ import type { Feature } from '@jbrowse/core/util';
2
+ export declare function stringifyFASTA({ features }: {
3
+ features: Feature[];
4
+ }): string;
@@ -0,0 +1,13 @@
1
+ export function stringifyFASTA({ features }) {
2
+ return features
3
+ .map(feature => {
4
+ const refName = feature.get('refName');
5
+ const start = Math.floor(feature.get('start'));
6
+ const end = Math.floor(feature.get('end'));
7
+ const seq = feature.get('seq') ?? '';
8
+ const header = `>${refName}:${start + 1}-${end}`;
9
+ const wrappedSeq = seq.match(/.{1,80}/g)?.join('\n') ?? '';
10
+ return `${header}\n${wrappedSeq}`;
11
+ })
12
+ .join('\n');
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-sequence",
3
- "version": "3.6.5",
3
+ "version": "4.0.0",
4
4
  "description": "JBrowse 2 sequence adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -15,38 +15,21 @@
15
15
  "directory": "plugins/sequence"
16
16
  },
17
17
  "author": "JBrowse Team",
18
- "distMain": "dist/index.js",
19
- "srcMain": "src/index.ts",
20
- "main": "dist/index.js",
18
+ "main": "esm/index.js",
21
19
  "files": [
22
- "dist",
23
20
  "esm"
24
21
  ],
25
- "scripts": {
26
- "build": "npm-run-all build:*",
27
- "test": "cd ../..; jest --passWithNoTests plugins/sequence",
28
- "prepublishOnly": "yarn test",
29
- "prepack": "yarn build && yarn useDist",
30
- "postpack": "yarn useSrc",
31
- "useDist": "node ../../scripts/useDist.js",
32
- "useSrc": "node ../../scripts/useSrc.js",
33
- "prebuild": "npm run clean",
34
- "build:esm": "tsc --build tsconfig.build.esm.json",
35
- "build:commonjs": "tsc --build tsconfig.build.commonjs.json",
36
- "clean": "rimraf dist esm *.tsbuildinfo"
37
- },
38
22
  "dependencies": {
39
- "@gmod/abortable-promise-cache": "^3.0.1",
40
- "@gmod/indexedfasta": "^4.0.0",
41
- "@gmod/twobit": "^6.0.0",
42
- "@jbrowse/core": "^3.6.5",
43
- "@jbrowse/plugin-linear-genome-view": "^3.6.5",
44
- "@jbrowse/plugin-wiggle": "^3.6.5",
45
- "@mui/material": "^7.0.0",
46
- "mobx": "^6.0.0",
47
- "mobx-react": "^9.0.0",
48
- "mobx-state-tree": "^5.0.0",
49
- "rxjs": "^7.0.0"
23
+ "@gmod/abortable-promise-cache": "^3.0.4",
24
+ "@gmod/indexedfasta": "^5.0.0",
25
+ "@gmod/twobit": "^6.0.1",
26
+ "@jbrowse/mobx-state-tree": "^5.5.0",
27
+ "@mui/material": "^7.3.6",
28
+ "mobx": "^6.15.0",
29
+ "mobx-react": "^9.2.1",
30
+ "rxjs": "^7.8.2",
31
+ "@jbrowse/core": "^4.0.0",
32
+ "@jbrowse/plugin-linear-genome-view": "^4.0.0"
50
33
  },
51
34
  "peerDependencies": {
52
35
  "react": ">=18.0.0"
@@ -54,8 +37,19 @@
54
37
  "publishConfig": {
55
38
  "access": "public"
56
39
  },
57
- "distModule": "esm/index.js",
58
- "srcModule": "src/index.ts",
59
- "module": "esm/index.js",
60
- "gitHead": "354d0a87b757b4d84f824b47507662f6f3a1693f"
61
- }
40
+ "sideEffects": false,
41
+ "scripts": {
42
+ "build": "pnpm run /^build:/",
43
+ "test": "cd ../..; jest --passWithNoTests plugins/sequence",
44
+ "prebuild": "pnpm clean",
45
+ "build:esm": "tsc -p tsconfig.build.esm.json",
46
+ "clean": "rimraf esm *.tsbuildinfo"
47
+ },
48
+ "types": "esm/index.d.ts",
49
+ "exports": {
50
+ ".": {
51
+ "types": "./esm/index.d.ts",
52
+ "import": "./esm/index.js"
53
+ }
54
+ }
55
+ }
@@ -1,7 +0,0 @@
1
- import { BgzipIndexedFasta } from '@gmod/indexedfasta';
2
- import IndexedFasta from '../IndexedFastaAdapter/IndexedFastaAdapter';
3
- export default class BgzipFastaAdapter extends IndexedFasta {
4
- setupPre(): Promise<{
5
- fasta: BgzipIndexedFasta;
6
- }>;
7
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const indexedfasta_1 = require("@gmod/indexedfasta");
7
- const io_1 = require("@jbrowse/core/util/io");
8
- const IndexedFastaAdapter_1 = __importDefault(require("../IndexedFastaAdapter/IndexedFastaAdapter"));
9
- class BgzipFastaAdapter extends IndexedFastaAdapter_1.default {
10
- async setupPre() {
11
- const fastaLocation = this.getConf('fastaLocation');
12
- const faiLocation = this.getConf('faiLocation');
13
- const gziLocation = this.getConf('gziLocation');
14
- const fastaOpts = {
15
- fasta: (0, io_1.openLocation)(fastaLocation, this.pluginManager),
16
- fai: (0, io_1.openLocation)(faiLocation, this.pluginManager),
17
- gzi: (0, io_1.openLocation)(gziLocation, this.pluginManager),
18
- };
19
- return { fasta: new indexedfasta_1.BgzipIndexedFasta(fastaOpts) };
20
- }
21
- }
22
- exports.default = BgzipFastaAdapter;
@@ -1,32 +0,0 @@
1
- declare const BgzipFastaAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- fastaLocation: {
3
- type: string;
4
- defaultValue: {
5
- uri: string;
6
- locationType: string;
7
- };
8
- };
9
- faiLocation: {
10
- type: string;
11
- defaultValue: {
12
- uri: string;
13
- locationType: string;
14
- };
15
- };
16
- metadataLocation: {
17
- description: string;
18
- type: string;
19
- defaultValue: {
20
- uri: string;
21
- locationType: string;
22
- };
23
- };
24
- gziLocation: {
25
- type: string;
26
- defaultValue: {
27
- uri: string;
28
- locationType: string;
29
- };
30
- };
31
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
32
- export default BgzipFastaAdapter;
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const configuration_1 = require("@jbrowse/core/configuration");
4
- function x() { }
5
- const BgzipFastaAdapter = (0, configuration_1.ConfigurationSchema)('BgzipFastaAdapter', {
6
- fastaLocation: {
7
- type: 'fileLocation',
8
- defaultValue: { uri: '/path/to/seq.fa.gz', locationType: 'UriLocation' },
9
- },
10
- faiLocation: {
11
- type: 'fileLocation',
12
- defaultValue: {
13
- uri: '/path/to/seq.fa.gz.fai',
14
- locationType: 'UriLocation',
15
- },
16
- },
17
- metadataLocation: {
18
- description: 'Optional metadata file',
19
- type: 'fileLocation',
20
- defaultValue: {
21
- uri: '/path/to/fa.metadata.yaml',
22
- locationType: 'UriLocation',
23
- },
24
- },
25
- gziLocation: {
26
- type: 'fileLocation',
27
- defaultValue: {
28
- uri: '/path/to/seq.fa.gz.gzi',
29
- locationType: 'UriLocation',
30
- },
31
- },
32
- }, {
33
- explicitlyTyped: true,
34
- preProcessSnapshot: snap => {
35
- return snap.uri
36
- ? {
37
- ...snap,
38
- fastaLocation: {
39
- uri: snap.uri,
40
- baseUri: snap.baseUri,
41
- },
42
- faiLocation: {
43
- uri: `${snap.uri}.fai`,
44
- baseUri: snap.baseUri,
45
- },
46
- gziLocation: {
47
- uri: `${snap.uri}.gzi`,
48
- baseUri: snap.baseUri,
49
- },
50
- }
51
- : snap;
52
- },
53
- });
54
- exports.default = BgzipFastaAdapter;
@@ -1,2 +0,0 @@
1
- import type PluginManager from '@jbrowse/core/PluginManager';
2
- export default function BgzipFastaAdapterF(pluginManager: PluginManager): void;
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.default = BgzipFastaAdapterF;
40
- const AdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
41
- const configSchema_1 = __importDefault(require("./configSchema"));
42
- function BgzipFastaAdapterF(pluginManager) {
43
- pluginManager.addAdapterType(() => {
44
- return new AdapterType_1.default({
45
- name: 'BgzipFastaAdapter',
46
- displayName: 'Bgzip-indexed FASTA adapter',
47
- configSchema: configSchema_1.default,
48
- adapterMetadata: {
49
- hiddenFromGUI: true,
50
- },
51
- getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./BgzipFastaAdapter'))).then(r => r.default),
52
- });
53
- });
54
- }
@@ -1,15 +0,0 @@
1
- import { BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import type { RegionsAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
3
- export default class ChromSizesAdapter extends BaseAdapter implements RegionsAdapter {
4
- protected setupP?: Promise<Record<string, number>>;
5
- setupPre(): Promise<{
6
- [k: string]: number;
7
- }>;
8
- setup(): Promise<Record<string, number>>;
9
- getRegions(): Promise<{
10
- refName: string;
11
- start: number;
12
- end: number;
13
- }[]>;
14
- getHeader(): {};
15
- }