@jbrowse/plugin-comparative-adapters 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 (115) hide show
  1. package/esm/BlastTabularAdapter/BlastTabularAdapter.js +8 -7
  2. package/esm/BlastTabularAdapter/configSchema.d.ts +2 -2
  3. package/esm/BlastTabularAdapter/index.js +2 -2
  4. package/esm/ChainAdapter/ChainAdapter.d.ts +2 -16
  5. package/esm/ChainAdapter/ChainAdapter.js +4 -3
  6. package/esm/ChainAdapter/configSchema.d.ts +2 -2
  7. package/esm/ChainAdapter/index.js +2 -2
  8. package/esm/ChainAdapter/util.js +2 -2
  9. package/esm/ComparativeAddTrackComponent/ComparativeAddTrackComponent.js +3 -4
  10. package/esm/ComparativeAddTrackComponent/index.js +2 -2
  11. package/esm/DeltaAdapter/DeltaAdapter.d.ts +2 -11
  12. package/esm/DeltaAdapter/DeltaAdapter.js +4 -3
  13. package/esm/DeltaAdapter/configSchema.d.ts +2 -2
  14. package/esm/DeltaAdapter/index.js +2 -2
  15. package/esm/DeltaAdapter/util.js +1 -1
  16. package/esm/GuessAdapter/index.js +1 -1
  17. package/esm/MCScanAddTrackComponent/MCScanAddTrackComponent.d.ts +1 -1
  18. package/esm/MCScanAddTrackComponent/MCScanAddTrackComponent.js +3 -4
  19. package/esm/MCScanAddTrackComponent/index.js +2 -2
  20. package/esm/MCScanAnchorsAdapter/MCScanAnchorsAdapter.js +5 -6
  21. package/esm/MCScanAnchorsAdapter/configSchema.d.ts +2 -2
  22. package/esm/MCScanAnchorsAdapter/index.js +2 -2
  23. package/esm/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.js +5 -6
  24. package/esm/MCScanSimpleAnchorsAdapter/configSchema.d.ts +2 -2
  25. package/esm/MCScanSimpleAnchorsAdapter/index.js +2 -2
  26. package/esm/MashMapAdapter/MashMapAdapter.d.ts +2 -13
  27. package/esm/MashMapAdapter/MashMapAdapter.js +4 -3
  28. package/esm/MashMapAdapter/configSchema.d.ts +2 -2
  29. package/esm/MashMapAdapter/index.js +2 -2
  30. package/esm/PAFAdapter/PAFAdapter.d.ts +1 -1
  31. package/esm/PAFAdapter/PAFAdapter.js +10 -11
  32. package/esm/PAFAdapter/configSchema.d.ts +2 -2
  33. package/esm/PAFAdapter/index.js +2 -2
  34. package/esm/PAFAdapter/util.js +22 -32
  35. package/esm/PairwiseIndexedPAFAdapter/PairwiseIndexedPAFAdapter.js +13 -12
  36. package/esm/PairwiseIndexedPAFAdapter/configSchema.d.ts +5 -5
  37. package/esm/PairwiseIndexedPAFAdapter/configSchema.js +1 -1
  38. package/esm/PairwiseIndexedPAFAdapter/index.js +2 -2
  39. package/esm/SyntenyFeature/index.js +3 -4
  40. package/esm/index.js +12 -15
  41. package/esm/util.d.ts +1 -1
  42. package/esm/util.js +1 -1
  43. package/package.json +27 -34
  44. package/dist/BlastTabularAdapter/BlastTabularAdapter.d.ts +0 -65
  45. package/dist/BlastTabularAdapter/BlastTabularAdapter.js +0 -206
  46. package/dist/BlastTabularAdapter/configSchema.d.ts +0 -30
  47. package/dist/BlastTabularAdapter/configSchema.js +0 -34
  48. package/dist/BlastTabularAdapter/index.d.ts +0 -2
  49. package/dist/BlastTabularAdapter/index.js +0 -52
  50. package/dist/ChainAdapter/ChainAdapter.d.ts +0 -19
  51. package/dist/ChainAdapter/ChainAdapter.js +0 -15
  52. package/dist/ChainAdapter/configSchema.d.ts +0 -25
  53. package/dist/ChainAdapter/configSchema.js +0 -39
  54. package/dist/ChainAdapter/index.d.ts +0 -2
  55. package/dist/ChainAdapter/index.js +0 -52
  56. package/dist/ChainAdapter/util.d.ts +0 -16
  57. package/dist/ChainAdapter/util.js +0 -82
  58. package/dist/ComparativeAddTrackComponent/ComparativeAddTrackComponent.d.ts +0 -2
  59. package/dist/ComparativeAddTrackComponent/ComparativeAddTrackComponent.js +0 -31
  60. package/dist/ComparativeAddTrackComponent/index.d.ts +0 -2
  61. package/dist/ComparativeAddTrackComponent/index.js +0 -46
  62. package/dist/DeltaAdapter/DeltaAdapter.d.ts +0 -14
  63. package/dist/DeltaAdapter/DeltaAdapter.js +0 -15
  64. package/dist/DeltaAdapter/configSchema.d.ts +0 -25
  65. package/dist/DeltaAdapter/configSchema.js +0 -42
  66. package/dist/DeltaAdapter/index.d.ts +0 -2
  67. package/dist/DeltaAdapter/index.js +0 -52
  68. package/dist/DeltaAdapter/util.d.ts +0 -11
  69. package/dist/DeltaAdapter/util.js +0 -111
  70. package/dist/GuessAdapter/index.d.ts +0 -2
  71. package/dist/GuessAdapter/index.js +0 -74
  72. package/dist/MCScanAddTrackComponent/MCScanAddTrackComponent.d.ts +0 -2
  73. package/dist/MCScanAddTrackComponent/MCScanAddTrackComponent.js +0 -39
  74. package/dist/MCScanAddTrackComponent/index.d.ts +0 -2
  75. package/dist/MCScanAddTrackComponent/index.js +0 -46
  76. package/dist/MCScanAnchorsAdapter/MCScanAnchorsAdapter.d.ts +0 -29
  77. package/dist/MCScanAnchorsAdapter/MCScanAnchorsAdapter.js +0 -98
  78. package/dist/MCScanAnchorsAdapter/configSchema.d.ts +0 -28
  79. package/dist/MCScanAnchorsAdapter/configSchema.js +0 -53
  80. package/dist/MCScanAnchorsAdapter/index.d.ts +0 -2
  81. package/dist/MCScanAnchorsAdapter/index.js +0 -52
  82. package/dist/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.d.ts +0 -37
  83. package/dist/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.js +0 -132
  84. package/dist/MCScanSimpleAnchorsAdapter/configSchema.d.ts +0 -28
  85. package/dist/MCScanSimpleAnchorsAdapter/configSchema.js +0 -53
  86. package/dist/MCScanSimpleAnchorsAdapter/index.d.ts +0 -2
  87. package/dist/MCScanSimpleAnchorsAdapter/index.js +0 -52
  88. package/dist/MashMapAdapter/MashMapAdapter.d.ts +0 -16
  89. package/dist/MashMapAdapter/MashMapAdapter.js +0 -39
  90. package/dist/MashMapAdapter/configSchema.d.ts +0 -25
  91. package/dist/MashMapAdapter/configSchema.js +0 -42
  92. package/dist/MashMapAdapter/index.d.ts +0 -2
  93. package/dist/MashMapAdapter/index.js +0 -52
  94. package/dist/PAFAdapter/PAFAdapter.d.ts +0 -20
  95. package/dist/PAFAdapter/PAFAdapter.js +0 -137
  96. package/dist/PAFAdapter/configSchema.d.ts +0 -25
  97. package/dist/PAFAdapter/configSchema.js +0 -42
  98. package/dist/PAFAdapter/index.d.ts +0 -2
  99. package/dist/PAFAdapter/index.js +0 -52
  100. package/dist/PAFAdapter/util.d.ts +0 -17
  101. package/dist/PAFAdapter/util.js +0 -45
  102. package/dist/PairwiseIndexedPAFAdapter/PairwiseIndexedPAFAdapter.d.ts +0 -24
  103. package/dist/PairwiseIndexedPAFAdapter/PairwiseIndexedPAFAdapter.js +0 -109
  104. package/dist/PairwiseIndexedPAFAdapter/configSchema.d.ts +0 -40
  105. package/dist/PairwiseIndexedPAFAdapter/configSchema.js +0 -64
  106. package/dist/PairwiseIndexedPAFAdapter/index.d.ts +0 -2
  107. package/dist/PairwiseIndexedPAFAdapter/index.js +0 -52
  108. package/dist/SyntenyFeature/index.d.ts +0 -4
  109. package/dist/SyntenyFeature/index.js +0 -14
  110. package/dist/index.d.ts +0 -6
  111. package/dist/index.js +0 -37
  112. package/dist/syntenyTypes.d.ts +0 -3
  113. package/dist/syntenyTypes.js +0 -25
  114. package/dist/util.d.ts +0 -16
  115. package/dist/util.js +0 -79
