Usage¶
This package provides a command line interface.
Syntax check¶
To only check if a description can be successfully parsed.
$ mutalyzer_hgvs_parser 'NG_012337.1(SDHD_v001):c.274G>T'
Successfully parsed:
NG_012337.1(SDHD_v001):c.274G>T
Description model¶
To obtain the model of a description add the -c flag.
$ mutalyzer_hgvs_parser -c 'NG_012337.1(SDHD_v001):c.274G>T'
{
"reference": {
"id": "NG_012337.1",
"selector": {
"id": "SDHD_v001"
}
},
"coordinate_system": "c",
"variants": [
{
"type": "substitution",
"source": "reference",
"location": {
"type": "point",
"position": 274
},
"deleted": [
{
"source": "description",
"sequence": "G"
}
],
"inserted": [
{
"source": "description",
"sequence": "T"
}
]
}
]
}
Parsing a partial description¶
By default the parser expects a complete HGVS description
(e.g. NG_012337.1:g.274G>T). If you only have a part of a
description — a bare variant, a location, or a reference — you can tell
the parser where to start by passing a start rule with the -r
option.
A start rule is the name of the grammar rule that the input must match.
The most useful alternatives to the default (description) are:
Start rule |
Matches |
|---|---|
|
A complete HGVS description (default) |
|
A single variant without a reference, e.g. |
|
A semicolon-separated list of variants, e.g. |
|
A position or range, e.g. |
|
A reference identifier, e.g. |
|
An inserted sequence, e.g. |
$ mutalyzer_hgvs_parser -r variant '274G>T'
Successfully parsed:
274G>T
The -c flag can be combined with -r to convert a partial
description to its model.
$ mutalyzer_hgvs_parser -c -r variant '274G>T'
{
"location": {
"type": "point",
"position": 274
},
"type": "substitution",
"source": "reference",
"deleted": [
{
"sequence": "G",
"source": "description"
}
],
"inserted": [
{
"sequence": "T",
"source": "description"
}
]
}
Parse tree representation¶
An image of the parse tree can be obtained with the -i option.
This requires Graphviz to be installed on your system (e.g.
apt install graphviz on Debian/Ubuntu) and pydot:
pip install mutalyzer-hgvs-parser[plot]
$ mutalyzer_hgvs_parser "274del" -r variant -i tree.png
Successfully parsed:
274del
Parse tree image saved to:
tree.png