@jbrowse/plugin-comparative-adapters 2.18.0 → 3.0.1

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 (55) hide show
  1. package/dist/BlastTabularAdapter/index.js +18 -8
  2. package/dist/ChainAdapter/index.js +18 -8
  3. package/dist/ChainAdapter/util.d.ts +1 -2
  4. package/dist/ChainAdapter/util.js +1 -1
  5. package/dist/ComparativeAddTrackComponent/ComparativeAddTrackComponent.d.ts +2 -0
  6. package/dist/ComparativeAddTrackComponent/ComparativeAddTrackComponent.js +31 -0
  7. package/dist/ComparativeAddTrackComponent/index.d.ts +2 -0
  8. package/dist/ComparativeAddTrackComponent/index.js +46 -0
  9. package/dist/DeltaAdapter/index.js +18 -8
  10. package/dist/DeltaAdapter/util.d.ts +1 -2
  11. package/dist/DeltaAdapter/util.js +1 -1
  12. package/dist/GuessAdapter/index.d.ts +2 -0
  13. package/dist/GuessAdapter/index.js +74 -0
  14. package/dist/MCScanAddTrackComponent/MCScanAddTrackComponent.d.ts +2 -0
  15. package/dist/MCScanAddTrackComponent/MCScanAddTrackComponent.js +39 -0
  16. package/dist/MCScanAddTrackComponent/index.d.ts +2 -0
  17. package/dist/MCScanAddTrackComponent/index.js +46 -0
  18. package/dist/MCScanAnchorsAdapter/index.js +18 -8
  19. package/dist/MCScanSimpleAnchorsAdapter/index.js +18 -8
  20. package/dist/MashMapAdapter/index.js +18 -8
  21. package/dist/PAFAdapter/index.js +18 -8
  22. package/dist/PairwiseIndexedPAFAdapter/index.js +18 -8
  23. package/dist/index.js +6 -20
  24. package/dist/syntenyTypes.d.ts +3 -0
  25. package/dist/syntenyTypes.js +25 -0
  26. package/dist/util.d.ts +2 -3
  27. package/dist/util.js +2 -4
  28. package/esm/BlastTabularAdapter/index.js +1 -1
  29. package/esm/ChainAdapter/index.js +1 -1
  30. package/esm/ChainAdapter/util.d.ts +1 -2
  31. package/esm/ChainAdapter/util.js +1 -1
  32. package/esm/ComparativeAddTrackComponent/ComparativeAddTrackComponent.d.ts +2 -0
  33. package/esm/ComparativeAddTrackComponent/ComparativeAddTrackComponent.js +29 -0
  34. package/esm/ComparativeAddTrackComponent/index.d.ts +2 -0
  35. package/esm/ComparativeAddTrackComponent/index.js +10 -0
  36. package/esm/DeltaAdapter/index.js +1 -1
  37. package/esm/DeltaAdapter/util.d.ts +1 -2
  38. package/esm/DeltaAdapter/util.js +1 -1
  39. package/esm/GuessAdapter/index.d.ts +2 -0
  40. package/esm/GuessAdapter/index.js +71 -0
  41. package/esm/MCScanAddTrackComponent/MCScanAddTrackComponent.d.ts +2 -0
  42. package/esm/MCScanAddTrackComponent/MCScanAddTrackComponent.js +37 -0
  43. package/esm/MCScanAddTrackComponent/index.d.ts +2 -0
  44. package/esm/MCScanAddTrackComponent/index.js +10 -0
  45. package/esm/MCScanAnchorsAdapter/index.js +1 -1
  46. package/esm/MCScanSimpleAnchorsAdapter/index.js +1 -1
  47. package/esm/MashMapAdapter/index.js +1 -1
  48. package/esm/PAFAdapter/index.js +1 -1
  49. package/esm/PairwiseIndexedPAFAdapter/index.js +1 -1
  50. package/esm/index.js +6 -20
  51. package/esm/syntenyTypes.d.ts +3 -0
  52. package/esm/syntenyTypes.js +22 -0
  53. package/esm/util.d.ts +2 -3
  54. package/esm/util.js +3 -5
  55. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -4,10 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Plugin_1 = __importDefault(require("@jbrowse/core/Plugin"));
