Genomediff
Parses strings from files in the GenomeDiff format generated by the breseq variant caller for haploid microbial organisms.
Installation
$(node bin)/npm install genomediff
Note: It has only been tested with Node 5.
Usage
GenomeDiff strings are parsed using GenomeDiff.parse(<string>)
. The GenomeDiff object contains a metadata
dict with the meta data, as well as mutations
, evidence
and validation
lists, each containing records of that type. Records can be accessed through this list or by id using GenomeDiff.parse(<string>)[<id>]
. GenomeDiff is an iterable and iterating will return all records of all types.
For accessing the parents of a specific mutation you can use the .parents(<id>)
method available on the document returned from GenomeDiff.parse(<string>)
:
let doc = GenomeDiff.parse('<string>');
doc.parents('<id>')
If used with node, you can use the following:
var GenomeDiff = require('genomediff').GenomeDiff;
var fs = require('fs');
var file = fs.readFileSync('<path>', "utf8");
var doc = GenomeDiff.parse(file);
If used in a browser, use:
import {GenomeDiff} from 'genomediff';
var doc = GenomeDiff.parse('<string>');
Note: Keep in mind that this package requires an ES6 environment in order to work.
Running Tests
A full test suite can be run using npm test
. If you wish to run tests on file change, use jasmine-node dist/ --autotest --color --verbose
.
Development
When developing, use tsc --watch
to build the .ts
files on change.
Note: If you add new files or remove files, make sure to edit the "files"
field in tsconfig.json
:
"files": [
"./tsd_typings/tsd.d.ts",
"./src/parser.ts",
"./src/parser.spec.ts",
"./src/records.ts",
"./src/records.spec.ts",
"./src/gd.ts",
"./src/gd.spec.ts"
]