## create an AnnotationHub object
library(AnnotationHub)
ah = AnnotationHub()
## Summary of available records
ah
## Detail for a single record
ah[1]
## and what is the date we are using?
snapshotDate(ah)
## how many resources?
length(ah)
## from which resources, is data available?
head(sort(table(ah$dataprovider), decreasing=TRUE))
## from which species, is data available ?
head(sort(table(ah$species),decreasing=TRUE))
## what web service and local cache does this AnnotationHub point to?
hubUrl(ah)
hubCache(ah)
### Examples ###
## One can search the hub for multiple strings
ahs2 <- query(ah, c("GTF", "77","Ensembl", "Homo sapiens"))
## information about the file can be retrieved using
ahs2[1]
## one can further extract information from this show method
## like the sourceurl using:
ahs2$sourceurl
ahs2$description
ahs2$title
## We can download a file by name like this (using a list semantic):
gr <- ahs2[[1]]
## And we can also extract it by the names like this:
res <- ah[["AH28812"]]
## the gtf file is returned as a GenomicRanges object and contains
## data about which organism it belongs to, its seqlevels and seqlengths
seqinfo(gr)
## each GenomicRanges contains a metadata slot which can be used to get
## the name of the hub object and other associated metadata.
metadata(gr)
ah[metadata(gr)$AnnotationHubName]
## And we can also use "[" to restrict the things that are in the
## AnnotationHub object (by position, character, or logical vector).
## Here is a demo of position:
subHub <- ah[1:3]
if(interactive()) {
## Display method involves user interaction through web interface
ah2 <- display(ah)
}
## recordStatus
recordStatus(ah, "TEST")
recordStatus(ah, "AH7220")
Run the code above in your browser using DataLab