@nanalogue/node 0.1.1 → 0.1.3

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 CHANGED
@@ -55,11 +55,12 @@ Quickly extract BAM file metadata without processing all records.
55
55
  ```typescript
56
56
  import { peek } from '@nanalogue/node';
57
57
 
58
- const metadata = await peek({ bamPath: 'example.bam' });
59
- console.log(metadata);
58
+ const result = await peek({ bamPath: 'tests/data/examples/example_1.bam' });
59
+ console.log(result);
60
+ // Output:
60
61
  // {
61
- // contigs: { chr1: 248956422, chr2: 242193529, ... },
62
- // modifications: [['T', '+', 'T'], ['C', '+', 'm']]
62
+ // contigs: { dummyI: 22, dummyII: 48, dummyIII: 76 },
63
+ // modifications: [ [ 'G', '-', '7200' ], [ 'T', '+', 'T' ] ]
63
64
  // }
64
65
  ```
65
66
 
@@ -70,8 +71,19 @@ Get information about reads in the BAM file.
70
71
  ```typescript
71
72
  import { readInfo } from '@nanalogue/node';
72
73
 
73
- const reads = await readInfo({ bamPath: 'example.bam' });
74
- // Returns array of read records with alignment info and modification counts
74
+ const reads = await readInfo({ bamPath: 'tests/data/examples/example_1.bam' });
75
+ console.log(reads[0]);
76
+ // Output (first read):
77
+ // {
78
+ // read_id: '5d10eb9a-aae1-4db8-8ec6-7ebb34d32575',
79
+ // sequence_length: 8,
80
+ // contig: 'dummyI',
81
+ // reference_start: 9,
82
+ // reference_end: 17,
83
+ // alignment_length: 8,
84
+ // alignment_type: 'primary_forward',
85
+ // mod_count: 'T+T:0;(probabilities >= 0.5020, PHRED base qual >= 0)'
86
+ // }
75
87
  ```
76
88
 
77
89
  ### bamMods
@@ -81,9 +93,21 @@ Extract detailed modification data for each read.
81
93
  ```typescript
82
94
  import { bamMods } from '@nanalogue/node';
83
95
 
84
- const mods = await bamMods({ bamPath: 'example.bam' });
85
- // Returns array of records with modification tables containing
86
- // position, reference position, and probability for each modification
96
+ const mods = await bamMods({ bamPath: 'tests/data/examples/example_1.bam' });
97
+ console.log(mods[0]);
98
+ // Output (first read):
99
+ // {
100
+ // alignment_type: 'primary_forward',
101
+ // alignment: { start: 9, end: 17, contig: 'dummyI', contig_id: 0 },
102
+ // mod_table: [{
103
+ // base: 'T',
104
+ // is_strand_plus: true,
105
+ // mod_code: 'T',
106
+ // data: [[0, 9, 4], [3, 12, 7], [4, 13, 9], [7, 16, 6]] // [seq_pos, ref_pos, prob]
107
+ // }],
108
+ // read_id: '5d10eb9a-aae1-4db8-8ec6-7ebb34d32575',
109
+ // seq_len: 8
110
+ // }
87
111
  ```
88
112
 
89
113
  ### windowReads
@@ -94,11 +118,16 @@ Compute windowed modification densities across reads.
94
118
  import { windowReads } from '@nanalogue/node';
95
119
 
96
120
  const tsv = await windowReads({
97
- bamPath: 'example.bam',
98
- win: 100, // window size in bases
99
- step: 50 // step size
121
+ bamPath: 'tests/data/examples/example_1.bam',
122
+ win: 2,
123
+ step: 1
100
124
  });
101
- // Returns TSV string with windowed modification densities
125
+ console.log(tsv.split('\n').slice(0, 4).join('\n'));
126
+ // Output (first 3 data rows):
127
+ // #contig ref_win_start ref_win_end read_id win_val strand base mod_strand mod_type win_start win_end basecall_qual
128
+ // dummyI 9 13 5d10eb9a-aae1-4db8-8ec6-7ebb34d32575 0 + T + T 0 4 255
129
+ // dummyI 12 14 5d10eb9a-aae1-4db8-8ec6-7ebb34d32575 0 + T + T 3 5 255
130
+ // (basecall_qual is 255 as base quality scores are unavailable in this example file)
102
131
  ```
103
132
 
104
133
  Supports `winOp: 'grad_density'` for gradient mode.
@@ -111,10 +140,14 @@ Extract sequences and qualities for a genomic region.
111
140
  import { seqTable } from '@nanalogue/node';
112
141
 
113
142
  const tsv = await seqTable({
114
- bamPath: 'example.bam',
115
- region: 'chr1:1000-2000' // region is required
143
+ bamPath: 'tests/data/examples/example_pynanalogue_1.bam',
144
+ region: 'contig_00000:0-10' // region is required
116
145
  });
117
- // Returns TSV with read_id, sequence, qualities columns
146
+ console.log(tsv);
147
+ // Output:
148
+ // read_id sequence qualities
149
+ // 1... ACGTACGTAC 30.30.30.30.30.30.30.30.30.30
150
+ // 0... AZGTAZGTAZ 20.20.20.20.20.20.20.20.20.20
118
151
  // Sequence uses: . for deletion, lowercase for insertion, Z for modification
119
152
  ```
