@nanalogue/node 0.1.4 → 0.2.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/README.md +5 -4
- package/index.d.ts +35 -1
- package/index.js +23 -20
- package/package.json +21 -9
package/README.md
CHANGED
|
@@ -97,7 +97,8 @@ The output is a JSON object for the first read:
|
|
|
97
97
|
"reference_end": 17,
|
|
98
98
|
"alignment_length": 8,
|
|
99
99
|
"alignment_type": "primary_forward",
|
|
100
|
-
"mod_count": "T+T:0;(probabilities >= 0.5020, PHRED base qual >= 0)"
|
|
100
|
+
"mod_count": "T+T:0;(probabilities >= 0.5020, PHRED base qual >= 0)",
|
|
101
|
+
"mapq": 255
|
|
101
102
|
}
|
|
102
103
|
```
|
|
103
104
|
<!-- TEST OUTPUT: END readInfo -->
|
|
@@ -158,7 +159,8 @@ The output is a JSON object for the first read. The `data` arrays contain
|
|
|
158
159
|
}
|
|
159
160
|
],
|
|
160
161
|
"read_id": "5d10eb9a-aae1-4db8-8ec6-7ebb34d32575",
|
|
161
|
-
"seq_len": 8
|
|
162
|
+
"seq_len": 8,
|
|
163
|
+
"mapq": 255
|
|
162
164
|
}
|
|
163
165
|
```
|
|
164
166
|
<!-- TEST OUTPUT: END bamMods -->
|
|
@@ -171,12 +173,11 @@ Compute windowed modification densities across reads.
|
|
|
171
173
|
```typescript
|
|
172
174
|
import { windowReads } from '@nanalogue/node';
|
|
173
175
|
|
|
174
|
-
const
|
|
176
|
+
const entries = await windowReads({
|
|
175
177
|
bamPath: 'tests/data/examples/example_1.bam',
|
|
176
178
|
win: 2,
|
|
177
179
|
step: 1
|
|
178
180
|
});
|
|
179
|
-
const entries = JSON.parse(json);
|
|
180
181
|
console.log(JSON.stringify(entries[0], null, 2));
|
|
181
182
|
```
|
|
182
183
|
<!-- TEST CODE: END windowReads -->
|
package/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export interface MappedReadInfo {
|
|
|
24
24
|
alignment_length: number;
|
|
25
25
|
alignment_type: 'primary_forward' | 'primary_reverse' | 'secondary_forward' | 'secondary_reverse' | 'supplementary_forward' | 'supplementary_reverse';
|
|
26
26
|
mod_count: string;
|
|
27
|
+
mapq: number;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export interface UnmappedReadInfo {
|
|
@@ -31,6 +32,7 @@ export interface UnmappedReadInfo {
|
|
|
31
32
|
sequence_length: number;
|
|
32
33
|
alignment_type: 'unmapped';
|
|
33
34
|
mod_count: string;
|
|
35
|
+
mapq: number;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
export type ReadInfoRecord = MappedReadInfo | UnmappedReadInfo;
|
|
@@ -146,6 +148,7 @@ export interface MappedBamModRecord {
|
|
|
146
148
|
mod_table: ModTableEntry[];
|
|
147
149
|
read_id: string;
|
|
148
150
|
seq_len: number;
|
|
151
|
+
mapq: number;
|
|
149
152
|
}
|
|
150
153
|
|
|
151
154
|
export interface UnmappedBamModRecord {
|
|
@@ -153,12 +156,43 @@ export interface UnmappedBamModRecord {
|
|
|
153
156
|
mod_table: ModTableEntry[];
|
|
154
157
|
read_id: string;
|
|
155
158
|
seq_len: number;
|
|
159
|
+
mapq: number;
|
|
156
160
|
}
|
|
157
161
|
|
|
158
162
|
export type BamModRecord = MappedBamModRecord | UnmappedBamModRecord;
|
|
159
163
|
|
|
160
164
|
export declare function bamMods(options: ReadOptions): Promise<BamModRecord[]>;
|
|
161
165
|
|
|
166
|
+
// Window output types
|
|
167
|
+
export interface WindowModTableEntry {
|
|
168
|
+
base: string;
|
|
169
|
+
is_strand_plus: boolean;
|
|
170
|
+
mod_code: string;
|
|
171
|
+
data: [number, number, number, number, number, number][];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface MappedWindowReadEntry {
|
|
175
|
+
alignment_type: 'primary_forward' | 'primary_reverse' | 'secondary_forward' | 'secondary_reverse' | 'supplementary_forward' | 'supplementary_reverse';
|
|
176
|
+
alignment: {
|
|
177
|
+
start: number;
|
|
178
|
+
end: number;
|
|
179
|
+
contig: string;
|
|
180
|
+
contig_id: number;
|
|
181
|
+
};
|
|
182
|
+
mod_table: WindowModTableEntry[];
|
|
183
|
+
read_id: string;
|
|
184
|
+
seq_len: number;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface UnmappedWindowReadEntry {
|
|
188
|
+
alignment_type: 'unmapped';
|
|
189
|
+
mod_table: WindowModTableEntry[];
|
|
190
|
+
read_id: string;
|
|
191
|
+
seq_len: number;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export type WindowReadEntry = MappedWindowReadEntry | UnmappedWindowReadEntry;
|
|
195
|
+
|
|
162
196
|
// Base options shared by WindowOptions (excluding region/fullRegion)
|
|
163
197
|
interface BaseWindowOptionsCore {
|
|
164
198
|
/** Path to the BAM file (local path or URL). */
|
|
@@ -246,6 +280,6 @@ interface WindowOptionsWithoutRegion extends BaseWindowOptionsCore {
|
|
|
246
280
|
*/
|
|
247
281
|
export type WindowOptions = WindowOptionsWithRegion | WindowOptionsWithoutRegion;
|
|
248
282
|
|
|
249
|
-
export declare function windowReads(options: WindowOptions): Promise<
|
|
283
|
+
export declare function windowReads(options: WindowOptions): Promise<WindowReadEntry[]>;
|
|
250
284
|
|
|
251
285
|
export declare function seqTable(options: ReadOptions): Promise<string>;
|
package/index.js
CHANGED
|
@@ -253,48 +253,51 @@ switch (platform) {
|
|
|
253
253
|
}
|
|
254
254
|
break
|
|
255
255
|
case 'riscv64':
|
|
256
|
+
if (isMusl()) {
|
|
257
|
+
throw new Error(`Unsupported architecture on Linux musl: ${arch}`)
|
|
258
|
+
}
|
|
259
|
+
localFileExisted = existsSync(
|
|
260
|
+
join(__dirname, 'nanalogue.linux-riscv64-gnu.node')
|
|
261
|
+
)
|
|
262
|
+
try {
|
|
263
|
+
if (localFileExisted) {
|
|
264
|
+
nativeBinding = require('./nanalogue.linux-riscv64-gnu.node')
|
|
265
|
+
} else {
|
|
266
|
+
nativeBinding = require('@nanalogue/node-linux-riscv64-gnu')
|
|
267
|
+
}
|
|
268
|
+
} catch (e) {
|
|
269
|
+
loadError = e
|
|
270
|
+
}
|
|
271
|
+
break
|
|
272
|
+
case 'ppc64':
|
|
256
273
|
if (isMusl()) {
|
|
257
274
|
localFileExisted = existsSync(
|
|
258
|
-
join(__dirname, 'nanalogue.linux-
|
|
275
|
+
join(__dirname, 'nanalogue.linux-ppc64-musl.node')
|
|
259
276
|
)
|
|
260
277
|
try {
|
|
261
278
|
if (localFileExisted) {
|
|
262
|
-
nativeBinding = require('./nanalogue.linux-
|
|
279
|
+
nativeBinding = require('./nanalogue.linux-ppc64-musl.node')
|
|
263
280
|
} else {
|
|
264
|
-
nativeBinding = require('@nanalogue/node-linux-
|
|
281
|
+
nativeBinding = require('@nanalogue/node-linux-ppc64-musl')
|
|
265
282
|
}
|
|
266
283
|
} catch (e) {
|
|
267
284
|
loadError = e
|
|
268
285
|
}
|
|
269
286
|
} else {
|
|
270
287
|
localFileExisted = existsSync(
|
|
271
|
-
join(__dirname, 'nanalogue.linux-
|
|
288
|
+
join(__dirname, 'nanalogue.linux-ppc64-gnu.node')
|
|
272
289
|
)
|
|
273
290
|
try {
|
|
274
291
|
if (localFileExisted) {
|
|
275
|
-
nativeBinding = require('./nanalogue.linux-
|
|
292
|
+
nativeBinding = require('./nanalogue.linux-ppc64-gnu.node')
|
|
276
293
|
} else {
|
|
277
|
-
nativeBinding = require('@nanalogue/node-linux-
|
|
294
|
+
nativeBinding = require('@nanalogue/node-linux-ppc64-gnu')
|
|
278
295
|
}
|
|
279
296
|
} catch (e) {
|
|
280
297
|
loadError = e
|
|
281
298
|
}
|
|
282
299
|
}
|
|
283
300
|
break
|
|
284
|
-
case 's390x':
|
|
285
|
-
localFileExisted = existsSync(
|
|
286
|
-
join(__dirname, 'nanalogue.linux-s390x-gnu.node')
|
|
287
|
-
)
|
|
288
|
-
try {
|
|
289
|
-
if (localFileExisted) {
|
|
290
|
-
nativeBinding = require('./nanalogue.linux-s390x-gnu.node')
|
|
291
|
-
} else {
|
|
292
|
-
nativeBinding = require('@nanalogue/node-linux-s390x-gnu')
|
|
293
|
-
}
|
|
294
|
-
} catch (e) {
|
|
295
|
-
loadError = e
|
|
296
|
-
}
|
|
297
|
-
break
|
|
298
301
|
default:
|
|
299
302
|
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
|
300
303
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nanalogue/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Node.js bindings for Nanalogue: single-molecule BAM/Mod-BAM analysis",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"index.js",
|
|
9
|
-
"index.d.ts"
|
|
9
|
+
"index.d.ts",
|
|
10
|
+
"README.md"
|
|
10
11
|
],
|
|
11
12
|
"napi": {
|
|
12
13
|
"binaryName": "nanalogue",
|
|
@@ -16,7 +17,12 @@
|
|
|
16
17
|
"x86_64-unknown-linux-gnu",
|
|
17
18
|
"x86_64-unknown-linux-musl",
|
|
18
19
|
"aarch64-unknown-linux-gnu",
|
|
19
|
-
"aarch64-unknown-linux-musl"
|
|
20
|
+
"aarch64-unknown-linux-musl",
|
|
21
|
+
"armv7-unknown-linux-gnueabihf",
|
|
22
|
+
"armv7-unknown-linux-musleabihf",
|
|
23
|
+
"riscv64gc-unknown-linux-gnu",
|
|
24
|
+
"powerpc64le-unknown-linux-gnu",
|
|
25
|
+
"powerpc64le-unknown-linux-musl"
|
|
20
26
|
]
|
|
21
27
|
},
|
|
22
28
|
"engines": {
|
|
@@ -30,6 +36,7 @@
|
|
|
30
36
|
"lint": "biome check .",
|
|
31
37
|
"lint:fix": "biome check --write .",
|
|
32
38
|
"format": "biome format --write .",
|
|
39
|
+
"prepare": "git config core.hooksPath .githooks || true",
|
|
33
40
|
"prepublishOnly": "napi pre-publish --npm-dir npm --no-gh-release"
|
|
34
41
|
},
|
|
35
42
|
"devDependencies": {
|
|
@@ -57,11 +64,16 @@
|
|
|
57
64
|
},
|
|
58
65
|
"author": "Sathish Thiyagarajan <mail@unintegrable.com>",
|
|
59
66
|
"optionalDependencies": {
|
|
60
|
-
"@nanalogue/node-darwin-x64": "0.
|
|
61
|
-
"@nanalogue/node-darwin-arm64": "0.
|
|
62
|
-
"@nanalogue/node-linux-x64-gnu": "0.
|
|
63
|
-
"@nanalogue/node-linux-x64-musl": "0.
|
|
64
|
-
"@nanalogue/node-linux-arm64-gnu": "0.
|
|
65
|
-
"@nanalogue/node-linux-arm64-musl": "0.
|
|
67
|
+
"@nanalogue/node-darwin-x64": "0.2.0",
|
|
68
|
+
"@nanalogue/node-darwin-arm64": "0.2.0",
|
|
69
|
+
"@nanalogue/node-linux-x64-gnu": "0.2.0",
|
|
70
|
+
"@nanalogue/node-linux-x64-musl": "0.2.0",
|
|
71
|
+
"@nanalogue/node-linux-arm64-gnu": "0.2.0",
|
|
72
|
+
"@nanalogue/node-linux-arm64-musl": "0.2.0",
|
|
73
|
+
"@nanalogue/node-linux-arm-gnueabihf": "0.2.0",
|
|
74
|
+
"@nanalogue/node-linux-arm-musleabihf": "0.2.0",
|
|
75
|
+
"@nanalogue/node-linux-riscv64-gnu": "0.2.0",
|
|
76
|
+
"@nanalogue/node-linux-ppc64-gnu": "0.2.0",
|
|
77
|
+
"@nanalogue/node-linux-ppc64-musl": "0.2.0"
|
|
66
78
|
}
|
|
67
79
|
}
|