Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bcgsc/pori_graphkb_parser
A package for parsing and recreating HGVS-like variant notation used in GraphKB
https://github.com/bcgsc/pori_graphkb_parser
genomics knowledge-base personalized-medicine pori variant-notation
Last synced: 7 days ago
JSON representation
A package for parsing and recreating HGVS-like variant notation used in GraphKB
- Host: GitHub
- URL: https://github.com/bcgsc/pori_graphkb_parser
- Owner: bcgsc
- License: gpl-3.0
- Created: 2020-12-17T19:23:10.000Z (almost 4 years ago)
- Default Branch: develop
- Last Pushed: 2023-08-03T14:43:53.000Z (over 1 year ago)
- Last Synced: 2024-10-28T22:17:28.235Z (18 days ago)
- Topics: genomics, knowledge-base, personalized-medicine, pori, variant-notation
- Language: TypeScript
- Homepage: https://bcgsc.github.io/pori
- Size: 1.43 MB
- Stars: 4
- Watchers: 6
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GraphKB Parser
[![codecov](https://codecov.io/gh/bcgsc/pori_graphkb_parser/branch/master/graph/badge.svg?token=D3IG5YL6JT)](https://codecov.io/gh/bcgsc/pori_graphkb_parser) ![build](https://github.com/bcgsc/pori_graphkb_parser/workflows/build/badge.svg?branch=master) [![npm version](https://badge.fury.io/js/%40bcgsc-pori%2Fgraphkb-parser.svg)](https://badge.fury.io/js/%40bcgsc-pori%2Fgraphkb-parser) ![node versions](https://img.shields.io/badge/node-12%20%7C%2014%20%7C%2016-blue)
This repository is part of the [platform for oncogenomic reporting and interpretation](https://github.com/bcgsc/pori).
- [About](#about)
- [Getting Started](#getting-started)## About
The GraphKB parser is a node module for parsing variant notation and producing strings from
parsed notation.## Getting Started
Import the package (Or try it out online with [RunKit](https://runkit.com/creisle/6083062ff39ff0001b93ea6f))
```js
const {parseVariant, stringifyVariant, jsonifyVariant} = require('@bcgsc-pori/graphkb-parser');
```To use the variant parser methods simply pass a string into
```js
> const parsedResult = parseVariant('FEATURE:p.G12D');
{
'prefix': 'p',
...
}
```Which returns a variant notation object. This can be turned back into a string
```js
> stringifyVariant(parsedResult);
'FEATURE:p.G12D'
```or a JSON (removes extra attributes used by parse methods)
```js
> jsonifyVariant(parsedResult)
```If the notation is improperly formatted, the parse function will raise a parsing error
```js
try {
const parsedResult = parseVariant('FEATUREp.G12D');
} catch (err) {
if (err instanceof kbp.error.ParsingError) {
console.log('Error in parsing the notation');
}
}
```See [notation](doc/notation.md) for information regarding the notation syntax.