npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

genomediff

v1.7.1

Published

Parses strings from files in the GenomeDiff format generated by the breseq variant caller for haploid microbial organisms.

Downloads

75

Readme

Genomediff

Travis build status Dependency Status

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 it will return all properties and records.

For accessing all the records you can use GenomeDiff.parse('<string>').values() which returns an iterable but only with the Record types.

For accessing the parents of a specific mutation you can use the parents property available on each record:

let doc = GenomeDiff.parse('<string>'); // a genomediff string
let someMutation = doc[12]; // mutation with id '12'
someMutation.parents // this will lookup all the parents of the record with id `12` and return as an array of Records

If you want to get an attribute from a parent record then you can use the .get(<attribute>) method available on the record to do so:

let doc = GenomeDiff.parse('<string>'); // a genomediff string
let someMutation = doc[12]; // mutation with id '12'
someMutation.get('coverage') // this will lookup all the parents of the record with id `12` and return the value of the attribute `coverage` if found on any of the parent records

If used with node, you can use the following:

var GenomeDiff = require('genomediff').GenomeDiff;
var fs = require('fs');
var file = fs.readFileSync('<path>', "utf8"); // path to your `.gd` file
var doc = GenomeDiff.parse(file);

If used in a browser, use:

import {GenomeDiff} from 'genomediff';
var doc = GenomeDiff.parse('<string>'); // a genomediff 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. Alternatively, you can use npm run build if you do not wish to run the build on file change.

Note: If you add new files or remove files, make sure to edit the "files" field in tsconfig.json:

"files": [
	"./typings/typings.d.ts", // never remove this line
	// add more files after this line
	"./src/parser.ts",
	"./src/parser.spec.ts",
	"./src/records.ts",
	"./src/records.spec.ts",
	"./src/gd.ts",
	"./src/gd.spec.ts"
]