elimuinformatics / vcf2fhir

vcf2fhir: a utility to convert VCF files into HL7 FHIR format for genomics-EHR integration
Apache License 2.0
37 stars 24 forks source link
fhir hl7 vcf

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.

>>> 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.

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.