7
- const tracks_1 = require("@jbrowse/core/util/tracks");
8
7
  const BlastTabularAdapter_1 = __importDefault(require("./BlastTabularAdapter"));
9
8
  const ChainAdapter_1 = __importDefault(require("./ChainAdapter"));
9
+ const ComparativeAddTrackComponent_1 = __importDefault(require("./ComparativeAddTrackComponent"));
10
10
  const DeltaAdapter_1 = __importDefault(require("./DeltaAdapter"));
11
+ const GuessAdapter_1 = __importDefault(require("./GuessAdapter"));
12
+ const MCScanAddTrackComponent_1 = __importDefault(require("./MCScanAddTrackComponent"));
11
13
  const MCScanAnchorsAdapter_1 = __importDefault(require("./MCScanAnchorsAdapter"));
12
14
  const MCScanSimpleAnchorsAdapter_1 = __importDefault(require("./MCScanSimpleAnchorsAdapter"));
13
15
  const MashMapAdapter_1 = __importDefault(require("./MashMapAdapter"));
@@ -27,25 +29,9 @@ class ComparativeAdaptersPlugin extends Plugin_1.default {
27
29
  (0, MCScanSimpleAnchorsAdapter_1.default)(pluginManager);
28
30
  (0, MashMapAdapter_1.default)(pluginManager);
29
31
  (0, BlastTabularAdapter_1.default)(pluginManager);
30
- pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
31
- return (file, index, adapterHint) => {
32
- const regexGuess = /\.paf/i;
33
- const adapterName = 'PAFAdapter';
34
- const fileName = (0, tracks_1.getFileName)(file);
35
- if (regexGuess.test(fileName) || adapterHint === adapterName) {
36
- return {
37
- type: adapterName,
38
- pafLocation: file,
39
- };
40
- }
41
- return adapterGuesser(file, index, adapterHint);
42
- };
43
- });
44
- pluginManager.addToExtensionPoint('Core-guessTrackTypeForLocation', (trackTypeGuesser) => {
45
- return (adapterName) => adapterName === 'PAFAdapter'
46
- ? 'SyntenyTrack'
47
- : trackTypeGuesser(adapterName);
48
- });
32
+ (0, ComparativeAddTrackComponent_1.default)(pluginManager);
33
+ (0, MCScanAddTrackComponent_1.default)(pluginManager);
34
+ (0, GuessAdapter_1.default)(pluginManager);
49
35
  }
50
36
  }
51
37
  exports.default = ComparativeAdaptersPlugin;
@@ -0,0 +1,3 @@
1
+ export declare const syntenyTypes: string[];
2
+ export declare const pairwiseTypes: string[];
3
+ export declare const mcscanTypes: string[];
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mcscanTypes = exports.pairwiseTypes = exports.syntenyTypes = void 0;
4
+ exports.syntenyTypes = [
5
+ 'PAFAdapter',
6
+ 'ChainAdapter',
7
+ 'DeltaAdapter',
8
+ 'BlastTabularAdapter',
9
+ 'MashMapAdapter',
10
+ 'MCScanAnchorsAdapter',
11
+ 'MCScanSimpleAnchorsAdapter',
12
+ 'PairwiseIndexedPAFAdapter',
13
+ ];
14
+ exports.pairwiseTypes = [
15
+ 'PAFAdapter',
16
+ 'ChainAdapter',
17
+ 'DeltaAdapter',
18
+ 'MashMapAdapter',
19
+ 'BlastTabularAdapter',
20
+ 'PairwiseIndexedPAFAdapter',
21
+ ];
22
+ exports.mcscanTypes = [
23
+ 'MCScanAnchorsAdapter',
24
+ 'MCScanSimpleAnchorsAdapter',
25
+ ];
package/dist/util.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import type { PAFRecord } from './PAFAdapter/util';
2
2
  import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
