gff-nostream 2.0.1 → 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/api.d.ts +9 -26
- package/dist/api.js +85 -89
- package/dist/api.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/dist/util.d.ts +15 -60
- package/dist/util.js +167 -247
- package/dist/util.js.map +1 -1
- package/esm/api.d.ts +9 -26
- package/esm/api.js +85 -84
- package/esm/api.js.map +1 -1
- package/esm/index.d.ts +1 -2
- package/esm/index.js +1 -2
- package/esm/index.js.map +1 -1
- package/esm/util.d.ts +15 -60
- package/esm/util.js +166 -239
- package/esm/util.js.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +90 -91
- package/src/index.ts +1 -2
- package/src/util.ts +180 -295
- package/dist/parse.d.ts +0 -42
- package/dist/parse.js +0 -307
- package/dist/parse.js.map +0 -1
- package/esm/parse.d.ts +0 -42
- package/esm/parse.js +0 -278
- package/esm/parse.js.map +0 -1
- package/src/parse.ts +0 -334
package/dist/api.d.ts
CHANGED
|
@@ -1,42 +1,25 @@
|
|
|
1
1
|
import type { GFF3Feature } from './util.ts';
|
|
2
2
|
export interface LineRecord {
|
|
3
|
-
|
|
3
|
+
line: string;
|
|
4
4
|
lineHash?: string | number;
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
hasEscapes: boolean;
|
|
5
8
|
}
|
|
6
9
|
/**
|
|
7
10
|
* Synchronously parse a string containing GFF3 and return an array of the
|
|
8
11
|
* parsed items.
|
|
9
12
|
*
|
|
10
13
|
* @param str - GFF3 string
|
|
11
|
-
* @param inputOptions - Parsing options
|
|
12
|
-
* @returns array of parsed features, directives, comments and/or sequences
|
|
13
|
-
*/
|
|
14
|
-
export declare function parseStringSync(str: string): GFF3Feature[];
|
|
15
|
-
/**
|
|
16
|
-
* Synchronously parse an array of strings containing GFF3 and return an array of the
|
|
17
|
-
* parsed items.
|
|
18
|
-
*
|
|
19
|
-
* @param arr - GFF3 array of strings
|
|
20
|
-
* @param inputOptions - Parsing options
|
|
21
|
-
* @returns array of parsed features, directives, comments and/or sequences
|
|
22
|
-
*/
|
|
23
|
-
export declare function parseArraySync(arr: string[]): GFF3Feature[];
|
|
24
|
-
/**
|
|
25
|
-
* Synchronously parse an array of LineRecord objects containing pre-split GFF3
|
|
26
|
-
* fields and return an array of the parsed items.
|
|
27
|
-
*
|
|
28
|
-
* @param records - Array of LineRecord objects with fields array and optional lineHash
|
|
29
14
|
* @returns array of parsed features
|
|
30
15
|
*/
|
|
31
|
-
export declare function
|
|
16
|
+
export declare function parseStringSync(str: string): GFF3Feature[];
|
|
32
17
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* unescaping when hasEscapes is false.
|
|
18
|
+
* Parse an array of LineRecord objects containing raw GFF3 lines.
|
|
19
|
+
* Supports parent/child relationships.
|
|
36
20
|
*
|
|
37
|
-
* @param records - Array of LineRecord objects with
|
|
38
|
-
* @param hasEscapes - Whether the records contain percent-encoded characters
|
|
21
|
+
* @param records - Array of LineRecord objects with raw line and metadata
|
|
39
22
|
* @returns array of parsed features
|
|
40
23
|
*/
|
|
41
|
-
export declare function
|
|
24
|
+
export declare function parseRecords(records: LineRecord[]): GFF3Feature[];
|
|
42
25
|
export type { GFF3Comment, GFF3Directive, GFF3Feature, GFF3FeatureLine, GFF3FeatureLineWithRefs, GFF3Item, GFF3Sequence, } from './util.ts';
|
package/dist/api.js
CHANGED
|
@@ -1,119 +1,115 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.parseStringSync = parseStringSync;
|
|
7
|
-
exports.
|
|
8
|
-
exports.parseRecordsSync = parseRecordsSync;
|
|
9
|
-
exports.parseRecordsSyncFast = parseRecordsSyncFast;
|
|
10
|
-
const parse_ts_1 = __importDefault(require("./parse.js"));
|
|
4
|
+
exports.parseRecords = parseRecords;
|
|
11
5
|
const util_ts_1 = require("./util.js");
|
|
12
6
|
/**
|
|
13
7
|
* Synchronously parse a string containing GFF3 and return an array of the
|
|
14
8
|
* parsed items.
|
|
15
9
|
*
|
|
16
10
|
* @param str - GFF3 string
|
|
17
|
-
* @param inputOptions - Parsing options
|
|
18
|
-
* @returns array of parsed features, directives, comments and/or sequences
|
|
19
|
-
*/
|
|
20
|
-
function parseStringSync(str) {
|
|
21
|
-
const items = [];
|
|
22
|
-
const parser = new parse_ts_1.default({
|
|
23
|
-
featureCallback: arg => items.push(arg),
|
|
24
|
-
disableDerivesFromReferences: true,
|
|
25
|
-
errorCallback: err => {
|
|
26
|
-
throw new Error(err);
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
for (const line of str.split(/\r?\n/)) {
|
|
30
|
-
parser.addLine(line);
|
|
31
|
-
}
|
|
32
|
-
parser.finish();
|
|
33
|
-
return items;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Synchronously parse an array of strings containing GFF3 and return an array of the
|
|
37
|
-
* parsed items.
|
|
38
|
-
*
|
|
39
|
-
* @param arr - GFF3 array of strings
|
|
40
|
-
* @param inputOptions - Parsing options
|
|
41
|
-
* @returns array of parsed features, directives, comments and/or sequences
|
|
42
|
-
*/
|
|
43
|
-
function parseArraySync(arr) {
|
|
44
|
-
const items = [];
|
|
45
|
-
const parser = new parse_ts_1.default({
|
|
46
|
-
featureCallback: arg => items.push(arg),
|
|
47
|
-
disableDerivesFromReferences: true,
|
|
48
|
-
errorCallback: err => {
|
|
49
|
-
throw new Error(err);
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
for (const line of arr) {
|
|
53
|
-
parser.addLine(line);
|
|
54
|
-
}
|
|
55
|
-
parser.finish();
|
|
56
|
-
return items;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Synchronously parse an array of LineRecord objects containing pre-split GFF3
|
|
60
|
-
* fields and return an array of the parsed items.
|
|
61
|
-
*
|
|
62
|
-
* @param records - Array of LineRecord objects with fields array and optional lineHash
|
|
63
11
|
* @returns array of parsed features
|
|
64
12
|
*/
|
|
65
|
-
function
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
});
|
|
74
|
-
for (const record of records) {
|
|
75
|
-
const featureLine = (0, util_ts_1.parseFieldsArray)(record.fields);
|
|
76
|
-
if (record.lineHash !== undefined) {
|
|
77
|
-
if (!featureLine.attributes) {
|
|
78
|
-
featureLine.attributes = {};
|
|
13
|
+
function parseStringSync(str) {
|
|
14
|
+
const lines = str.split(/\r?\n/);
|
|
15
|
+
const records = [];
|
|
16
|
+
for (let i = 0; i < lines.length; i++) {
|
|
17
|
+
const line = lines[i];
|
|
18
|
+
if (line.length === 0 || line[0] === '#') {
|
|
19
|
+
if (line.startsWith('##FASTA')) {
|
|
20
|
+
break;
|
|
79
21
|
}
|
|
80
|
-
|
|
22
|
+
continue;
|
|
81
23
|
}
|
|
82
|
-
|
|
24
|
+
if (line[0] === '>') {
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
records.push({
|
|
28
|
+
line,
|
|
29
|
+
start: 0,
|
|
30
|
+
end: 0,
|
|
31
|
+
hasEscapes: line.includes('%'),
|
|
32
|
+
});
|
|
83
33
|
}
|
|
84
|
-
|
|
85
|
-
return items;
|
|
34
|
+
return parseRecords(records);
|
|
86
35
|
}
|
|
87
36
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* unescaping when hasEscapes is false.
|
|
37
|
+
* Parse an array of LineRecord objects containing raw GFF3 lines.
|
|
38
|
+
* Supports parent/child relationships.
|
|
91
39
|
*
|
|
92
|
-
* @param records - Array of LineRecord objects with
|
|
93
|
-
* @param hasEscapes - Whether the records contain percent-encoded characters
|
|
40
|
+
* @param records - Array of LineRecord objects with raw line and metadata
|
|
94
41
|
* @returns array of parsed features
|
|
95
42
|
*/
|
|
96
|
-
function
|
|
43
|
+
function parseRecords(records) {
|
|
97
44
|
const items = [];
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const featureLine = parseFunc(record.fields);
|
|
45
|
+
const byId = new Map();
|
|
46
|
+
const orphans = new Map();
|
|
47
|
+
for (let i = 0; i < records.length; i++) {
|
|
48
|
+
const record = records[i];
|
|
49
|
+
const featureLine = (record.hasEscapes
|
|
50
|
+
? (0, util_ts_1.parseFeature)(record.line)
|
|
51
|
+
: (0, util_ts_1.parseFeatureNoUnescape)(record.line));
|
|
52
|
+
featureLine.child_features = [];
|
|
53
|
+
featureLine.derived_features = [];
|
|
108
54
|
if (record.lineHash !== undefined) {
|
|
109
55
|
if (!featureLine.attributes) {
|
|
110
56
|
featureLine.attributes = {};
|
|
111
57
|
}
|
|
112
58
|
featureLine.attributes._lineHash = [String(record.lineHash)];
|
|
113
59
|
}
|
|
114
|
-
|
|
60
|
+
const attrs = featureLine.attributes;
|
|
61
|
+
const ids = attrs?.ID;
|
|
62
|
+
const parents = attrs?.Parent;
|
|
63
|
+
if (!ids && !parents) {
|
|
64
|
+
items.push([featureLine]);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
let feature;
|
|
68
|
+
if (ids) {
|
|
69
|
+
const id = ids[0];
|
|
70
|
+
const existing = byId.get(id);
|
|
71
|
+
if (existing) {
|
|
72
|
+
existing.push(featureLine);
|
|
73
|
+
feature = existing;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
feature = [featureLine];
|
|
77
|
+
if (!parents) {
|
|
78
|
+
items.push(feature);
|
|
79
|
+
}
|
|
80
|
+
byId.set(id, feature);
|
|
81
|
+
const waiting = orphans.get(id);
|
|
82
|
+
if (waiting) {
|
|
83
|
+
for (let j = 0; j < waiting.length; j++) {
|
|
84
|
+
featureLine.child_features.push(waiting[j]);
|
|
85
|
+
}
|
|
86
|
+
orphans.delete(id);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
feature = [featureLine];
|
|
92
|
+
}
|
|
93
|
+
if (parents) {
|
|
94
|
+
for (let j = 0; j < parents.length; j++) {
|
|
95
|
+
const parentId = parents[j];
|
|
96
|
+
const parent = byId.get(parentId);
|
|
97
|
+
if (parent) {
|
|
98
|
+
for (let k = 0; k < parent.length; k++) {
|
|
99
|
+
parent[k].child_features.push(feature);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
let arr = orphans.get(parentId);
|
|
104
|
+
if (!arr) {
|
|
105
|
+
arr = [];
|
|
106
|
+
orphans.set(parentId, arr);
|
|
107
|
+
}
|
|
108
|
+
arr.push(feature);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
115
112
|
}
|
|
116
|
-
parser.finish();
|
|
117
113
|
return items;
|
|
118
114
|
}
|
|
119
115
|
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";;AAmBA,0CAsBC;AASD,oCA6EC;AA/HD,uCAAgE;AAYhE;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,GAAW;IACzC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IAChC,MAAM,OAAO,GAAiB,EAAE,CAAA;IAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE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|
1
|
+
export { parseRecords, parseStringSync } from './api.ts';
|
|
3
2
|
export type { GFF3Comment, GFF3Directive, GFF3Feature, GFF3FeatureLine, GFF3FeatureLineWithRefs, GFF3Item, GFF3Sequence, LineRecord, } from './api.ts';
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseStringSync = exports.
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
Object.defineProperty(exports, "parseRecordsSync", { enumerable: true, get: function () { return api_ts_1.parseRecordsSync; } });
|
|
7
|
-
Object.defineProperty(exports, "parseRecordsSyncFast", { enumerable: true, get: function () { return api_ts_1.parseRecordsSyncFast; } });
|
|
3
|
+
exports.parseStringSync = exports.parseRecords = void 0;
|
|
4
|
+
var api_ts_1 = require("./api.js");
|
|
5
|
+
Object.defineProperty(exports, "parseRecords", { enumerable: true, get: function () { return api_ts_1.parseRecords; } });
|
|
8
6
|
Object.defineProperty(exports, "parseStringSync", { enumerable: true, get: function () { return api_ts_1.parseStringSync; } });
|
|
9
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAAwD;AAA/C,sGAAA,YAAY,OAAA;AAAE,yGAAA,eAAe,OAAA"}
|
package/dist/util.d.ts
CHANGED
|
@@ -4,21 +4,7 @@
|
|
|
4
4
|
* @param stringVal - Escaped GFF3 string value
|
|
5
5
|
* @returns An unescaped string value
|
|
6
6
|
*/
|
|
7
|
-
export declare function unescape(
|
|
8
|
-
/**
|
|
9
|
-
* Escape a value for use in a GFF3 attribute value.
|
|
10
|
-
*
|
|
11
|
-
* @param rawVal - Raw GFF3 attribute value
|
|
12
|
-
* @returns An escaped string value
|
|
13
|
-
*/
|
|
14
|
-
export declare function escape(rawVal: string | number): string;
|
|
15
|
-
/**
|
|
16
|
-
* Escape a value for use in a GFF3 column value.
|
|
17
|
-
*
|
|
18
|
-
* @param rawVal - Raw GFF3 column value
|
|
19
|
-
* @returns An escaped column value
|
|
20
|
-
*/
|
|
21
|
-
export declare function escapeColumn(rawVal: string | number): string;
|
|
7
|
+
export declare function unescape(s: string): string;
|
|
22
8
|
/**
|
|
23
9
|
* Parse the 9th column (attributes) of a GFF3 feature line.
|
|
24
10
|
*
|
|
@@ -41,6 +27,20 @@ export declare function parseAttributesNoUnescape(attrString: string): GFF3Attri
|
|
|
41
27
|
* @returns The parsed feature
|
|
42
28
|
*/
|
|
43
29
|
export declare function parseFeature(line: string): GFF3FeatureLine;
|
|
30
|
+
/**
|
|
31
|
+
* Parse a GFF3 feature line without unescaping.
|
|
32
|
+
* Fast path for data known to contain no escaped characters.
|
|
33
|
+
*
|
|
34
|
+
* @param line - GFF3 feature line
|
|
35
|
+
* @returns The parsed feature
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseFeatureNoUnescape(line: string): GFF3FeatureLine;
|
|
38
|
+
/**
|
|
39
|
+
* Parse a GFF3 feature from a pre-split fields array
|
|
40
|
+
*
|
|
41
|
+
* @param f - Array of 9 GFF3 column values (use null or '.' for empty values)
|
|
42
|
+
* @returns The parsed feature
|
|
43
|
+
*/
|
|
44
44
|
export declare function parseFieldsArray(f: (string | null | undefined)[]): GFF3FeatureLine;
|
|
45
45
|
/**
|
|
46
46
|
* Parse a GFF3 feature from a pre-split fields array without unescaping.
|
|
@@ -57,51 +57,6 @@ export declare function parseFieldsArrayNoUnescape(f: (string | null | undefined
|
|
|
57
57
|
* @returns The parsed directive
|
|
58
58
|
*/
|
|
59
59
|
export declare function parseDirective(line: string): GFF3Directive | GFF3SequenceRegionDirective | GFF3GenomeBuildDirective | null;
|
|
60
|
-
/**
|
|
61
|
-
* Format an attributes object into a string suitable for the 9th column of GFF3.
|
|
62
|
-
*
|
|
63
|
-
* @param attrs - Attributes
|
|
64
|
-
* @returns GFF3 9th column string
|
|
65
|
-
*/
|
|
66
|
-
export declare function formatAttributes(attrs: GFF3Attributes): string;
|
|
67
|
-
/**
|
|
68
|
-
* Format a feature object or array of feature objects into one or more lines of
|
|
69
|
-
* GFF3.
|
|
70
|
-
*
|
|
71
|
-
* @param featureOrFeatures - A feature object or array of feature objects
|
|
72
|
-
* @returns A string of one or more GFF3 lines
|
|
73
|
-
*/
|
|
74
|
-
export declare function formatFeature(featureOrFeatures: GFF3FeatureLine | GFF3FeatureLineWithRefs | (GFF3FeatureLine | GFF3FeatureLineWithRefs)[]): string;
|
|
75
|
-
/**
|
|
76
|
-
* Format a directive into a line of GFF3.
|
|
77
|
-
*
|
|
78
|
-
* @param directive - A directive object
|
|
79
|
-
* @returns A directive line string
|
|
80
|
-
*/
|
|
81
|
-
export declare function formatDirective(directive: GFF3Directive): string;
|
|
82
|
-
/**
|
|
83
|
-
* Format a comment into a GFF3 comment.
|
|
84
|
-
* Yes I know this is just adding a # and a newline.
|
|
85
|
-
*
|
|
86
|
-
* @param comment - A comment object
|
|
87
|
-
* @returns A comment line string
|
|
88
|
-
*/
|
|
89
|
-
export declare function formatComment(comment: GFF3Comment): string;
|
|
90
|
-
/**
|
|
91
|
-
* Format a sequence object as FASTA
|
|
92
|
-
*
|
|
93
|
-
* @param seq - A sequence object
|
|
94
|
-
* @returns Formatted single FASTA sequence string
|
|
95
|
-
*/
|
|
96
|
-
export declare function formatSequence(seq: GFF3Sequence): string;
|
|
97
|
-
/**
|
|
98
|
-
* Format a directive, comment, sequence, or feature, or array of such items,
|
|
99
|
-
* into one or more lines of GFF3.
|
|
100
|
-
*
|
|
101
|
-
* @param itemOrItems - A comment, sequence, or feature, or array of such items
|
|
102
|
-
* @returns A formatted string or array of strings
|
|
103
|
-
*/
|
|
104
|
-
export declare function formatItem(itemOrItems: GFF3FeatureLineWithRefs | GFF3Directive | GFF3Comment | GFF3Sequence | (GFF3FeatureLineWithRefs | GFF3Directive | GFF3Comment | GFF3Sequence)[]): string | string[];
|
|
105
60
|
/** A record of GFF3 attribute identifiers and the values of those identifiers */
|
|
106
61
|
export type GFF3Attributes = Record<string, string[] | undefined>;
|
|
107
62
|
/** A representation of a single line of a GFF3 file */
|