Convert .vcf files to HL7 FHIR standard
Project description
VCF to FHIR Converter
Introduction
VCF-formatted files are the lingua franca of next-generation sequencing, whereas HL7 FHIR is emerging as a standard language for electronic health record interoperability. A growing number of clinical genomics applications are emerging, based on the HL7 FHIR Genomics standard. Here, we provide an open source utility for converting variants from VCF format into HL7 FHIR Genomics format. Details of the translation logic are on the manual page. Additional information and case studies are described in our BMC Bioinformatics article. Conceptually, the utility takes a VCF as input and outputs a FHIR Genomics report.
Install
Before installing vcf2fhir you need to install cython and wheel.
pip install cython wheel
Now, install vcf2fhir binary from pip.
pip install vcf2fhir
Quick Examples
(some sample VCF files are here)
>>> import vcf2fhir
>>> vcf_fhir_converter = vcf2fhir.Converter('sample.vcf', 'GRCh37')
>>> vcf_fhir_converter.convert()
Logging
You can use python standard logging to enable logs. Two loggers ('vcf2fhir.general') and ('vcf2fhir.invalidrecord') are available to configure.
- vcf2fhir.general: standard library logs.
- vcf2fhir.invalidrecord: logs all the records from vcf file which are in conversion region but are not converted to fhir format.
>>> import logging
# create logger
>>> logger = logging.getLogger('vcf2fhir.invalidrecord')
>>> logger.setLevel(logging.DEBUG)
# create console handler and set level to debug
>>> ch = logging.FileHandler('invalidrecord.log')
>>> ch.setLevel(logging.DEBUG)
# create formatter
>>> formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# add formatter to ch
>>> ch.setFormatter(formatter)
# add ch to logger
>>> logger.addHandler(ch)
Documentation
You can find the detailed documantation of the package on the official website here.
Scope
Software converts simple (SNV, MNV, Indel) and structural (CNV, DEL, DUP, INV, INS) variants from VCF to FHIR format. Clinical annotations, where supplied, are incorporated into the FHIR representation.
- Not supported
- Alt contigs: Software does not support conversion of variants aligned to Alt contigs. We recommend caution in using this software against VCFs generated with an alternate-locus aware variant caller, as variants mapped to Alt contigs will not be converted.
- Query liftover: Software assumes that regions (e.g. conversion region, studied region) and VCF are based on the same genomic build.
- Chromosome synonyms (e.g. '1' vs. 'chr1'): Software assumes that chromosome representation is consistent between regions (e.g. in BED files) and VCF. For instance, if VCF uses 'chr1', then BED file must also use 'chr1'
License and Limitations
Software is available for use under an Apache 2.0 license, and is intended solely for experimental use, to help further Genomics-EHR integration exploration. Software is expressly not ready to be used with identifiable patient data or in delivering care to patients. Code issues should be tracked here. Comments and questions can also be directed to info@elimu.io or srikarchamala@gmail.com.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file vcf2fhir-0.1.1.tar.gz
.
File metadata
- Download URL: vcf2fhir-0.1.1.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6135d66369faa17a7fa94e787619d15caf9317919594e526c05c24c4bc25cf4 |
|
MD5 | 1adb69e52c3ead9157ade70a2562fcff |
|
BLAKE2b-256 | 4c9fafdd30dc74e17eaab4c1c71178ab1b0f05b9e13dd93b6ff194d8618fa000 |
File details
Details for the file vcf2fhir-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: vcf2fhir-0.1.1-py3-none-any.whl
- Upload date:
- Size: 26.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 548a790a1dba7b1f16d5eacae8f42edba1cabcc57139520aa43c9c840cf66665 |
|
MD5 | 4f1d05626699a6fd75333d0e47635014 |
|
BLAKE2b-256 | ace3487d5fdb528d90ee81cfeacd9c37401da496e4a7a899f8f87211e3536f8a |