3
- import type { Buffer } from 'buffer';
4
- import type { GenericFilehandle } from 'generic-filehandle';
3
+ import type { GenericFilehandle } from 'generic-filehandle2';
5
4
  export declare function parseBed(text: string): Map<string | undefined, {
6
5
  refName: string | undefined;
7
6
  start: number;
@@ -12,7 +11,7 @@ export declare function parseBed(text: string): Map<string | undefined, {
12
11
  }>;
13
12
  export declare function readFile(file: GenericFilehandle, opts?: BaseOptions): Promise<string>;
14
13
  export declare function zip(a: number[], b: number[]): [number, number][];
15
- export declare function parseLineByLine<T>(buffer: Buffer, cb: (line: string) => T | undefined): T[];
14
+ export declare function parseLineByLine<T>(buffer: Uint8Array, cb: (line: string) => T | undefined): T[];
16
15
  export declare function parsePAFLine(line: string): PAFRecord;
17
16
  export declare function flipCigar(cigar: string[]): (string | undefined)[];
18
17
  export declare function swapIndelCigar(cigar: string): string;
package/dist/util.js CHANGED
@@ -28,9 +28,7 @@ function parseBed(text) {
28
28
  }));
29
29
  }
30
30
  async function readFile(file, opts) {
31
- const buf = await (0, util_1.fetchAndMaybeUnzip)(file, opts);
32
- const decoder = new TextDecoder('utf8');
33
- return decoder.decode(buf);
31
+ return (0, util_1.fetchAndMaybeUnzipText)(file, opts);
34
32
  }
35
33
  function zip(a, b) {
36
34
  return a.map((e, i) => [e, b[i]]);
@@ -40,7 +38,7 @@ function parseLineByLine(buffer, cb) {
40
38
  const entries = [];
41
39
  const decoder = new TextDecoder('utf8');
42
40
  while (blockStart < buffer.length) {
43
- const n = buffer.indexOf('\n', blockStart);
41
+ const n = buffer.indexOf(10, blockStart);
44
42
  if (n === -1) {
45
43
  break;
46
44
  }
@@ -6,7 +6,7 @@ export default function BlastTabularAdapterF(pluginManager) {
6
6
  displayName: 'Tabular BLAST output adapter',
7
7
  configSchema,
8
8
  adapterMetadata: {
9
- hiddenFromGUI: true,
9
+ category: 'Synteny adapters',
10
10
  },
11
11
  getAdapterClass: () => import('./BlastTabularAdapter').then(r => r.default),
12
12
  }));
@@ -6,7 +6,7 @@ export default function ChainAdapterF(pluginManager) {
6
6
  displayName: 'Liftover chain adapter',
7
7
  configSchema,
8
8
  adapterMetadata: {
9
- hiddenFromGUI: true,
9
+ category: 'Synteny adapters',
10
10
  },
11
11
  getAdapterClass: () => import('./ChainAdapter').then(r => r.default),
12
12
  }));
