Book Image

Bioinformatics with Python Cookbook

By : Tiago R Antao, Tiago Antao
Book Image

Bioinformatics with Python Cookbook

By: Tiago R Antao, Tiago Antao

Overview of this book

Table of Contents (16 chapters)
Bioinformatics with Python Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Accessing the Global Biodiversity Information Facility


The Global Biodiversity Information Facility (GBIF), http://www.gbif.org, makes the available information about biodiversity in a programmatic friendly way using a REST API. In GBIF, we will find evidence for occurrence of species across the planet and much of this information is geo-referenced.

In this recipe, we will concentrate on two types of GBIF information: species and occurrences. Species are actually a more general taxonomic framework and occurrences record observations of species.

In this recipe, we will try to extract the biodiversity information related to bears. You can find this content in the 07_Other/GBIF.ipynb notebook.

How to do it...

Take a look at the following steps:

  1. First, let's define a function to get the data on REST, as shown in the following code:

    from __future__ import print_function
    import requests
    def do_request(service, a1=None, a2=None, a3=None, **kwargs):
        server = 'http://api.gbif.org/v1'
        params = ...