Parse GFF3 data. A simplified version of @gmod/gff with no Node.js stream dependency.
$ npm install gff-nostream
import { parseStringSync } from 'gff-nostream'
import fs from 'fs'
const stringOfGFF3 = fs.readFileSync('my_annotations.gff3', 'utf8')
const features = parseStringSync(stringOfGFF3)In GFF3, features can have more than one location. Features are returned as arrays of all lines sharing the same ID. Values that are . in GFF3 are null in the output.
A simple feature located in one place:
[
{
"seq_id": "ctg123",
"source": null,
"type": "gene",
"start": 1000,
"end": 9000,
"score": null,
"strand": "+",
"phase": null,
"attributes": {
"ID": ["gene00001"],
"Name": ["EDEN"]
},
"child_features": [],
"derived_features": []
}
]A CDS called cds00001 located in two places:
[
{
"seq_id": "ctg123",
"source": null,
"type": "CDS",
"start": 1201,
"end": 1500,
"score": null,
"strand": "+",
"phase": "0",
"attributes": {
"ID": ["cds00001"],
"Parent": ["mRNA00001"]
},
"child_features": [],
"derived_features": []
},
{
"seq_id": "ctg123",
"source": null,
"type": "CDS",
"start": 3000,
"end": 3902,
"score": null,
"strand": "+",
"phase": "0",
"attributes": {
"ID": ["cds00001"],
"Parent": ["mRNA00001"]
},
"child_features": [],
"derived_features": []
}
]Synchronously parse a GFF3 string and return an array of features.
Synchronously parse a GFF3 string and return features in JBrowse format (flat objects with subfeatures instead of child_features).
Parse an array of LineRecord objects. Useful when managing raw line data directly (e.g. from an indexed file with byte offsets).
Same as parseRecords but returns JBrowse-format features.
Trusted publishing via GitHub Actions.
npm version patch # or minor/major