120
153
 
package/index.d.ts CHANGED
@@ -77,6 +77,12 @@ interface BaseReadOptionsCore {
77
77
  baseQualFilterMod?: number;
78
78
  /** Genomic region for modification filtering. */
79
79
  modRegion?: string;
80
+ /** Maximum number of records to return. Must be > 0 if set. If omitted, returns all records. */
81
+ limit?: number;
82
+ /** Number of records to skip before returning results. Must be >= 0 if set. Defaults to 0. */
83
+ offset?: number;
84
+ /** Seed for deterministic sampling. Required for stable pagination with sampleFraction. */
85
+ sampleSeed?: number;
80
86
  }
81
87
 
82
88
  /**
@@ -201,6 +207,12 @@ interface BaseWindowOptionsCore {
201
207
  baseQualFilterMod?: number;
202
208
  /** Genomic region for modification filtering. */
203
209
  modRegion?: string;
210
+ /** Maximum number of records to return. Must be > 0 if set. If omitted, returns all records. */
211
+ limit?: number;
212
+ /** Number of records to skip before returning results. Must be >= 0 if set. Defaults to 0. */
213
+ offset?: number;
214
+ /** Seed for deterministic sampling. Required for stable pagination with sampleFraction. */
215
+ sampleSeed?: number;
204
216
  }
205
217
 
206
218
  /**
package/package.json CHANGED
@@ -1,27 +1,23 @@
1
1
  {
2
2
  "name": "@nanalogue/node",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
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",
10
- "*.node"
9
+ "index.d.ts"
11
10
  ],
12
11
  "napi": {
13
- "name": "nanalogue",
14
- "triples": {
15
- "defaults": false,
16
- "additional": [
17
- "x86_64-apple-darwin",
18
- "aarch64-apple-darwin",
19
- "x86_64-unknown-linux-gnu",
20
- "x86_64-unknown-linux-musl",
21
- "aarch64-unknown-linux-gnu",
22
- "aarch64-unknown-linux-musl"
23
- ]
24
- }
12
+ "binaryName": "nanalogue",
13
+ "targets": [
14
+ "x86_64-apple-darwin",
15
+ "aarch64-apple-darwin",
16
+ "x86_64-unknown-linux-gnu",
17
+ "x86_64-unknown-linux-musl",
18
+ "aarch64-unknown-linux-gnu",
19
+ "aarch64-unknown-linux-musl"
20
+ ]
25
21
  },
26
22
  "engines": {
27
23
  "node": ">= 22"
@@ -61,11 +57,11 @@
61
57
  },
62
58
  "author": "Sathish Thiyagarajan <mail@unintegrable.com>",
63
59
  "optionalDependencies": {
64
- "@nanalogue/node-darwin-x64": "0.1.1",
65
- "@nanalogue/node-darwin-arm64": "0.1.1",
66
- "@nanalogue/node-linux-x64-gnu": "0.1.1",
67
- "@nanalogue/node-linux-x64-musl": "0.1.1",
68
- "@nanalogue/node-linux-arm64-gnu": "0.1.1",
69
- "@nanalogue/node-linux-arm64-musl": "0.1.1"
60
+ "@nanalogue/node-darwin-x64": "0.1.3",
61
+ "@nanalogue/node-darwin-arm64": "0.1.3",
62
+ "@nanalogue/node-linux-x64-gnu": "0.1.3",
63
+ "@nanalogue/node-linux-x64-musl": "0.1.3",
64
+ "@nanalogue/node-linux-arm64-gnu": "0.1.3",
65
+ "@nanalogue/node-linux-arm64-musl": "0.1.3"
70
66
  }
71
67
  }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file