Jonathan Pevsner
Bioinformatics and Functional Genomics
August, 2015

In this exercise we will use the R package GenomeGraphs in RStudio to plot the structure of the beta globin gene, and plot the position of this gene on an ideogram of chromosome 11. We will extract information from the R package biomaRt. For more information browse the GenomeGraphs vignette at the bioconductor.org website, as well as a user’s guide written by Steffen Durinck and James Bullard.

First set your working directory (it can be your desktop or anywhere else). Use getwd() to see the current working directory, and (as needed) use setwd() to change it.

getwd()
## [1] "/Users/pevsner/Documents/#3e/3e_SolutionsToProblems"
# setwd("/Users/pevsner/Documents/#3e/3e_SolutionsToProblems")

Install GenomeGraphs and open its library.

source("http://bioconductor.org/biocLite.R")
## Bioconductor version 3.0 (BiocInstaller 1.16.5), ?biocLite for help
## A new version of Bioconductor is available after installing the most
##   recent version of R; see http://bioconductor.org/install
biocLite("GenomeGraphs")
## BioC_mirror: http://bioconductor.org
## Using Bioconductor version 3.0 (BiocInstaller 1.16.5), R version 3.1.3.
## Installing package(s) 'GenomeGraphs'
## 
## The downloaded binary packages are in
##  /var/folders/r0/fsfjx2d568z9s86qrvzjr3y901v5t7/T//Rtmp0ErIwD/downloaded_packages
options(width=50)
library(GenomeGraphs)

Use biomaRt to obtain a gene structure that we will plot.

mart <- useMart("ensembl", dataset="hsapiens_gene_ensembl")
gene <- makeGene(id = "ENSG00000244734", type="ensembl_gene_id", biomart = mart)
gdPlot(gene) # save the output as Rplot1 (a .png file)

Next plot transcripts associated with this gene. Save the output as Rplot2 (a .png file).

transcript <- makeTranscript(id = "ENSG00000244734", type="ensembl_gene_id", biomart = mart)
gdPlot(list(gene, transcript))

Define the genomic region. The resulting plot has brown boxes for [exons] and genomic coordinates. Save it as Rplot3.

minusStrand <- makeGeneRegion(chromosome = 11, start = 5246696, end = 5248301, strand = "-", biomart = mart)
genomeAxis <- makeGenomeAxis(add53 = TRUE) # Add53 shows 5' and 3' ends
gdPlot(list(genomeAxis, minusStrand)) 

Add an ideogram of chromosome 11 to the plot.

minStrand <- makeGeneRegion( chromosome = 11, start = 5200000, end = 5250000, strand = "-", biomart = mart)
ideogram <- makeIdeogram(chromosome = 11)
genomeAxis <- makeGenomeAxis(add53=TRUE, add35=TRUE)
gdPlot(list(ideogram, minusStrand, genomeAxis, minStrand)) 

# save as Rplot4.png

Show the session information

sessionInfo()
## R version 3.1.3 (2015-03-09)
## Platform: x86_64-apple-darwin13.4.0 (64-bit)
## Running under: OS X 10.9.5 (Mavericks)
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] grid      stats     graphics  grDevices
## [5] utils     datasets  methods   base     
## 
## other attached packages:
## [1] GenomeGraphs_1.26.0  biomaRt_2.22.0      
## [3] BiocInstaller_1.16.5
## 
## loaded via a namespace (and not attached):
##  [1] AnnotationDbi_1.28.2 Biobase_2.26.0      
##  [3] BiocGenerics_0.12.1  bitops_1.0-6        
##  [5] codetools_0.2-14     DBI_0.3.1           
##  [7] digest_0.6.8         evaluate_0.7.2      
##  [9] formatR_1.2          GenomeInfoDb_1.2.5  
## [11] htmltools_0.2.6      IRanges_2.0.1       
## [13] knitr_1.10.5         magrittr_1.5        
## [15] parallel_3.1.3       RCurl_1.95-4.7      
## [17] rmarkdown_0.7        RSQLite_1.0.0       
## [19] S4Vectors_0.4.0      stats4_3.1.3        
## [21] stringi_0.5-5        stringr_1.0.0       
## [23] tools_3.1.3          XML_3.98-1.3        
## [25] yaml_2.1.13