Bio::ToolBox - Tools for querying and analysis of genomic data


The Bio::ToolBox libraries provide a useful interface for working with bioinformatic data. Many bioinformatic data analysis revolves around working with tables of information, including lists of genomic annotation (genes, promoters, etc.) or defined regions of interest (epigenetic enrichment, transcription factor binding sites, etc.). This library works with these tables and provides a set of common tools for working with them.

  • Opening and saving common tab-delimited text formats

  • Support for BED, GFF, VCF, narrowPeak files

  • Scoring intervals and annotation with datasets from microarray or sequencing experiments, including ChIPSeq, RNASeq, and more

  • ChIPSeq, RNASeq, microarray expression

  • Support for Bam, BigWig, BigBed, wig, and USeq data formats

  • Works with any genomic annotation in GTF, GFF3, and UCSC formats

The libraries provide a unified and integrated approach to analyses. In many cases, they provide an abstraction layer over a variety of different specialized BioPerl and related modules. Instead of writing numerous scripts specialized for each data format (wig, bigWig, Bam), one script can now work with any data format.


The libraries and modules are available to extend existing scripts or to write your own.


This is the primary library module for working with a table of data, either generated as a new list from a database of annotation, or opened from a tab-delimited text file, for example a BED file of regions. Columns and rows of data may be added, deleted, or manipulated with ease.

Additionally, genomic data may be collected from a wide variety of sources using the information in the data table. For example, scoring microarray or sequencing data for each interval listed in the data table.

This module uses an object-oriented interface. Many of the methods and API will be familiar to users of Bio::Perl.


This is the object class for working with individual rows in a table of data. It provides a number of conventions for working with the rows in a standard fashion, for example returning the start column value regardless of which column it is or whether the table is bed or gff or an arbitrary text file. A number of convenience methods are present for collecting data from data files. This module is not used directly by the user, but its objects are returned when using Bio::ToolBox::Data iterators.

Annotation parsers

Included are two generic parsers for loading an entire genome-worth of annotation into memory within a reasonably short amount of time.


This parses both GTF and GFF3 file formats. Unlike many other GFF parsers that work line-by-line only, this maintains parent and child hierarchical relationships as parent feature and child subfeatures. To further maintain control and reduce unnecessary parsing, unwanted feature types can be selectively skipped.


This parses various UCSC file formats, including different refFlat, GenePred, and knownGene flavors. Genes, transcripts, and exons are assembled into hierarchical child-parent relationships as desired.


This is a fast, lean, simple object class for representing genomic features. It supports, for the most part, the Bio::SeqFreatureI and Bio::RangeI API interface without the dependencies. It uses an unorthodox blessed-array object structure, which provides measurable improvements in memory consumption and speed when loading thousands of annotated SeqFeature objects (think hg19 or hg38 annotation).


This is a collection of exportable functions for working with Bio::SeqFeatureI compliant objects representing genes and transcripts. It works with objects derived from one of the "Annotation parsers" or a Bio::DB::SeqFeature::Store database. The functions make hard things easy, such as identifying whether a transcript is coding or not (is it encoded in the primary_tag or source_tag or GFF attribute or does it have CDS subfeatures?), or identify the alternative exons or introns of a multi-transcript gene, or pull out the 5' UTR (which is likely not explicitly defined in the table).


The BioToolBox package comes complete with a suite of high-quality production-ready scripts ready for a variety of analyses. Look in the scripts folder for details. A sampling of what can be done include the following:

  • Annotated feature collection and selection

  • Data collection and scoring for features

  • Data file format manipulation and conversion

  • Low-level processing of sequencing data into customizable wig representation

    Scripts have built-in documentation. Execute the script without any options to print a synopsis of available options, or add --help to print the full documentation.


This module provides a handful of commonly used convenience methods as entry points to working with data files. Most of them use or return a Bio::ToolBox::Data object.



Open a tab-delimited text file as a Bio::ToolBox::Data object. Simply pass the file path as a single argument. It assumes the first row is the column headers, and comment lines begin with #. Compressed files are transparently handled. See the Bio::ToolBox::Data new method for more details or options.

  $Data = Bio::ToolBox->load_file('myfile.txt');

Parse an annotation file, such as BED, GTF, GFF3, UCSC genePred or refFlat file, into a Bio::ToolBox::Data table. Each row in the resulting table is linked to a parsed SeqFeature gene object. See the Bio::ToolBox::Data new method for more details or options. Default options include parsing subfeatures (exon, cds, and utr) and simple GFF attributes.

  $Data = Bio::ToolBox->parse_file('genes.gtf.gz');

Generate a new, empty Bio::ToolBox::Data table with the given column names. Pass the names of the columns in the new table.

  $Data = Bio::ToolBox->new_data( qw(Name ID Score) );

Open a generic file handle for reading. It transparently handles compression as necessary. Returns an IO::File object. Pass the file path as an argument.

  $fh = Bio::ToolBox->open_file('mydata.txt.gz');

Open a generic file handle for writing. It transparently handles compression as necessary based on filename extension or passed options. It will use the pigz multi-threaded, external, compression utility if available. See the open_to_write_fh method in <Bio::ToolBox::Data::file> for more information.

  $fh = Bio::ToolBox->write_file('mynewdata.txt.gz');

Open a binary database file, including Bam, bigWig, bigBed, Fasta, Bio::DB::SeqFeature::Store SQLite file or named MySQL connection, USeq file, or any other supported binary or indexed file formats. Database type is transparently and automatically checked by looking for common file extensions, if present. See the open_db_connection in Bio::ToolBox::db_helper for more information.

  $db = Bio::ToolBox->open_database($database);


Source code for the Bio::ToolBox package is maintained at

Bugs and issues should be submitted at


Bio::Perl, Bio::DB::SeqFeature::Store, Bio::SeqFeatureI, Bio::DB::BigWig, Bio::DB::BigBed, Bio::DB::Sam, Bio::DB::HTS, Bio::DB::USeq, Bio::ViennaNGS


 Timothy J. Parnell, PhD
 Dept of Oncological Sciences
 Huntsman Cancer Institute
 University of Utah
 Salt Lake City, UT, 84112


This package is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.