Book Image

Bioinformatics with Python Cookbook - Second Edition

By : Tiago Antao
Book Image

Bioinformatics with Python Cookbook - Second Edition

By: Tiago Antao

Overview of this book

Bioinformatics is an active research field that uses a range of simple-to-advanced computations to extract valuable information from biological data. This book covers next-generation sequencing, genomics, metagenomics, population genetics, phylogenetics, and proteomics. You'll learn modern programming techniques to analyze large amounts of biological data. With the help of real-world examples, you'll convert, analyze, and visualize datasets using various Python tools and libraries. This book will help you get a better understanding of working with a Galaxy server, which is the most widely used bioinformatics web-based pipeline system. This updated edition also includes advanced next-generation sequencing filtering techniques. You'll also explore topics such as SNP discovery using statistical approaches under high-performance computing frameworks such as Dask and Spark. By the end of this book, you'll be able to use and implement modern programming techniques and frameworks to deal with the ever-increasing deluge of bioinformatics data.
Table of Contents (16 chapters)
Title Page
About Packt
Contributors
Preface
Index

Deploying a variant analysis pipeline with Airflow


Here, we will develop a mini variant analysis pipeline with Airflow. The objective here is not to get the scientific part right—we cover that in other chapters—but to see how to create components with Airflow. Our mini-pipeline will download HapMap data, sub-sample at 1% and 10%, do a simple PCA, and draw it.

 

Getting ready

You will need PLINK installed. Remember that we are not using a conda environment, so you have to make sure it is available for Airflow. We will define the following tasks:

  1. Downloading data
  2. Uncompressing it
  3. Sub-sampling at 10%
  4. Sub-sampling at 1%
  5. Computing PCA on the 1% sub-sample
  6. Charting the PCA

Our pipeline recipe will have two parts: the actual coding of the pipeline and making the pipeline actually execute.

The code for this can be found on Chapter08/pipelines/airflow/create_tasks.py.

How to do it…

  1. With Airflow, a pipeline specification is written in Python, which is quite convenient for us! Let's start with the import part:
from...