@@ -1,111 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.paf_delta2paf = paf_delta2paf;
4
- const parseLineByLine_1 = require("@jbrowse/core/util/parseLineByLine");
5
- function paf_delta2paf(buffer, opts) {
6
- const { statusCallback = () => { } } = opts || {};
7
- let rname = '';
8
- let qname = '';
9
- let qs = 0;
10
- let qe = 0;
11
- let rs = 0;
12
- let re = 0;
13
- let strand = 0;
14
- let NM = 0;
15
- let cigar = [];
16
- let x = 0;
17
- let y = 0;
18
- let seen_gt = false;
19
- const records = [];
20
- const regex = new RegExp(/^>(\S+)\s+(\S+)\s+(\d+)\s+(\d+)/);
21
- (0, parseLineByLine_1.parseLineByLine)(buffer, line => {
22
- const m = regex.exec(line);
23
- if (m !== null) {
24
- rname = m[1];
25
- qname = m[2];
26
- seen_gt = true;
27
- return true;
28
- }
29
- if (!seen_gt) {
30
- return true;
31
- }
32
- const t = line.split(' ');
33
- if (t.length === 7) {
34
- const t0 = +t[0];
35
- const t1 = +t[1];
36
- const t2 = +t[2];
37
- const t3 = +t[3];
38
- const t4 = +t[4];
39
- strand = (t0 < t1 && t2 < t3) || (t0 > t1 && t2 > t3) ? 1 : -1;
40
- rs = Math.min(t0, t1) - 1;
41
- re = Math.max(t1, t0);
42
- qs = Math.min(t2, t3) - 1;
43
- qe = Math.max(t3, t2);
44
- x = y = 0;
45
- NM = t4;
46
- cigar = [];
47
- }
48
- else if (t.length === 1) {
49
- const d = +t[0];
50
- if (d === 0) {
51
- let blen = 0;
52
- const cigar_str = [];
53
- if (re - rs - x !== qe - qs - y) {
54
- throw new Error(`inconsistent alignment on line ${line}`);
55
- }
56
- cigar.push((re - rs - x) << 4);
57
- for (const entry of cigar) {
58
- const rlen = entry >> 4;
59
- blen += rlen;
60
- cigar_str.push(rlen + 'MID'.charAt(entry & 0xf));
61
- }
62
- records.push({
63
- qname,
64
- qstart: qs,
65
- qend: qe,
66
- tname: rname,
67
- tstart: rs,
68
- tend: re,
69
- strand,
70
- extra: {
71
- numMatches: blen - NM,
72
- blockLen: blen,
73
- mappingQual: 0,
74
- NM,
75
- cg: cigar_str.join(''),
76
- },
77
- });
78
- }
79
- else if (d > 0) {
80
- const l = d - 1;
81
- x += l + 1;
82
- y += l;
83
- if (l > 0) {
84
- cigar.push(l << 4);
85
- }
86
- if (cigar.length > 0 && (cigar[cigar.length - 1] & 0xf) === 2) {
87
- cigar[cigar.length - 1] += 1 << 4;
88
- }
89
- else {
90
- cigar.push((1 << 4) | 2);
91
- }
92
- }
93
- else {
94
- const l = -d - 1;
95
- x += l;
96
- y += l + 1;
97
- if (l > 0) {
98
- cigar.push(l << 4);
99
- }
100
- if (cigar.length > 0 && (cigar[cigar.length - 1] & 0xf) === 1) {
101
- cigar[cigar.length - 1] += 1 << 4;
102
- }
103
- else {
104
- cigar.push((1 << 4) | 1);
105
- }
106
- }
107
- }
108
- return true;
109
- }, statusCallback);
110
- return records;
111
- }
@@ -1,2 +0,0 @@
1
- import type PluginManager from '@jbrowse/core/PluginManager';
2
- export default function GuessAdapterF(pluginManager: PluginManager): void;
@@ -1,74 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = GuessAdapterF;
4
- const util_1 = require("@jbrowse/core/util");
5
- const tracks_1 = require("@jbrowse/core/util/tracks");
6
- const syntenyTypes_1 = require("../syntenyTypes");
7
- function GuessAdapterF(pluginManager) {
8
- pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
9
- return (file, index, adapterHint) => {
10
- const fileName = (0, tracks_1.getFileName)(file);
11
- const indexName = index && (0, tracks_1.getFileName)(index);
12
- if ((0, util_1.testAdapter)(fileName, /\.paf(.gz)?/i, adapterHint, 'PAFAdapter')) {
13
- return {
14
- type: 'PAFAdapter',
15
- pafLocation: file,
16
- };
17
- }
18
- else if (adapterHint === 'BlastTabularAdapter') {
19
- return {
20
- type: 'BlastTabularAdapter',
21
- blastTableLocation: file,
22
- };
23
- }
24
- else if ((0, util_1.testAdapter)(fileName, /\.anchors.simple(.gz)?/i, adapterHint, 'MCScanSimpleAnchorsAdapter')) {
25
- return {
26
- type: 'MCScanSimpleAnchorsAdapter',
27
- mcscanSimpleAnchorsLocation: file,
28
- };
29
- }
30
- else if ((0, util_1.testAdapter)(fileName, /\.anchors(.gz)?/i, adapterHint, 'MCScanAnchorsAdapter')) {
31
- return {
32
- type: 'MCScanAnchorsAdapter',
33
- mcscanAnchorsLocation: file,
34
- };
35
- }
36
- else if ((0, util_1.testAdapter)(fileName, /\.delta(.gz)?/i, adapterHint, 'DeltaAdapter')) {
37
- return {
38
- type: 'DeltaAdapter',
39
- deltaLocation: file,
40
- };
41
- }
42
- else if ((0, util_1.testAdapter)(fileName, /\.chain(.gz)?/i, adapterHint, 'ChainAdapter')) {
43
- return {
44
- type: 'ChainAdapter',
45
- chainLocation: file,
46
- };
47
- }
48
- else if ((0, util_1.testAdapter)(fileName, /\.out(.gz)?/i, adapterHint, 'MashMapAdapter')) {
49
- return {
50
- type: 'MashMapAdapter',
51
- outLocation: file,
52
- };
53
- }
54
- else if ((0, util_1.testAdapter)(fileName, /\.pif\.gz/i, adapterHint, 'PairwiseIndexedPAFAdapter')) {
55
- return {
56
- type: 'PairwiseIndexedPAFAdapter',
57
- pifGzLocation: file,
58
- index: {
59
- location: index || (0, tracks_1.makeIndex)(file, '.tbi'),
60
- indexType: (0, tracks_1.makeIndexType)(indexName, 'CSI', 'TBI'),
61
- },
62
- };
63
- }
64
- else {
65
- return adapterGuesser(file, index, adapterHint);
66
- }
67
- };
68
- });
69
- pluginManager.addToExtensionPoint('Core-guessTrackTypeForLocation', (trackTypeGuesser) => {
70
- return (adapterName) => syntenyTypes_1.syntenyTypes.includes(adapterName)
71
- ? 'SyntenyTrack'
72
- : trackTypeGuesser(adapterName);
73
- });
74
- }
@@ -1,2 +0,0 @@
1
- declare const MCScanAddTrackComponent: ({ model }: any) => import("react/jsx-runtime").JSX.Element;
2
- export default MCScanAddTrackComponent;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const react_1 = require("react");
5
- const ui_1 = require("@jbrowse/core/ui");
6
- const util_1 = require("@jbrowse/core/util");
7
- const material_1 = require("@mui/material");
8
- const mobx_react_1 = require("mobx-react");
9
- const MCScanAddTrackComponent = (0, mobx_react_1.observer)(function ({ model }) {
10
- var _a, _b;
11
- const session = (0, util_1.getSession)(model);
12
- const [r0, setR0] = (0, react_1.useState)((_a = session.assemblies[0]) === null || _a === void 0 ? void 0 : _a.name);
13
- const [r1, setR1] = (0, react_1.useState)((_b = session.assemblies[0]) === null || _b === void 0 ? void 0 : _b.name);
14
- const [bed1Location, setBed1Location] = (0, react_1.useState)();
15
- const [bed2Location, setBed2Location] = (0, react_1.useState)();
16
- (0, react_1.useEffect)(() => {
17
- model.setMixinData({
18
- adapter: {
19
- assemblyNamees: [r0, r1],
20
- bed1Location,
21
- bed2Location,
22
- },
23
- });
24
- }, [model, bed1Location, bed2Location, r0, r1]);
25
- return ((0, jsx_runtime_1.jsxs)("div", { style: { marginTop: 20 }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: "JBrowse requires the two BED files that specify the genomic locations of the genes in the .anchors files" }), (0, jsx_runtime_1.jsx)(ui_1.AssemblySelector, { session: session, label: "BED1 assembly", helperText: "", selected: r0, onChange: asm => {
26
- setR0(asm);
27
- }, TextFieldProps: {
28
- fullWidth: true,
29
- } }), (0, jsx_runtime_1.jsx)(ui_1.AssemblySelector, { session: session, label: "BED2 assembly", helperText: "", selected: r1, onChange: asm => {
30
- setR1(asm);
31
- }, TextFieldProps: {
32
- fullWidth: true,
33
- } }), (0, jsx_runtime_1.jsx)(ui_1.FileSelector, { name: "BED1", inline: true, description: "", location: bed1Location, setLocation: loc => {
34
- setBed1Location(loc);
35
- } }), (0, jsx_runtime_1.jsx)(ui_1.FileSelector, { name: "BED2", inline: true, description: "", location: bed2Location, setLocation: loc => {
36
- setBed2Location(loc);
37
- } })] }));
38
- });
39
- exports.default = MCScanAddTrackComponent;
@@ -1,2 +0,0 @@
1
- import type PluginManager from '@jbrowse/core/PluginManager';
2
- export default function MCScanAddTrackComponentF(pluginManager: PluginManager): void;
@@ -1,46 +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
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.default = MCScanAddTrackComponentF;
37
- const react_1 = require("react");
38
- const syntenyTypes_1 = require("../syntenyTypes");
39
- const MCScanAddTrackComponent = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./MCScanAddTrackComponent'))));
40
- function MCScanAddTrackComponentF(pluginManager) {
41
- pluginManager.addToExtensionPoint('Core-addTrackComponent', (comp, { model }) => {
42
- return syntenyTypes_1.mcscanTypes.includes(model.trackAdapterType)
43
- ? MCScanAddTrackComponent
44
- : comp;
45
- });
46
- }
@@ -1,29 +0,0 @@
1
- import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
3
- import type { Feature, Region } from '@jbrowse/core/util';
4
- interface BareFeature {
5
- strand: number;
6
- refName: string;
7
- start: number;
8
- end: number;
9
- score: number;
10
- name: string;
11
- }
12
- type Row = [BareFeature, BareFeature, number, number];
13
- export default class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
14
- private setupP?;
15
- static capabilities: string[];
16
- setup(opts: BaseOptions): Promise<{
17
- assemblyNames: string[];
18
- feats: Row[];
19
- }>;
20
- setupPre(opts: BaseOptions): Promise<{
21
- assemblyNames: string[];
22
- feats: Row[];
23
- }>;
24
- hasDataForRefName(): Promise<boolean>;
25
- getAssemblyNames(): string[];
26
- getRefNames(opts?: BaseOptions): Promise<string[]>;
27
- getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
28
- }
29
- export {};
@@ -1,98 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
4
- const util_1 = require("@jbrowse/core/util");
5
- const io_1 = require("@jbrowse/core/util/io");
6
- const rxjs_1 = require("@jbrowse/core/util/rxjs");
7
- const util_2 = require("../util");
8
- class MCScanAnchorsAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
9
- async setup(opts) {
10
- if (!this.setupP) {
11
- this.setupP = this.setupPre(opts).catch((e) => {
12
- this.setupP = undefined;
13
- throw e;
14
- });
15
- }
16
- return this.setupP;
17
- }
18
- async setupPre(opts) {
19
- const { statusCallback = () => { } } = opts;
20
- const assemblyNames = this.getConf('assemblyNames');
21
- const pm = this.pluginManager;
22
- const bed1 = (0, io_1.openLocation)(this.getConf('bed1Location'), pm);
23
- const bed2 = (0, io_1.openLocation)(this.getConf('bed2Location'), pm);
24
- const mcscan = (0, io_1.openLocation)(this.getConf('mcscanAnchorsLocation'), pm);
25
- const [bed1text, bed2text, mcscantext] = await (0, util_1.updateStatus)('Downloading data', statusCallback, () => Promise.all([bed1, bed2, mcscan].map(r => (0, util_2.readFile)(r, opts))));
26
- const bed1Map = (0, util_2.parseBed)(bed1text);
27
- const bed2Map = (0, util_2.parseBed)(bed2text);
28
- const feats = mcscantext
29
- .split(/\n|\r\n|\r/)
30
- .filter(f => !!f && f !== '###')
31
- .map((line, index) => {
32
- const [name1, name2, score] = line.split('\t');
33
- const r1 = bed1Map.get(name1);
34
- const r2 = bed2Map.get(name2);
35
- if (!r1 || !r2) {
36
- throw new Error(`feature not found, ${name1} ${name2} ${r1} ${r2}`);
37
- }
38
- return [r1, r2, +score, index];
39
- });
40
- return {
41
- assemblyNames,
42
- feats,
43
- };
44
- }
45
- async hasDataForRefName() {
46
- return true;
47
- }
48
- getAssemblyNames() {
49
- const assemblyNames = this.getConf('assemblyNames');
50
- return assemblyNames;
51
- }
52
- async getRefNames(opts = {}) {
53
- var _a;
54
- const r1 = (_a = opts.regions) === null || _a === void 0 ? void 0 : _a[0].assemblyName;
55
- const { feats } = await this.setup(opts);
56
- const idx = this.getAssemblyNames().indexOf(r1);
57
- if (idx !== -1) {
58
- const set = new Set();
59
- for (const feat of feats) {
60
- set.add(idx === 0 ? feat[0].refName : feat[1].refName);
61
- }
62
- return [...set];
63
- }
64
- console.warn('Unable to do ref renaming on adapter');
65
- return [];
66
- }
67
- getFeatures(region, opts = {}) {
68
- return (0, rxjs_1.ObservableCreate)(async (observer) => {
69
- const { assemblyNames, feats } = await this.setup(opts);
70
- const index = assemblyNames.indexOf(region.assemblyName);
71
- if (index !== -1) {
72
- const flip = index === 0;
73
- for (const f of feats) {
74
- const [r1, r2, score, rowNum] = f;
75
- const [f1, f2] = !flip ? [r2, r1] : [r1, r2];
76
- if (f1.refName === region.refName &&
77
- (0, util_1.doesIntersect2)(region.start, region.end, f1.start, f1.end)) {
78
- observer.next(new util_1.SimpleFeature({
79
- ...f1,
80
- uniqueId: `${index}-${rowNum}`,
81
- syntenyId: rowNum,
82
- strand: f1.strand * f2.strand,
83
- assemblyName: assemblyNames[+!flip],
84
- score,
85
- mate: {
86
- ...f2,
87
- assemblyName: assemblyNames[+flip],
88
- },
89
- }));
90
- }
91
- }
92
- }
93
- observer.complete();
94
- });
95
- }
96
- }
97
- MCScanAnchorsAdapter.capabilities = ['getFeatures', 'getRefNames'];
98
- exports.default = MCScanAnchorsAdapter;
@@ -1,28 +0,0 @@
1
- declare const MCScanAnchorsAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- mcscanAnchorsLocation: {
3
- type: string;
4
- defaultValue: {
5
- uri: string;
6
- locationType: string;
7
- };
8
- };
9
- bed1Location: {
10
- type: string;
11
- defaultValue: {
12
- uri: string;
13
- locationType: string;
14
- };
15
- };
16
- bed2Location: {
17
- type: string;
18
- defaultValue: {
19
- uri: string;
20
- locationType: string;
21
- };
22
- };
23
- assemblyNames: {
24
- type: string;
25
- defaultValue: never[];
26
- };
27
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
28
- export default MCScanAnchorsAdapter;
@@ -1,53 +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 MCScanAnchorsAdapter = (0, configuration_1.ConfigurationSchema)('MCScanAnchorsAdapter', {
6
- mcscanAnchorsLocation: {
7
- type: 'fileLocation',
8
- defaultValue: {
9
- uri: '/path/to/mcscan.anchors',
10
- locationType: 'UriLocation',
11
- },
12
- },
13
- bed1Location: {
14
- type: 'fileLocation',
15
- defaultValue: {
16
- uri: '/path/to/file.bed',
17
- locationType: 'UriLocation',
18
- },
19
- },
20
- bed2Location: {
21
- type: 'fileLocation',
22
- defaultValue: {
23
- uri: '/path/to/file.bed',
24
- locationType: 'UriLocation',
25
- },
26
- },
27
- assemblyNames: {
28
- type: 'stringArray',
29
- defaultValue: [],
30
- },
31
- }, {
32
- explicitlyTyped: true,
33
- preProcessSnapshot: snap => {
34
- return snap.uri && snap.bed1 && snap.bed2
35
- ? {
36
- ...snap,
37
- mcscanAnchorsLocation: {
38
- uri: snap.uri,
39
- baseUri: snap.baseUri,
40
- },
41
- bed1Location: {
42
- uri: snap.bed1,
43
- baseUri: snap.baseUri,
44
- },
45
- bed2Location: {
46
- uri: snap.bed2,
47
- baseUri: snap.baseUri,
48
- },
49
- }
50
- : snap;
51
- },
52
- });
53
- exports.default = MCScanAnchorsAdapter;
@@ -1,2 +0,0 @@
1
- import type PluginManager from '@jbrowse/core/PluginManager';
2
- export default function MCScanAnchorsAdapterF(pluginManager: PluginManager): void;
@@ -1,52 +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 = MCScanAnchorsAdapterF;
40
- const AdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
41
- const configSchema_1 = __importDefault(require("./configSchema"));
42
- function MCScanAnchorsAdapterF(pluginManager) {
43
- pluginManager.addAdapterType(() => new AdapterType_1.default({
44
- name: 'MCScanAnchorsAdapter',
45
- displayName: 'MCScan anchors adapter',
46
- configSchema: configSchema_1.default,
47
- adapterMetadata: {
48
- category: 'Synteny adapters',
49
- },
50
- getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./MCScanAnchorsAdapter'))).then(r => r.default),
51
- }));
52
- }
@@ -1,37 +0,0 @@
1
- import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
3
- import type { Feature } from '@jbrowse/core/util/simpleFeature';
4
- import type { Region } from '@jbrowse/core/util/types';
5
- interface BareFeature {
6
- refName: string;
7
- start: number;
8
- end: number;
9
- score: number;
10
- name: string;
11
- }
12
- type Row = [
13
- BareFeature,
14
- BareFeature,
15
- BareFeature,
16
- BareFeature,
17
- number,
18
- number,
19
- number
20
- ];
21
- export default class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
22
- private setupP?;
23
- static capabilities: string[];
24
- setup(opts: BaseOptions): Promise<{
25
- assemblyNames: string[];
26
- feats: Row[];
27
- }>;
28
- setupPre(opts: BaseOptions): Promise<{
29
- assemblyNames: string[];
30
- feats: Row[];
31
- }>;
32
- hasDataForRefName(): Promise<boolean>;
33
- getAssemblyNames(): string[];
34
- getRefNames(opts?: BaseOptions): Promise<string[]>;
35
- getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
36
- }
37
- export {};