Human genome browser with Python

This tutorial shows how to create a complete human genome browser with the D3GB Python module. This example creates the genome browser and adds several tracks such as RNASeq expression, GWAS results, variants from exome sequencing samples, Variant Effect Predictor (VEP) annotations of variants, protein domains and gene annotations. Install the D3GB module and write the following code in Python 3:

import D3GB, urllib.request

# Genome browser generation.
# It creates a genome browser ready to view in a Firefox browser.
# For a server version, ready to be shared with Apache as a Website, set server=True
gwas, headers = urllib.request.urlretrieve('')
gb = D3GB.genomebrowser('GRCh37.bands', mapTrack = gwas, directory = 'HumanGenomeBrowser')

# Genes track
genes, headers = urllib.request.urlretrieve('')
gb.addTrack(genes, 'refFlat', 'exons', '#B8860B')

# PFAM track
pfam, headers = urllib.request.urlretrieve('')
gb.addTrack(pfam, 'Pfam', 'domain', '#303030')

# GWAS track
gb.addTrack(gwas, 'GWAS_Catalog', 'value', '#A52A2A', [0,100])

# Adding vep annotated vcf
vcf, headers = urllib.request.urlretrieve('')

# Adding tissue expression
for i in ('adipose_tissue', 'adrenal_gland', 'brain', 'heart', 'kidney', 'liver', 'lung', 'ovary', 'pancreas', 'sigmoid_colon', 'small_intestine', 'spleen', 'testis'):
  tissue, headers = urllib.request.urlretrieve(''+i)

# Genomic sequence loading
fasta, headers = urllib.request.urlretrieve('')

view result