D3GB from Fasta and GFF files in Python

This tutorial shows how to create a D3GB genome browser from GFF and Fasta files with the Python module. This will create a complete genome browser of Saccharomyces cerevisiae. Install the D3GB module and write the following code in Python 3:

import D3GB, urllib.request

# Download fasta file
fasta, headers = urllib.request.urlretrieve('ftp://ftp.ensembl.org/pub/release-84/fasta/saccharomyces_cerevisiae/dna/Saccharomyces_cerevisiae.R64-1-1.dna.toplevel.fa.gz')

# Genome browser generation.
# It creates a genome browser ready to be viewed in Firefox.
# For a server version, ready to be shared with Apache as a Website, set the parameter server=True
gb = D3GB.genomebrowser((fasta,),directory='saccharomyces_genomebrowser')

gb.addSequence(fasta)

# Download gff file and add to the genome browser
gff, headers = urllib.request.urlretrieve('ftp://ftp.ensembl.org/pub/release-84/gff3/saccharomyces_cerevisiae/Saccharomyces_cerevisiae.R64-1-1.84.gff3.gz')

gb.addGFF(gff)


view result