@@ -1,5 +1,4 @@
1
- import type { Buffer } from 'buffer';
2
- export declare function paf_chain2paf(buffer: Buffer): {
1
+ export declare function paf_chain2paf(buffer: Uint8Array): {
3
2
  qname: string;
4
3
  qstart: number;
5
4
  qend: number;
@@ -30,7 +30,7 @@ export function paf_chain2paf(buffer) {
30
30
  let blockStart = 0;
31
31
  const decoder = new TextDecoder('utf8');
32
32
  while (blockStart < buffer.length) {
33
- const n = buffer.indexOf('\n', blockStart);
33
+ const n = buffer.indexOf(10, blockStart);
34
34
  if (n === -1) {
35
35
  break;
36
36
  }
@@ -0,0 +1,2 @@
1
+ declare const ComparativeAddTrackComponent: ({ model }: any) => import("react/jsx-runtime").JSX.Element;
2
+ export default ComparativeAddTrackComponent;
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { AssemblySelector } from '@jbrowse/core/ui';
4
+ import { getSession } from '@jbrowse/core/util';
5
+ import { observer } from 'mobx-react';
6
+ const ComparativeAddTrackComponent = observer(function ({ model }) {
7
+ var _a, _b;
8
+ const session = getSession(model);
9
+ const [r0, setR0] = useState((_a = session.assemblies[0]) === null || _a === void 0 ? void 0 : _a.name);
10
+ const [r1, setR1] = useState((_b = session.assemblies[0]) === null || _b === void 0 ? void 0 : _b.name);
11
+ useEffect(() => {
12
+ model.setMixinData({
13
+ adapter: {
14
+ queryAssembly: r0,
15
+ targetAssembly: r1,
16
+ },
17
+ });
18
+ }, [model, r0, r1]);
19
+ return (_jsxs(_Fragment, { children: [_jsx(AssemblySelector, { session: session, label: "Query assembly", helperText: "", selected: r0, onChange: asm => {
20
+ setR0(asm);
21
+ }, TextFieldProps: {
22
+ fullWidth: true,
23
+ } }), _jsx(AssemblySelector, { session: session, label: "Target assembly", helperText: "", selected: r1, onChange: asm => {
24
+ setR1(asm);
25
+ }, TextFieldProps: {
26
+ fullWidth: true,
27
+ } })] }));
28
+ });
29
+ export default ComparativeAddTrackComponent;
@@ -0,0 +1,2 @@
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
+ export default function ComparativeAddTrackComponentF(pluginManager: PluginManager): void;
@@ -0,0 +1,10 @@
1
+ import { lazy } from 'react';
2
+ import { pairwiseTypes } from '../syntenyTypes';
3
+ const ComparativeAddTrackComponent = lazy(() => import('./ComparativeAddTrackComponent'));
4
+ export default function ComparativeAddTrackComponentF(pluginManager) {
5
+ pluginManager.addToExtensionPoint('Core-addTrackComponent', (comp, { model }) => {
6
+ return pairwiseTypes.includes(model.trackAdapterType)
7
+ ? ComparativeAddTrackComponent
8
+ : comp;
9
+ });
10
+ }
@@ -6,7 +6,7 @@ export default function DeltaAdapterF(pluginManager) {
6
6
  displayName: 'MUMmer delta adapter',
7
7
  configSchema,
8
8
  adapterMetadata: {
9
- hiddenFromGUI: true,
9
+ category: 'Synteny adapters',
10
10
  },
11
11
  getAdapterClass: () => import('./DeltaAdapter').then(r => r.default),
12
12
  }));
@@ -1,5 +1,4 @@
1
- import type { Buffer } from 'buffer';
2
- export declare function paf_delta2paf(buffer: Buffer): {
1
+ export declare function paf_delta2paf(buffer: Uint8Array): {
3
2
  qname: string;
4
3
  qstart: number;
5
4
  qend: number;
@@ -17,7 +17,7 @@ export function paf_delta2paf(buffer) {
17
17
  let i = 0;
18
18
  const decoder = new TextDecoder('utf8');
19
19
  while (blockStart < buffer.length) {
20
- const n = buffer.indexOf('\n', blockStart);
20
+ const n = buffer.indexOf(10, blockStart);
21
21
  if (n === -1) {
22
22
  break;
23
23
  }
@@ -0,0 +1,2 @@
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
+ export default function GuessAdapterF(pluginManager: PluginManager): void;
@@ -0,0 +1,71 @@
1
+ import { testAdapter } from '@jbrowse/core/util';
2
+ import { getFileName, makeIndex, makeIndexType, } from '@jbrowse/core/util/tracks';
3
+ import { syntenyTypes } from '../syntenyTypes';
4
+ export default function GuessAdapterF(pluginManager) {
5
+ pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
6
+ return (file, index, adapterHint) => {
7
+ const fileName = getFileName(file);
8
+ const indexName = index && getFileName(index);
9
+ if (testAdapter(fileName, /\.paf(.gz)?/i, adapterHint, 'PAFAdapter')) {
10
+ return {
11
+ type: 'PAFAdapter',
12
+ pafLocation: file,
13
+ };
14
+ }
15
+ else if (adapterHint === 'BlastTabularAdapter') {
16
+ return {
17
+ type: 'BlastTabularAdapter',
18
+ blastTableLocation: file,
19
+ };
20
+ }
21
+ else if (testAdapter(fileName, /\.anchors.simple(.gz)?/i, adapterHint, 'MCScanSimpleAnchorsAdapter')) {
22
+ return {
23
+ type: 'MCScanSimpleAnchorsAdapter',
24
+ mcscanSimpleAnchorsLocation: file,
25
+ };
26
+ }
27
+ else if (testAdapter(fileName, /\.anchors(.gz)?/i, adapterHint, 'MCScanAnchorsAdapter')) {
28
+ return {
29
+ type: 'MCScanAnchorsAdapter',
30
+ mcscanAnchorsLocation: file,
31
+ };
32
+ }
33
+ else if (testAdapter(fileName, /\.delta(.gz)?/i, adapterHint, 'DeltaAdapter')) {
34
+ return {
35
+ type: 'DeltaAdapter',
36
+ deltaLocation: file,
37
+ };
38
+ }
39
+ else if (testAdapter(fileName, /\.chain(.gz)?/i, adapterHint, 'ChainAdapter')) {
40
+ return {
41
+ type: 'ChainAdapter',
42
+ chainLocation: file,
43
+ };
44
+ }
45
+ else if (testAdapter(fileName, /\.out(.gz)?/i, adapterHint, 'MashMapAdapter')) {
46
+ return {
47
+ type: 'MashMapAdapter',
48
+ outLocation: file,
49
+ };
50
+ }
51
+ else if (testAdapter(fileName, /\.pif\.gz/i, adapterHint, 'PairwiseIndexedPAFAdapter')) {
52
+ return {
53
+ type: 'PairwiseIndexedPAFAdapter',
54
+ pifGzLocation: file,
55
+ index: {
56
+ location: index || makeIndex(file, '.tbi'),
57
+ indexType: makeIndexType(indexName, 'CSI', 'TBI'),
58
+ },
59
+ };
60
+ }
61
+ else {
62
+ return adapterGuesser(file, index, adapterHint);
63
+ }
64
+ };
65
+ });
66
+ pluginManager.addToExtensionPoint('Core-guessTrackTypeForLocation', (trackTypeGuesser) => {
67
+ return (adapterName) => syntenyTypes.includes(adapterName)
68
+ ? 'SyntenyTrack'
69
+ : trackTypeGuesser(adapterName);
70
+ });
71
+ }
@@ -0,0 +1,2 @@
1
+ declare const MCScanAddTrackComponent: ({ model }: any) => import("react/jsx-runtime").JSX.Element;
2
+ export default MCScanAddTrackComponent;
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { AssemblySelector, FileSelector } from '@jbrowse/core/ui';
4
+ import { getSession } from '@jbrowse/core/util';
5
+ import { Typography } from '@mui/material';
6
+ import { observer } from 'mobx-react';
7
+ const MCScanAddTrackComponent = observer(function ({ model }) {
8
+ var _a, _b;
9
+ const session = getSession(model);
10
+ const [r0, setR0] = useState((_a = session.assemblies[0]) === null || _a === void 0 ? void 0 : _a.name);
11
+ const [r1, setR1] = useState((_b = session.assemblies[0]) === null || _b === void 0 ? void 0 : _b.name);
12
+ const [bed1Location, setBed1Location] = useState();
13
+ const [bed2Location, setBed2Location] = useState();
14
+ useEffect(() => {
15
+ model.setMixinData({
16
+ adapter: {
17
+ assemblyNamees: [r0, r1],
18
+ bed1Location,
19
+ bed2Location,
20
+ },
21
+ });
22
+ }, [model, bed1Location, bed2Location, r0, r1]);
23
+ return (_jsxs("div", { style: { marginTop: 20 }, children: [_jsx(Typography, { children: "JBrowse requires the two BED files that specify the genomic locations of the genes in the .anchors files" }), _jsx(AssemblySelector, { session: session, label: "BED1 assembly", helperText: "", selected: r0, onChange: asm => {
24
+ setR0(asm);
25
+ }, TextFieldProps: {
26
+ fullWidth: true,
27
+ } }), _jsx(AssemblySelector, { session: session, label: "BED2 assembly", helperText: "", selected: r1, onChange: asm => {
28
+ setR1(asm);
29
+ }, TextFieldProps: {
30
+ fullWidth: true,
31
+ } }), _jsx(FileSelector, { name: "BED1", inline: true, description: "", location: bed1Location, setLocation: loc => {
32
+ setBed1Location(loc);
33
+ } }), _jsx(FileSelector, { name: "BED2", inline: true, description: "", location: bed2Location, setLocation: loc => {
34
+ setBed2Location(loc);
35
+ } })] }));
36
+ });
37
+ export default MCScanAddTrackComponent;
@@ -0,0 +1,2 @@
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
+ export default function MCScanAddTrackComponentF(pluginManager: PluginManager): void;
@@ -0,0 +1,10 @@
1
+ import { lazy } from 'react';
2
+ import { mcscanTypes } from '../syntenyTypes';
3
+ const MCScanAddTrackComponent = lazy(() => import('./MCScanAddTrackComponent'));
4
+ export default function MCScanAddTrackComponentF(pluginManager) {
5
+ pluginManager.addToExtensionPoint('Core-addTrackComponent', (comp, { model }) => {
6
+ return mcscanTypes.includes(model.trackAdapterType)
7
+ ? MCScanAddTrackComponent
8
+ : comp;
9
+ });
10
+ }
@@ -6,7 +6,7 @@ export default function MCScanAnchorsAdapterF(pluginManager) {
6
6
  displayName: 'MCScan anchors adapter',
7
7
  configSchema,
8
8
  adapterMetadata: {
9
- hiddenFromGUI: true,
9
+ category: 'Synteny adapters',
10
10
  },
11
11
  getAdapterClass: () => import('./MCScanAnchorsAdapter').then(r => r.default),
12
12
  }));
@@ -6,7 +6,7 @@ export default function MCScanSimpleAnchorsAdapterF(pluginManager) {
6
6
  displayName: 'MCScan anchors.simple adapter',
7
7
  configSchema,
8
8
  adapterMetadata: {
9
- hiddenFromGUI: true,
9
+ category: 'Synteny adapters',
10
10
  },
11
11
  getAdapterClass: () => import('./MCScanSimpleAnchorsAdapter').then(r => r.default),
12
12
  }));
