Authors: Martin Morgan (mtmorgan@fhcrc.org), Sonali Arora (sarora@fredhutch.org)
Date: 15 June, 2015
Back: Monday labs
Analysis and comprehension of high-throughput genomic data
AnnotationHub
landing page references HOW-TO vignette illustrating some fun use cases.Load the Biostrings and GenomicRanges package
library(Biostrings)
library(GenomicRanges)
?GRanges
, and in vignettes, e.g., vignette(package="GenomicRanges")
, vignette("GenomicRangesIntroduction")
methods(class="GRanges")
to find out what one can do with a GRanges
instance, and methods(findOverlaps)
for classes that the findOverlaps()
function operates on.getClass()
, getMethod()
?findOverlaps,<tab>
to select help on a specific method, ?GRanges-class
for help on a class.library(Biostrings) # Biological sequences
data(phiX174Phage) # sample data, see ?phiX174Phage
phiX174Phage
## A DNAStringSet instance of length 6
## width seq names
## [1] 5386 GAGTTTTATCGCTTCCATGACGCAGAAGTTAAC...TTCGATAAAAATGATTGGCGTATCCAACCTGCA Genbank
## [2] 5386 GAGTTTTATCGCTTCCATGACGCAGAAGTTAAC...TTCGATAAAAATGATTGGCGTATCCAACCTGCA RF70s
## [3] 5386 GAGTTTTATCGCTTCCATGACGCAGAAGTTAAC...TTCGATAAAAATGATTGGCGTATCCAACCTGCA SS78
## [4] 5386 GAGTTTTATCGCTTCCATGACGCAGAAGTTAAC...TTCGATAAAAATGATTGGCGTATCCAACCTGCA Bull
## [5] 5386 GAGTTTTATCGCTTCCATGACGCAGAAGTTAAC...TTCGATAAAAATGATTGGCGTATCCAACCTGCA G97
## [6] 5386 GAGTTTTATCGCTTCCATGACGCAGAAGTTAAC...TTCGATAAAAATGATTGGCGTATCCAACCTGCA NEB03
m <- consensusMatrix(phiX174Phage)[1:4,] # nucl. x position counts
polymorphic <- which(colSums(m != 0) > 1)
m[, polymorphic]
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
## A 4 5 4 3 0 0 5 2 0
## C 0 0 0 0 5 1 0 0 5
## G 2 1 2 3 0 0 1 4 0
## T 0 0 0 0 1 5 0 0 1
methods(class=class(phiX174Phage)) # 'DNAStringSet' methods
vignette(package="Biostrings")
. Add another argument to the vignette
function to view the ‘BiostringsQuickOverview’ vignette.The following code loads some sample data, 6 versions of the phiX174Phage genome as a DNAStringSet object.
library(Biostrings)
data(phiX174Phage)
Explain what the following code does, and how it works
m <- consensusMatrix(phiX174Phage)[1:4,]
polymorphic <- which(colSums(m != 0) > 1)
mapply(substr, polymorphic, polymorphic, MoreArgs=list(x=phiX174Phage))
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
## Genbank "G" "G" "A" "A" "C" "C" "A" "G" "C"
## RF70s "A" "A" "A" "G" "C" "T" "A" "G" "C"
## SS78 "A" "A" "A" "G" "C" "T" "A" "G" "C"
## Bull "G" "A" "G" "A" "C" "T" "A" "A" "T"
## G97 "A" "A" "G" "A" "C" "T" "G" "A" "C"
## NEB03 "A" "A" "A" "G" "T" "T" "A" "G" "C"
This very open-ended topic points to some of the most prominent Bioconductor packages for sequence analysis. Use the opportunity in this lab to explore the package vignettes and help pages highlighted below; many of the material will be covered in greater detail in subsequent labs and lectures.
Basics
library(GenomicRanges)
help(package="GenomicRanges")
vignette(package="GenomicRanges")
vignette(package="GenomicRanges", "GenomicRangesHOWTOs")
?GRanges
Domain-specific analysis – explore the landing pages, vignettes, and reference manuals of two or three of the following packages.
Working with sequences, alignments, common web file formats, and raw data; these packages rely very heavily on the IRanges / GenomicRanges infrastructure that we will encounter later in the course.
?consensusMatrix
, for instance. Also check out the BSgenome package for working with whole genome sequences, e.g., ?"getSeq,BSgenome-method"
?readGAlignments
help page and vigentte(package="GenomicAlignments", "summarizeOverlaps")
import
and export
functions can read in many common file types, e.g., BED, WIG, GTF, …, in addition to querying and navigating the UCSC genome browser. Check out the ?import
page for basic usage.Annotation: Bioconductor provides extensive access to ‘annotation’ resources (see the AnnotationData biocViews hierarchy); these are covered in greater detail in Thursday’s lab, but some interesting examples to explore during this lab include:
?select
?exonsBy
page to retrieve all exons grouped by gene or transcript.Bioconductor is a large collection of R packages for the analysis and comprehension of high-throughput genomic data. Bioconductor relies on formal classes to represent genomic data, so it is important to develop a rudimentary comfort with classes, including seeking help for classes and methods. Bioconductor uses vignettes to augment traditional help pages; these can be very valuable in illustrating overall package use.