@jbrowse/plugin-comparative-adapters 2.17.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BlastTabularAdapter/BlastTabularAdapter.d.ts +3 -57
- package/dist/BlastTabularAdapter/BlastTabularAdapter.js +3 -10
- package/dist/BlastTabularAdapter/configSchema.d.ts +0 -15
- package/dist/BlastTabularAdapter/configSchema.js +1 -19
- package/dist/BlastTabularAdapter/index.d.ts +1 -1
- package/dist/BlastTabularAdapter/index.js +18 -8
- package/dist/ChainAdapter/ChainAdapter.d.ts +1 -1
- package/dist/ChainAdapter/ChainAdapter.js +2 -3
- package/dist/ChainAdapter/configSchema.d.ts +0 -14
- package/dist/ChainAdapter/configSchema.js +1 -19
- package/dist/ChainAdapter/index.d.ts +1 -1
- package/dist/ChainAdapter/index.js +18 -8
- package/dist/ChainAdapter/util.d.ts +1 -2
- package/dist/ChainAdapter/util.js +2 -49
- package/dist/ComparativeAddTrackComponent/ComparativeAddTrackComponent.d.ts +2 -0
- package/dist/ComparativeAddTrackComponent/ComparativeAddTrackComponent.js +31 -0
- package/dist/ComparativeAddTrackComponent/index.d.ts +2 -0
- package/dist/ComparativeAddTrackComponent/index.js +46 -0
- package/dist/DeltaAdapter/DeltaAdapter.d.ts +1 -1
- package/dist/DeltaAdapter/DeltaAdapter.js +2 -3
- package/dist/DeltaAdapter/configSchema.d.ts +0 -14
- package/dist/DeltaAdapter/configSchema.js +1 -19
- package/dist/DeltaAdapter/index.d.ts +1 -1
- package/dist/DeltaAdapter/index.js +18 -8
- package/dist/DeltaAdapter/util.d.ts +1 -2
- package/dist/DeltaAdapter/util.js +3 -30
- package/dist/GuessAdapter/index.d.ts +2 -0
- package/dist/GuessAdapter/index.js +74 -0
- package/dist/MCScanAddTrackComponent/MCScanAddTrackComponent.d.ts +2 -0
- package/dist/MCScanAddTrackComponent/MCScanAddTrackComponent.js +39 -0
- package/dist/MCScanAddTrackComponent/index.d.ts +2 -0
- package/dist/MCScanAddTrackComponent/index.js +46 -0
- package/dist/MCScanAnchorsAdapter/MCScanAnchorsAdapter.d.ts +3 -7
- package/dist/MCScanAnchorsAdapter/MCScanAnchorsAdapter.js +2 -15
- package/dist/MCScanAnchorsAdapter/configSchema.d.ts +0 -12
- package/dist/MCScanAnchorsAdapter/configSchema.js +1 -16
- package/dist/MCScanAnchorsAdapter/index.d.ts +1 -1
- package/dist/MCScanAnchorsAdapter/index.js +18 -8
- package/dist/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.d.ts +4 -8
- package/dist/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.js +2 -13
- package/dist/MCScanSimpleAnchorsAdapter/configSchema.d.ts +0 -12
- package/dist/MCScanSimpleAnchorsAdapter/configSchema.js +1 -16
- package/dist/MCScanSimpleAnchorsAdapter/index.d.ts +1 -1
- package/dist/MCScanSimpleAnchorsAdapter/index.js +18 -8
- package/dist/MashMapAdapter/MashMapAdapter.d.ts +1 -1
- package/dist/MashMapAdapter/MashMapAdapter.js +1 -2
- package/dist/MashMapAdapter/configSchema.d.ts +0 -12
- package/dist/MashMapAdapter/configSchema.js +1 -16
- package/dist/MashMapAdapter/index.d.ts +1 -1
- package/dist/MashMapAdapter/index.js +18 -8
- package/dist/PAFAdapter/PAFAdapter.d.ts +6 -5
- package/dist/PAFAdapter/PAFAdapter.js +4 -15
- package/dist/PAFAdapter/configSchema.d.ts +0 -12
- package/dist/PAFAdapter/configSchema.js +1 -16
- package/dist/PAFAdapter/index.d.ts +1 -1
- package/dist/PAFAdapter/index.js +18 -8
- package/dist/PAFAdapter/util.js +0 -35
- package/dist/PairwiseIndexedPAFAdapter/PairwiseIndexedPAFAdapter.d.ts +7 -6
- package/dist/PairwiseIndexedPAFAdapter/PairwiseIndexedPAFAdapter.js +5 -6
- package/dist/PairwiseIndexedPAFAdapter/configSchema.d.ts +0 -21
- package/dist/PairwiseIndexedPAFAdapter/configSchema.js +1 -25
- package/dist/PairwiseIndexedPAFAdapter/index.d.ts +1 -1
- package/dist/PairwiseIndexedPAFAdapter/index.js +18 -8
- package/dist/SyntenyFeature/index.js +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -25
- package/dist/syntenyTypes.d.ts +3 -0
- package/dist/syntenyTypes.js +25 -0
- package/dist/util.d.ts +4 -5
- package/dist/util.js +2 -4
- package/esm/BlastTabularAdapter/BlastTabularAdapter.d.ts +3 -57
- package/esm/BlastTabularAdapter/BlastTabularAdapter.js +5 -12
- package/esm/BlastTabularAdapter/configSchema.d.ts +0 -15
- package/esm/BlastTabularAdapter/configSchema.js +1 -19
- package/esm/BlastTabularAdapter/index.d.ts +1 -1
- package/esm/BlastTabularAdapter/index.js +1 -1
- package/esm/ChainAdapter/ChainAdapter.d.ts +1 -1
- package/esm/ChainAdapter/ChainAdapter.js +2 -3
- package/esm/ChainAdapter/configSchema.d.ts +0 -14
- package/esm/ChainAdapter/configSchema.js +1 -19
- package/esm/ChainAdapter/index.d.ts +1 -1
- package/esm/ChainAdapter/index.js +1 -1
- package/esm/ChainAdapter/util.d.ts +1 -2
- package/esm/ChainAdapter/util.js +2 -49
- package/esm/ComparativeAddTrackComponent/ComparativeAddTrackComponent.d.ts +2 -0
- package/esm/ComparativeAddTrackComponent/ComparativeAddTrackComponent.js +29 -0
- package/esm/ComparativeAddTrackComponent/index.d.ts +2 -0
- package/esm/ComparativeAddTrackComponent/index.js +10 -0
- package/esm/DeltaAdapter/DeltaAdapter.d.ts +1 -1
- package/esm/DeltaAdapter/DeltaAdapter.js +2 -3
- package/esm/DeltaAdapter/configSchema.d.ts +0 -14
- package/esm/DeltaAdapter/configSchema.js +1 -19
- package/esm/DeltaAdapter/index.d.ts +1 -1
- package/esm/DeltaAdapter/index.js +1 -1
- package/esm/DeltaAdapter/util.d.ts +1 -2
- package/esm/DeltaAdapter/util.js +3 -30
- package/esm/GuessAdapter/index.d.ts +2 -0
- package/esm/GuessAdapter/index.js +71 -0
- package/esm/MCScanAddTrackComponent/MCScanAddTrackComponent.d.ts +2 -0
- package/esm/MCScanAddTrackComponent/MCScanAddTrackComponent.js +37 -0
- package/esm/MCScanAddTrackComponent/index.d.ts +2 -0
- package/esm/MCScanAddTrackComponent/index.js +10 -0
- package/esm/MCScanAnchorsAdapter/MCScanAnchorsAdapter.d.ts +3 -7
- package/esm/MCScanAnchorsAdapter/MCScanAnchorsAdapter.js +4 -17
- package/esm/MCScanAnchorsAdapter/configSchema.d.ts +0 -12
- package/esm/MCScanAnchorsAdapter/configSchema.js +1 -16
- package/esm/MCScanAnchorsAdapter/index.d.ts +1 -1
- package/esm/MCScanAnchorsAdapter/index.js +1 -1
- package/esm/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.d.ts +4 -8
- package/esm/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.js +4 -15
- package/esm/MCScanSimpleAnchorsAdapter/configSchema.d.ts +0 -12
- package/esm/MCScanSimpleAnchorsAdapter/configSchema.js +1 -16
- package/esm/MCScanSimpleAnchorsAdapter/index.d.ts +1 -1
- package/esm/MCScanSimpleAnchorsAdapter/index.js +1 -1
- package/esm/MashMapAdapter/MashMapAdapter.d.ts +1 -1
- package/esm/MashMapAdapter/MashMapAdapter.js +1 -2
- package/esm/MashMapAdapter/configSchema.d.ts +0 -12
- package/esm/MashMapAdapter/configSchema.js +1 -16
- package/esm/MashMapAdapter/index.d.ts +1 -1
- package/esm/MashMapAdapter/index.js +1 -1
- package/esm/PAFAdapter/PAFAdapter.d.ts +6 -5
- package/esm/PAFAdapter/PAFAdapter.js +6 -17
- package/esm/PAFAdapter/configSchema.d.ts +0 -12
- package/esm/PAFAdapter/configSchema.js +1 -16
- package/esm/PAFAdapter/index.d.ts +1 -1
- package/esm/PAFAdapter/index.js +1 -1
- package/esm/PAFAdapter/util.js +0 -35
- package/esm/PairwiseIndexedPAFAdapter/PairwiseIndexedPAFAdapter.d.ts +7 -6
- package/esm/PairwiseIndexedPAFAdapter/PairwiseIndexedPAFAdapter.js +6 -7
- package/esm/PairwiseIndexedPAFAdapter/configSchema.d.ts +0 -21
- package/esm/PairwiseIndexedPAFAdapter/configSchema.js +1 -25
- package/esm/PairwiseIndexedPAFAdapter/index.d.ts +1 -1
- package/esm/PairwiseIndexedPAFAdapter/index.js +1 -1
- package/esm/SyntenyFeature/index.js +0 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +11 -25
- package/esm/syntenyTypes.d.ts +3 -0
- package/esm/syntenyTypes.js +22 -0
- package/esm/util.d.ts +4 -5
- package/esm/util.js +3 -5
- package/package.json +5 -5
package/esm/ChainAdapter/util.js
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
/* adapted from chain2paf by Andrea Guarracino, license reproduced below
|
|
2
|
-
*
|
|
3
|
-
* MIT License
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2021 Andrea Guarracino
|
|
6
|
-
*
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*/
|
|
25
1
|
function generate_record(qname, qstart, qend, qstrand, tname, tstart, tend, cigar, numMatches) {
|
|
26
2
|
return {
|
|
27
3
|
qname,
|
|
@@ -54,33 +30,19 @@ export function paf_chain2paf(buffer) {
|
|
|
54
30
|
let blockStart = 0;
|
|
55
31
|
const decoder = new TextDecoder('utf8');
|
|
56
32
|
while (blockStart < buffer.length) {
|
|
57
|
-
const n = buffer.indexOf(
|
|
33
|
+
const n = buffer.indexOf(10, blockStart);
|
|
58
34
|
if (n === -1) {
|
|
59
35
|
break;
|
|
60
36
|
}
|
|
61
37
|
const b = buffer.subarray(blockStart, n);
|
|
62
38
|
const l = decoder.decode(b).trim();
|
|
63
39
|
blockStart = n + 1;
|
|
64
|
-
const l_tab = l.replaceAll(' ', '\t');
|
|
40
|
+
const l_tab = l.replaceAll(' ', '\t');
|
|
65
41
|
const l_vec = l_tab.split('\t');
|
|
66
42
|
if (l_vec[0] === 'chain') {
|
|
67
|
-
// Emit previous PAF row, if available
|
|
68
43
|
if (cigar) {
|
|
69
44
|
records.push(generate_record(q_name, q_start, q_end, q_strand, t_name, t_start, t_end, cigar, num_matches));
|
|
70
45
|
}
|
|
71
|
-
// Save query/target information
|
|
72
|
-
// score -- chain score
|
|
73
|
-
// tName -- chromosome (reference sequence)
|
|
74
|
-
// tSize -- chromosome size (reference sequence)
|
|
75
|
-
// tStrand -- strand (reference sequence)
|
|
76
|
-
// tStart -- alignment start position (reference sequence)
|
|
77
|
-
// tEnd -- alignment end position (reference sequence)
|
|
78
|
-
// qName -- chromosome (query sequence)
|
|
79
|
-
// qSize -- chromosome size (query sequence)
|
|
80
|
-
// qStrand -- strand (query sequence)
|
|
81
|
-
// qStart -- alignment start position (query sequence)
|
|
82
|
-
// qEnd -- alignment end position (query sequence)
|
|
83
|
-
// id -- chain ID
|
|
84
46
|
t_name = l_vec[2];
|
|
85
47
|
t_start = +l_vec[5];
|
|
86
48
|
t_end = +l_vec[6];
|
|
@@ -94,18 +56,10 @@ export function paf_chain2paf(buffer) {
|
|
|
94
56
|
q_start = +q_size - q_end;
|
|
95
57
|
q_end = +q_size - tmp;
|
|
96
58
|
}
|
|
97
|
-
// Initialize PAF fields
|
|
98
59
|
num_matches = 0;
|
|
99
60
|
cigar = '';
|
|
100
61
|
}
|
|
101
62
|
else {
|
|
102
|
-
// size -- the size of the ungapped alignment
|
|
103
|
-
//
|
|
104
|
-
// dt -- the difference between the end of this block and the beginning
|
|
105
|
-
// of the next block (reference sequence)
|
|
106
|
-
//
|
|
107
|
-
// dq -- the difference between the end of this block and the beginning
|
|
108
|
-
// of the next block (query sequence)
|
|
109
63
|
const size_ungapped_alignment = +l_vec[0] || 0;
|
|
110
64
|
const diff_in_target = l_vec.length > 1 ? +l_vec[1] : 0;
|
|
111
65
|
const diff_in_query = l_vec.length > 2 ? +l_vec[2] : 0;
|
|
@@ -121,7 +75,6 @@ export function paf_chain2paf(buffer) {
|
|
|
121
75
|
}
|
|
122
76
|
}
|
|
123
77
|
}
|
|
124
|
-
// Emit last PAF row, if available
|
|
125
78
|
if (cigar) {
|
|
126
79
|
generate_record(q_name, q_start, q_end, q_strand, t_name, t_start, t_end, cigar, num_matches);
|
|
127
80
|
}
|
|
@@ -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,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
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
1
|
import PAFAdapter from '../PAFAdapter/PAFAdapter';
|
|
2
|
+
import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
3
|
export default class DeltaAdapter extends PAFAdapter {
|
|
4
4
|
setupPre(opts?: BaseOptions): Promise<{
|
|
5
5
|
qname: string;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { openLocation } from '@jbrowse/core/util/io';
|
|
2
1
|
import { fetchAndMaybeUnzip } from '@jbrowse/core/util';
|
|
3
|
-
|
|
4
|
-
import PAFAdapter from '../PAFAdapter/PAFAdapter';
|
|
2
|
+
import { openLocation } from '@jbrowse/core/util/io';
|
|
5
3
|
import { paf_delta2paf } from './util';
|
|
4
|
+
import PAFAdapter from '../PAFAdapter/PAFAdapter';
|
|
6
5
|
export default class DeltaAdapter extends PAFAdapter {
|
|
7
6
|
async setupPre(opts) {
|
|
8
7
|
const loc = openLocation(this.getConf('deltaLocation'), this.pluginManager);
|
|
@@ -1,33 +1,19 @@
|
|
|
1
1
|
declare const DeltaAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
/**
|
|
3
|
-
* #slot
|
|
4
|
-
*/
|
|
5
2
|
assemblyNames: {
|
|
6
3
|
type: string;
|
|
7
4
|
defaultValue: never[];
|
|
8
5
|
description: string;
|
|
9
6
|
};
|
|
10
|
-
/**
|
|
11
|
-
* #slot
|
|
12
|
-
* alternative to assembly names
|
|
13
|
-
*/
|
|
14
7
|
targetAssembly: {
|
|
15
8
|
type: string;
|
|
16
9
|
defaultValue: string;
|
|
17
10
|
description: string;
|
|
18
11
|
};
|
|
19
|
-
/**
|
|
20
|
-
* #slot
|
|
21
|
-
* alternative to assembly names
|
|
22
|
-
*/
|
|
23
12
|
queryAssembly: {
|
|
24
13
|
type: string;
|
|
25
14
|
defaultValue: string;
|
|
26
15
|
description: string;
|
|
27
16
|
};
|
|
28
|
-
/**
|
|
29
|
-
* #slot
|
|
30
|
-
*/
|
|
31
17
|
deltaLocation: {
|
|
32
18
|
type: string;
|
|
33
19
|
defaultValue: {
|
|
@@ -1,39 +1,21 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
|
-
|
|
3
|
-
* #config DeltaAdapter
|
|
4
|
-
* #category adapter
|
|
5
|
-
*/
|
|
6
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
function x() { }
|
|
7
3
|
const DeltaAdapter = ConfigurationSchema('DeltaAdapter', {
|
|
8
|
-
/**
|
|
9
|
-
* #slot
|
|
10
|
-
*/
|
|
11
4
|
assemblyNames: {
|
|
12
5
|
type: 'stringArray',
|
|
13
6
|
defaultValue: [],
|
|
14
7
|
description: 'Array of assembly names to use for this file. The query assembly name is the first value in the array, target assembly name is the second',
|
|
15
8
|
},
|
|
16
|
-
/**
|
|
17
|
-
* #slot
|
|
18
|
-
* alternative to assembly names
|
|
19
|
-
*/
|
|
20
9
|
targetAssembly: {
|
|
21
10
|
type: 'string',
|
|
22
11
|
defaultValue: '',
|
|
23
12
|
description: 'Alternative to assemblyNames: the target assembly name',
|
|
24
13
|
},
|
|
25
|
-
/**
|
|
26
|
-
* #slot
|
|
27
|
-
* alternative to assembly names
|
|
28
|
-
*/
|
|
29
14
|
queryAssembly: {
|
|
30
15
|
type: 'string',
|
|
31
16
|
defaultValue: '',
|
|
32
17
|
description: 'Alternative to assemblyNames: the query assembly name',
|
|
33
18
|
},
|
|
34
|
-
/**
|
|
35
|
-
* #slot
|
|
36
|
-
*/
|
|
37
19
|
deltaLocation: {
|
|
38
20
|
type: 'fileLocation',
|
|
39
21
|
defaultValue: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function DeltaAdapterF(pluginManager: PluginManager): void;
|
|
@@ -6,7 +6,7 @@ export default function DeltaAdapterF(pluginManager) {
|
|
|
6
6
|
displayName: 'MUMmer delta adapter',
|
|
7
7
|
configSchema,
|
|
8
8
|
adapterMetadata: {
|
|
9
|
-
|
|
9
|
+
category: 'Synteny adapters',
|
|
10
10
|
},
|
|
11
11
|
getAdapterClass: () => import('./DeltaAdapter').then(r => r.default),
|
|
12
12
|
}));
|
package/esm/DeltaAdapter/util.js
CHANGED
|
@@ -1,30 +1,3 @@
|
|
|
1
|
-
/* paf2delta from paftools.js in the minimap2 repository, license reproduced below
|
|
2
|
-
*
|
|
3
|
-
* The MIT License
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2018- Dana-Farber Cancer Institute
|
|
6
|
-
* 2017-2018 Broad Institute, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Permission is hereby granted, free of charge, to any person obtaining
|
|
9
|
-
* a copy of this software and associated documentation files (the
|
|
10
|
-
* "Software"), to deal in the Software without restriction, including
|
|
11
|
-
* without limitation the rights to use, copy, modify, merge, publish,
|
|
12
|
-
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
13
|
-
* permit persons to whom the Software is furnished to do so, subject to
|
|
14
|
-
* the following conditions:
|
|
15
|
-
*
|
|
16
|
-
* The above copyright notice and this permission notice shall be
|
|
17
|
-
* included in all copies or substantial portions of the Software.
|
|
18
|
-
*
|
|
19
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
20
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
21
|
-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
22
|
-
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
23
|
-
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
24
|
-
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
25
|
-
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
-
* SOFTWARE.
|
|
27
|
-
*/
|
|
28
1
|
export function paf_delta2paf(buffer) {
|
|
29
2
|
let rname = '';
|
|
30
3
|
let qname = '';
|
|
@@ -44,7 +17,7 @@ export function paf_delta2paf(buffer) {
|
|
|
44
17
|
let i = 0;
|
|
45
18
|
const decoder = new TextDecoder('utf8');
|
|
46
19
|
while (blockStart < buffer.length) {
|
|
47
|
-
const n = buffer.indexOf(
|
|
20
|
+
const n = buffer.indexOf(10, blockStart);
|
|
48
21
|
if (n === -1) {
|
|
49
22
|
break;
|
|
50
23
|
}
|
|
@@ -122,7 +95,7 @@ export function paf_delta2paf(buffer) {
|
|
|
122
95
|
}
|
|
123
96
|
else {
|
|
124
97
|
cigar.push((1 << 4) | 2);
|
|
125
|
-
}
|
|
98
|
+
}
|
|
126
99
|
}
|
|
127
100
|
else {
|
|
128
101
|
const l = -d - 1;
|
|
@@ -136,7 +109,7 @@ export function paf_delta2paf(buffer) {
|
|
|
136
109
|
}
|
|
137
110
|
else {
|
|
138
111
|
cigar.push((1 << 4) | 1);
|
|
139
|
-
}
|
|
112
|
+
}
|
|
140
113
|
}
|
|
141
114
|
}
|
|
142
115
|
}
|
|
@@ -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,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,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
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { BaseFeatureDataAdapter
|
|
2
|
-
import {
|
|
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';
|
|
3
4
|
interface BareFeature {
|
|
4
5
|
strand: number;
|
|
5
6
|
refName: string;
|
|
@@ -24,11 +25,6 @@ export default class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
|
|
|
24
25
|
getAssemblyNames(): string[];
|
|
25
26
|
getRefNames(opts?: BaseOptions): Promise<string[]>;
|
|
26
27
|
getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
27
|
-
/**
|
|
28
|
-
* called to provide a hint that data tied to a certain region
|
|
29
|
-
* will not be needed for the foreseeable future and can be purged
|
|
30
|
-
* from caches, etc
|
|
31
|
-
*/
|
|
32
28
|
freeResources(): void;
|
|
33
29
|
}
|
|
34
30
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseFeatureDataAdapter
|
|
1
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
+
import { SimpleFeature, doesIntersect2 } from '@jbrowse/core/util';
|
|
2
3
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
3
|
-
import { doesIntersect2, SimpleFeature, } from '@jbrowse/core/util';
|
|
4
4
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
5
|
-
import {
|
|
5
|
+
import { parseBed, readFile } from '../util';
|
|
6
6
|
class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
|
|
7
7
|
async setup(opts) {
|
|
8
8
|
if (!this.setupP) {
|
|
@@ -40,9 +40,6 @@ class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
async hasDataForRefName() {
|
|
43
|
-
// determining this properly is basically a call to getFeatures so is not
|
|
44
|
-
// really that important, and has to be true or else getFeatures is never
|
|
45
|
-
// called (BaseFeatureDataAdapter filters it out)
|
|
46
43
|
return true;
|
|
47
44
|
}
|
|
48
45
|
getAssemblyNames() {
|
|
@@ -51,7 +48,6 @@ class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
|
|
|
51
48
|
}
|
|
52
49
|
async getRefNames(opts = {}) {
|
|
53
50
|
var _a;
|
|
54
|
-
// @ts-expect-error
|
|
55
51
|
const r1 = (_a = opts.regions) === null || _a === void 0 ? void 0 : _a[0].assemblyName;
|
|
56
52
|
const { feats } = await this.setup(opts);
|
|
57
53
|
const idx = this.getAssemblyNames().indexOf(r1);
|
|
@@ -68,8 +64,6 @@ class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
|
|
|
68
64
|
getFeatures(region, opts = {}) {
|
|
69
65
|
return ObservableCreate(async (observer) => {
|
|
70
66
|
const { assemblyNames, feats } = await this.setup(opts);
|
|
71
|
-
// The index of the assembly name in the region list corresponds to
|
|
72
|
-
// the adapter in the subadapters list
|
|
73
67
|
const index = assemblyNames.indexOf(region.assemblyName);
|
|
74
68
|
if (index !== -1) {
|
|
75
69
|
const flip = index === 0;
|
|
@@ -82,8 +76,6 @@ class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
|
|
|
82
76
|
...f1,
|
|
83
77
|
uniqueId: `${index}-${rowNum}`,
|
|
84
78
|
syntenyId: rowNum,
|
|
85
|
-
// note: strand would be -1 if the two features are on opposite
|
|
86
|
-
// strands, indicating inverted alignment
|
|
87
79
|
strand: f1.strand * f2.strand,
|
|
88
80
|
assemblyName: assemblyNames[+!flip],
|
|
89
81
|
score,
|
|
@@ -98,12 +90,7 @@ class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
|
|
|
98
90
|
observer.complete();
|
|
99
91
|
});
|
|
100
92
|
}
|
|
101
|
-
|
|
102
|
-
* called to provide a hint that data tied to a certain region
|
|
103
|
-
* will not be needed for the foreseeable future and can be purged
|
|
104
|
-
* from caches, etc
|
|
105
|
-
*/
|
|
106
|
-
freeResources( /* { region } */) { }
|
|
93
|
+
freeResources() { }
|
|
107
94
|
}
|
|
108
95
|
MCScanAnchorsAdapter.capabilities = ['getFeatures', 'getRefNames'];
|
|
109
96
|
export default MCScanAnchorsAdapter;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
declare const MCScanAnchorsAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
/**
|
|
3
|
-
* #slot
|
|
4
|
-
*/
|
|
5
2
|
mcscanAnchorsLocation: {
|
|
6
3
|
type: string;
|
|
7
4
|
defaultValue: {
|
|
@@ -9,9 +6,6 @@ declare const MCScanAnchorsAdapter: import("@jbrowse/core/configuration/configur
|
|
|
9
6
|
locationType: string;
|
|
10
7
|
};
|
|
11
8
|
};
|
|
12
|
-
/**
|
|
13
|
-
* #slot
|
|
14
|
-
*/
|
|
15
9
|
bed1Location: {
|
|
16
10
|
type: string;
|
|
17
11
|
defaultValue: {
|
|
@@ -19,9 +13,6 @@ declare const MCScanAnchorsAdapter: import("@jbrowse/core/configuration/configur
|
|
|
19
13
|
locationType: string;
|
|
20
14
|
};
|
|
21
15
|
};
|
|
22
|
-
/**
|
|
23
|
-
* #slot
|
|
24
|
-
*/
|
|
25
16
|
bed2Location: {
|
|
26
17
|
type: string;
|
|
27
18
|
defaultValue: {
|
|
@@ -29,9 +20,6 @@ declare const MCScanAnchorsAdapter: import("@jbrowse/core/configuration/configur
|
|
|
29
20
|
locationType: string;
|
|
30
21
|
};
|
|
31
22
|
};
|
|
32
|
-
/**
|
|
33
|
-
* #slot
|
|
34
|
-
*/
|
|
35
23
|
assemblyNames: {
|
|
36
24
|
type: string;
|
|
37
25
|
defaultValue: never[];
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
|
-
|
|
3
|
-
* #config MCScanAnchorsAdapter
|
|
4
|
-
*/
|
|
5
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
function x() { }
|
|
6
3
|
const MCScanAnchorsAdapter = ConfigurationSchema('MCScanAnchorsAdapter', {
|
|
7
|
-
/**
|
|
8
|
-
* #slot
|
|
9
|
-
*/
|
|
10
4
|
mcscanAnchorsLocation: {
|
|
11
5
|
type: 'fileLocation',
|
|
12
6
|
defaultValue: {
|
|
@@ -14,9 +8,6 @@ const MCScanAnchorsAdapter = ConfigurationSchema('MCScanAnchorsAdapter', {
|
|
|
14
8
|
locationType: 'UriLocation',
|
|
15
9
|
},
|
|
16
10
|
},
|
|
17
|
-
/**
|
|
18
|
-
* #slot
|
|
19
|
-
*/
|
|
20
11
|
bed1Location: {
|
|
21
12
|
type: 'fileLocation',
|
|
22
13
|
defaultValue: {
|
|
@@ -24,9 +15,6 @@ const MCScanAnchorsAdapter = ConfigurationSchema('MCScanAnchorsAdapter', {
|
|
|
24
15
|
locationType: 'UriLocation',
|
|
25
16
|
},
|
|
26
17
|
},
|
|
27
|
-
/**
|
|
28
|
-
* #slot
|
|
29
|
-
*/
|
|
30
18
|
bed2Location: {
|
|
31
19
|
type: 'fileLocation',
|
|
32
20
|
defaultValue: {
|
|
@@ -34,9 +22,6 @@ const MCScanAnchorsAdapter = ConfigurationSchema('MCScanAnchorsAdapter', {
|
|
|
34
22
|
locationType: 'UriLocation',
|
|
35
23
|
},
|
|
36
24
|
},
|
|
37
|
-
/**
|
|
38
|
-
* #slot
|
|
39
|
-
*/
|
|
40
25
|
assemblyNames: {
|
|
41
26
|
type: 'stringArray',
|
|
42
27
|
defaultValue: [],
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function MCScanAnchorsAdapterF(pluginManager: PluginManager): void;
|
|
@@ -6,7 +6,7 @@ export default function MCScanAnchorsAdapterF(pluginManager) {
|
|
|
6
6
|
displayName: 'MCScan anchors adapter',
|
|
7
7
|
configSchema,
|
|
8
8
|
adapterMetadata: {
|
|
9
|
-
|
|
9
|
+
category: 'Synteny adapters',
|
|
10
10
|
},
|
|
11
11
|
getAdapterClass: () => import('./MCScanAnchorsAdapter').then(r => r.default),
|
|
12
12
|
}));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { BaseFeatureDataAdapter
|
|
2
|
-
import {
|
|
3
|
-
import { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
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';
|
|
4
5
|
interface BareFeature {
|
|
5
6
|
refName: string;
|
|
6
7
|
start: number;
|
|
@@ -32,11 +33,6 @@ export default class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
|
|
|
32
33
|
getAssemblyNames(): string[];
|
|
33
34
|
getRefNames(opts?: BaseOptions): Promise<string[]>;
|
|
34
35
|
getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
35
|
-
/**
|
|
36
|
-
* called to provide a hint that data tied to a certain region
|
|
37
|
-
* will not be needed for the foreseeable future and can be purged
|
|
38
|
-
* from caches, etc
|
|
39
|
-
*/
|
|
40
36
|
freeResources(): void;
|
|
41
37
|
}
|
|
42
38
|
export {};
|