Python and C++ code for reading and writing genomics data.
Switch branches/tags
Nothing to show
Clone or download
Genomics team in Google Brain Copybara-Service
Genomics team in Google Brain and Copybara-Service TensorFlow 1.11 requires more up to date versions of keras packages.
PiperOrigin-RevId: 224563516
Latest commit 55c5afa Dec 7, 2018


Nucleus is a library of Python and C++ code designed to make it easy to read, write and analyze data in common genomics file formats like SAM and VCF. In addition, Nucleus enables painless integration with the TensorFlow machine learning framework, as anywhere a genomics file is consumed or produced, a TensorFlow tfrecords file may be used instead.


Which of these would most increase your usage of Nucleus? (Click on an option to vote on it.)


Nucleus currently only works on modern Linux systems. To install it, just run

pip install --user google-nucleus


Building from source

For Ubuntu 14, Ubuntu 16 and Debian 9 systems, building from source is easy. Simply type


For all other systems, you will need to first install CLIF by following the instructions at before running

Note that extensively depends on apt-get, so it is unlikely to run without extensive modifications on non-Debian-based systems.

Nucleus depends on TensorFlow. By default, will install a CPU-only version of a stable TensorFlow release (currently 1.11). If that isn't what you want, there are several other options that can be enabled with a simple edit to

Running will build all of Nucleus's programs and libraries. You can find the generated binaries under bazel-bin/nucleus. If in addition to building Nucleus you would like to run its tests, execute

bazel test -c opt $COPT_FLAGS nucleus/...


This is Nucleus 0.2.1. Nucleus follows semantic versioning.

New in 0.2.1:

  • Upgrades htslib dependency from 1.6 to 1.9.
  • Minor VCF parsing fixes.
  • Added new example program, apply_genotyping_prior.
  • Slightly more robust pip package.

New in 0.2.0:

  • Support for reading and writing BedGraph files.
  • Support for reading and writing GFF files.
  • Support for reading and writing CRAM files.
  • Support for writing SAM/BAM files.
  • Support for reading unindexed FASTA files.
  • Iteration support for indexed FASTA files.
  • Ability to read VCF files from memory.
  • Python API documentation.
  • Python 3 compatibility.
  • Added universal file converter example program.


Nucleus is licensed under the terms of the Apache 2 license.


The Genomics team in Google Brain actively supports Nucleus and are always interested in improving its quality. If you run into an issue, please report the problem on our Issue tracker. Be sure to add enough detail to your report that we can reproduce the problem and fix it. We encourage including links to snippets of BAM/VCF/etc files that provoke the bug, if possible. Depending on the severity of the issue we may patch Nucleus immediately with the fix or roll it into the next release.


Interested in contributing? See CONTRIBUTING.


Nucleus grew out of the DeepVariant project.


This is not an official Google product.