Skip to main content

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 variants (SNVs, Indels), along with zygosity and phase relationships, for autosomes, sex chromosomes, and mitochondrial DNA.

  • Not supported
    • Structural variants: Software does not support conversion of structural variants (where INFO.SVTYPE is present).
    • 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 (conversion region, studied region, noncallable 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.

Metadata

Release files for vcf2fhir-test-517 0.0.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vcf2fhir-test-517 0.0.17
File Size Uploaded
vcf2fhir_test_517-0.0.17.tar.gz 21.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vcf2fhir-test-517 0.0.17
File Interpreter ABI Platform
vcf2fhir_test_517-0.0.17-py3-none-any.whl Python 3 none any Details

Total release size: 42.7 kB

Release files / vcf2fhir_test_517-0.0.17.tar.gz

Download URL vcf2fhir_test_517-0.0.17.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
123acdb304c1d5b613221880a6d2f78eb76f74fe8577d15310219891209b5120
BLAKE2b-256 checksum
How to use checksums
58751b4367c2986d6e6a396c364561fbb66282c2cb585b546e56d70711272baf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.6.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

Release files / vcf2fhir_test_517-0.0.17-py3-none-any.whl

Download URL vcf2fhir_test_517-0.0.17-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e55c5c8838e9886830a64dfef0134891df4fa9ec9b122c7be14f1c41544367f1
BLAKE2b-256 checksum
How to use checksums
151f7468ae1386580acc1f2d747f68a3725bc6d4cc5b9f932fccd007c13368ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.6.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.0.17 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page