Skip to content

A simple module for diagnostic variant information parsing

License

Notifications You must be signed in to change notification settings

qbicsoftware/mtb-parser-lib

Repository files navigation

qbic.mtbparser

GitHub top language Build status codecov GitHub tag PyPI license

A simple module that provides parser for different diagnostic variant information as part of the Molecular Tumor Board data provisioning in Tübingen.

Documentation

File formats for

Python class info

  • SnvParser

How to use the SnvParser class

Parsing a SNV file following the formats described above is fairly simple. Just create an SnvParser object with the path to the tsv-file and specify its type by providing the correct header (SSnvHeader, GSnvHeader, ...).

from mtbparser.snv_parser import SnvParser
from mtbparser.snv_utils import SSnvHeader

# Path to a valid SNV tsv file, as specified in
# the file format documentation.
somatic_snv_file = "/path/to/mySSnv.tsv"

# Create parser object for somatic SNVs
parser = SnvParser(somatic_snv_file, SSnvHeader)

# Iterate through parsed SNV items and get the gene name
for snv_item in parser.getSNVs():
    print(snv_item.get_snv_info(SSnvHeader.GENE.name))
    

Author

This code implementation was done at the Quantitative Biology Center. Please contact the author @sven1103 for more information.

Changelog

v0.2.7

Rename enums, so their names and values are equal.

v0.2.6

You can now extract a copy of the complete SNV Item information as dictionary.

v0.2.5

Bugfix: parsing of empty first columns failed because of the usage of strip() function. Columns can be empty, if they contain no information, so trimming whitespaces leads to a wrong total column number. We use rstrip() now, to remove escape characters and trailing whitespaces.

v0.2.4

Fixed typo in 'tumor_content' definition in the metadata section.

v0.2.3

Just v0.2.2, but had to rename the version on PyPi

v0.2.2

Reading of files failed, because Python expects ACII encoding by default. Now, files are explicitely opened with utf-8 encoding.

v0.2.1

Installation with pip failed, because the DESCRIPTION.rst for the module description was not provided in the sdist package.

v0.2

The first production-ready version of mtbparser, that is also deployed on PyPI. Only updated documentation and proper formatting for PyPI deployment.

v0.1dev

A first develeopment version, should work, tests are good, coverage > 90%.