@@ -6,7 +6,7 @@ export default function MashMapAdapterF(pluginManager) {
6
6
  displayName: 'MashMap adapter',
7
7
  configSchema,
8
8
  adapterMetadata: {
9
- hiddenFromGUI: true,
9
+ category: 'Synteny adapters',
10
10
  },
11
11
  getAdapterClass: () => import('./MashMapAdapter').then(r => r.default),
12
12
  }));
@@ -6,7 +6,7 @@ export default function PAFAdapterF(pluginManager) {
6
6
  displayName: 'PAF adapter',
7
7
  configSchema,
8
8
  adapterMetadata: {
9
- hiddenFromGUI: true,
9
+ category: 'Synteny adapters',
10
10
  },
11
11
  getAdapterClass: () => import('./PAFAdapter').then(r => r.default),
12
12
  }));
@@ -6,7 +6,7 @@ export default function PairwiseIndexedPAFAdapterF(pluginManager) {
6
6
  displayName: 'Pairwise indexed PAF adapter',
7
7
  configSchema,
8
8
  adapterMetadata: {
9
- hiddenFromGUI: true,
9
+ category: 'Synteny adapters',
10
10
  },
11
11
  getAdapterClass: () => import('./PairwiseIndexedPAFAdapter').then(r => r.default),
12
12
  }));
