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: 18 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 (over 4 years ago)
- Default Branch: develop
- Last Pushed: 2023-08-03T14:43:53.000Z (almost 2 years ago)
- Last Synced: 2025-06-09T13:09:01.175Z (27 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: 5
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GraphKB Parser
[](https://codecov.io/gh/bcgsc/pori_graphkb_parser)  [](https://badge.fury.io/js/%40bcgsc-pori%2Fgraphkb-parser) 
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.