Skip to Content
Bioinformatics with Python Cookbook - Second Edition
book

Bioinformatics with Python Cookbook - Second Edition

by Tiago Antao
November 2018
Intermediate to advanced
360 pages
9h 36m
English
Packt Publishing
Content preview from Bioinformatics with Python Cookbook - Second Edition

How to do it...

Let's take a look at the following steps:

  1. Let's start by creating an annotation database with gffutils, based on our GFF file:
import gffutilsimport sqlite3try:    db = gffutils.create_db('gambiae.gff.gz', 'ag.db')except sqlite3.OperationalError:db = gffutils.FeatureDB('ag.db')

The gffutils library creates a SQLite database to store annotations efficiently. Here, we will try to create the database, but if it already exists, we will use the existing one. This step can be time-consuming.

  1. Now, we will list all the available feature types and count them:
print(list(db.featuretypes()))for feat_type in db.featuretypes():    print(feat_type, db.count_features_of_type(feat_type))

These features will include contigs, genes, exons, transcripts, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Bioinformatics with Python Cookbook

Bioinformatics with Python Cookbook

Tiago Antao

Publisher Resources

ISBN: 9781789344691Supplemental Content