package/esm/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import Plugin from '@jbrowse/core/Plugin';
2
- import { getFileName } from '@jbrowse/core/util/tracks';
3
2
  import BlastTabularAdapter from './BlastTabularAdapter';
4
3
  import ChainAdapterF from './ChainAdapter';
4
+ import ComparativeAddTrackComponentF from './ComparativeAddTrackComponent';
5
5
  import DeltaAdapterF from './DeltaAdapter';
6
+ import GuessAdapterF from './GuessAdapter';
7
+ import MCScanAddTrackComponentF from './MCScanAddTrackComponent';
6
8
  import MCScanAnchorsAdapterF from './MCScanAnchorsAdapter';
7
9
  import MCScanSimpleAnchorsAdapterF from './MCScanSimpleAnchorsAdapter';
8
10
  import MashMapAdapterF from './MashMapAdapter';
@@ -22,24 +24,8 @@ export default class ComparativeAdaptersPlugin extends Plugin {
22
24
  MCScanSimpleAnchorsAdapterF(pluginManager);
23
25
  MashMapAdapterF(pluginManager);
24
26
  BlastTabularAdapter(pluginManager);
25
- pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
26
- return (file, index, adapterHint) => {
27
- const regexGuess = /\.paf/i;
28
- const adapterName = 'PAFAdapter';
29
- const fileName = getFileName(file);
30
- if (regexGuess.test(fileName) || adapterHint === adapterName) {
31
- return {
32
- type: adapterName,
33
- pafLocation: file,
34
- };
35
- }
36
- return adapterGuesser(file, index, adapterHint);
37
- };
38
- });
39
- pluginManager.addToExtensionPoint('Core-guessTrackTypeForLocation', (trackTypeGuesser) => {
40
- return (adapterName) => adapterName === 'PAFAdapter'
41
- ? 'SyntenyTrack'
42
- : trackTypeGuesser(adapterName);
43
- });
27
+ ComparativeAddTrackComponentF(pluginManager);
28
+ MCScanAddTrackComponentF(pluginManager);
29
+ GuessAdapterF(pluginManager);
44
30
  }
