How To Install libhts2 on Ubuntu 18.04

In this tutorial we learn how to install libhts2 on Ubuntu 18.04. libhts2 is C library for high-throughput sequencing data formats

Introduction

In this tutorial we learn how to install libhts2 on Ubuntu 18.04.

What is libhts2

libhts2 is:

HTSlib is an implementation of a unified C library for accessing common file formats, such as SAM (Sequence Alignment/Map), CRAM and VCF (Variant Call Format), used for high-throughput sequencing data, and is the core library used by samtools and bcftools. HTSlib only depends on zlib. It is known to be compatible with gcc, g++ and clang.

HTSlib implements a generalized BAM (binary SAM) index, with file extension ‘csi’ (coordinate-sorted index). The HTSlib file reader first looks for the new index and then for the old if the new index is absent.

There are three methods to install libhts2 on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install libhts2 Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install libhts2 using apt-get by running the following command:

sudo apt-get -y install libhts2

Install libhts2 Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install libhts2 using apt by running the following command:

sudo apt -y install libhts2

Install libhts2 Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install libhts2 using aptitude by running the following command:

sudo aptitude -y install libhts2

How To Uninstall libhts2 on Ubuntu 18.04

To uninstall only the libhts2 package we can use the following command:

sudo apt-get remove libhts2

Uninstall libhts2 And Its Dependencies

To uninstall libhts2 and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove libhts2

Remove libhts2 Configurations and Data

To remove libhts2 configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge libhts2

Remove libhts2 configuration, data, and all of its dependencies

We can use the following command to remove libhts2 configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge libhts2

References

Summary

In this tutorial we learn how to install libhts2 package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.