45
31
  }
@@ -0,0 +1,3 @@
1
+ export declare const syntenyTypes: string[];
2
+ export declare const pairwiseTypes: string[];
3
+ export declare const mcscanTypes: string[];
@@ -0,0 +1,22 @@
1
+ export const syntenyTypes = [
2
+ 'PAFAdapter',
3
+ 'ChainAdapter',
4
+ 'DeltaAdapter',
5
+ 'BlastTabularAdapter',
6
+ 'MashMapAdapter',
7
+ 'MCScanAnchorsAdapter',
8
+ 'MCScanSimpleAnchorsAdapter',
9
+ 'PairwiseIndexedPAFAdapter',
10
+ ];
11
+ export const pairwiseTypes = [
12
+ 'PAFAdapter',
13
+ 'ChainAdapter',
14
+ 'DeltaAdapter',
15
+ 'MashMapAdapter',
16
+ 'BlastTabularAdapter',
17
+ 'PairwiseIndexedPAFAdapter',
18
+ ];
19
+ export const mcscanTypes = [
20
+ 'MCScanAnchorsAdapter',
21
+ 'MCScanSimpleAnchorsAdapter',
22
+ ];
package/esm/util.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import type { PAFRecord } from './PAFAdapter/util';
2
2
  import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
3
- import type { Buffer } from 'buffer';
4
- import type { GenericFilehandle } from 'generic-filehandle';
3
+ import type { GenericFilehandle } from 'generic-filehandle2';
5
4
  export declare function parseBed(text: string): Map<string | undefined, {
6
5
  refName: string | undefined;
7
6
  start: number;
@@ -12,7 +11,7 @@ export declare function parseBed(text: string): Map<string | undefined, {
12
11
  }>;
13
12
  export declare function readFile(file: GenericFilehandle, opts?: BaseOptions): Promise<string>;
14
13
  export declare function zip(a: number[], b: number[]): [number, number][];
15
- export declare function parseLineByLine<T>(buffer: Buffer, cb: (line: string) => T | undefined): T[];
14
+ export declare function parseLineByLine<T>(buffer: Uint8Array, cb: (line: string) => T | undefined): T[];
16
15
  export declare function parsePAFLine(line: string): PAFRecord;
17
16
  export declare function flipCigar(cigar: string[]): (string | undefined)[];
18
17
  export declare function swapIndelCigar(cigar: string): string;
package/esm/util.js CHANGED
@@ -1,4 +1,4 @@
1
- import { fetchAndMaybeUnzip } from '@jbrowse/core/util';
1
+ import { fetchAndMaybeUnzipText } from '@jbrowse/core/util';
2
2
  export function parseBed(text) {
3
3
  return new Map(text
4
4
  .split(/\n|\r\n|\r/)
@@ -19,9 +19,7 @@ export function parseBed(text) {
19
19
  }));
20
20
  }
21
21
  export async function readFile(file, opts) {
22
- const buf = await fetchAndMaybeUnzip(file, opts);
23
- const decoder = new TextDecoder('utf8');
24
- return decoder.decode(buf);
22
+ return fetchAndMaybeUnzipText(file, opts);
25
23
  }
26
24
  export function zip(a, b) {
27
25
  return a.map((e, i) => [e, b[i]]);
@@ -31,7 +29,7 @@ export function parseLineByLine(buffer, cb) {
31
29
  const entries = [];
32
30
  const decoder = new TextDecoder('utf8');
33
31
  while (blockStart < buffer.length) {
34
- const n = buffer.indexOf('\n', blockStart);
32
+ const n = buffer.indexOf(10, blockStart);
35
33
  if (n === -1) {
36
34
  break;
37
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-comparative-adapters",
3
- "version": "2.18.0",
3
+ "version": "3.0.1",
4
4
  "description": "JBrowse 2 comparative adapters",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -36,27 +36,27 @@
36
36
  "clean": "rimraf dist esm *.tsbuildinfo"
37
37
  },
38
38
  "dependencies": {
39
- "@gmod/bgzf-filehandle": "^1.4.3",
40
- "@gmod/tabix": "^1.5.6",
41
- "generic-filehandle": "^3.0.0"
42
- },
43
- "peerDependencies": {
44
- "@jbrowse/core": "^2.0.0",
45
- "@jbrowse/plugin-alignments": "^2.0.0",
46
- "@jbrowse/plugin-linear-genome-view": "^2.0.0",
39
+ "@gmod/bgzf-filehandle": "^2.0.1",
40
+ "@gmod/tabix": "^2.0.0",
41
+ "@jbrowse/core": "^3.0.1",
42
+ "@jbrowse/plugin-alignments": "^3.0.1",
43
+ "@jbrowse/plugin-linear-genome-view": "^3.0.1",
47
44
  "@mui/material": "^6.0.0",
45
+ "generic-filehandle2": "^1.0.0",
48
46
  "mobx": "^6.0.0",
49
47
  "mobx-react": "^9.0.0",
50
48
  "mobx-state-tree": "^5.0.0",
51
- "react": ">=16.8.0",
52
- "react-dom": ">=16.8.0",
53
49
  "rxjs": "^7.0.0"
54
50
  },
51
+ "peerDependencies": {
52
+ "react": ">=18.0.0",
53
+ "react-dom": ">=18.0.0"
54
+ },
55
55
  "distModule": "esm/index.js",
56
56
  "srcModule": "src/index.ts",
57
57
  "module": "esm/index.js",
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "c344ea60099cb7e460b77f15808946b24a7eee74"
61
+ "gitHead": "aa2f1d1a89d2361c7fd1a93fe29506fa4554f5cc"
62
62
  }