% NOTE -- ONLY EDIT THE .Rnw FILE!!!  The .tex file is
% likely to be overwritten.
%
%\VignetteIndexEntry{EMBO03 Lab 2}
%\VignetteDepends{Biobase,annotate,tkWidgets,geneplotter,golubEsets,hu6800,GO}
%\VignetteKeywords{Annotation}
\documentclass[12pt]{article}

\usepackage{amsmath,pstricks}
\usepackage[authoryear,round]{natbib}
\usepackage{hyperref}


\textwidth=6.2in
\textheight=8.5in
\oddsidemargin=.1in
\evensidemargin=.1in
\headheight=-.3in

\newcommand{\scscst}{\scriptscriptstyle}
\newcommand{\scst}{\scriptstyle}

\bibliographystyle{plainnat}


\title{EMBO03 Lab 2: Introduction to Bioconductor Annotation Packages}

\author{Sandrine Dudoit and Robert Gentleman}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{/home/sandrine/System/Programs/R-1.6.2/lib/R/share/texmf/Sweave}
\begin{document}

\maketitle

One of the largest challenges in analyzing genomic data is associating
the experimental data with the available biological {\em metadata}, e.g.,
sequence, gene annotation, chromosomal maps, literature. Bioconductor
provides two main packages for this purpose: \texttt{annotate}
(end-user) and \texttt{AnnBuilder} (developer). These packages can be
used for querying databases such as GenBank, GO, LocusLink, and
PubMed, from R, and for processing the query results in R.\\

In this lab, we focus on annotation resources for Affymetrix
chips. Since Affymetrix chips have a standard layout, Bioconductor
can provide annotation data packages for the main types of Affymetrix
chips, e.g., hu6800, hgu33, hgu95, mgu74, and rgu34 series. These data packages are built using the
\texttt{AnnBuilder} package. By contrast, there is no standard
array design for two-color spotted microarray experiments; each lab tends
to have its own custom design. In this case, specific annotation data packages
will have to be created for each facility using
\texttt{AnnBuilder}. Once annotation data packages are constructed to provide
mappings between different sets of gene identifiers, the tools in
\texttt{annotate} can be used in a similar manner for both platforms.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Mappings between different gene identifiers}

A main task in annotation is to associate manufacturer (e.g., for
Affymetrix chips) or in-house (e.g., for custom cDNA spotted arrays)
probe identifiers to other available identifiers
(e.g., PMID, GenBank accession number).\\
 
In this lab, we will use the Bioconductor annotation data packages to map
between Affymetrix identifiers and identifiers for biological metadata
available on the WWW.
Because these data sources are very large, are constantly evolving, and
are similar across species, we have adopted the strategy of distributing
data in regularly updated R packages. Each mapping is contained in an {\em environment}.
For our purposes, an environment is simply a {\em hash table}.
It provides a very fast way of looking up {\em values} for specific
text {\em keys}.
This implementation is not the best and we hope to develop real hash tables
for R but that will take some time.\\


We will again use the Golub et al. (1999) dataset as a case study and
will explore annotation resources for the Affymetrix HU6800 chip used
in this study. The Bioconductor
annotation data package for the HU6800 chip is \texttt{hu6800} and can
be downloaded from the "Data packages" section of the Bioconductor
website. To load the packages needed for this lab
\begin{Sinput}
> library(Biobase)
> library(annotate)
> library(tkWidgets)
> library(geneplotter)
> library(golubEsets)
> library(hu6800)
> library(GO)
\end{Sinput}
Alternately, since all these packages are required by the
\texttt{EMBO03} course package, simply use
\begin{Sinput}
> library(EMBO03)
\end{Sinput}
\begin{Soutput}
Loading required package: annotate 
Loading required package: geneplotter 
Loading required package: affy 

Attaching package `affy':


	The following object(s) are masked from package:base :

	 barplot boxplot colnames hist history image ncol nrow 

Loading required package: marrayTools 
Loading required package: marrayClasses 
Creating a new generic function for "print" in package 
marrayClasses 
Creating a new generic function for "rbind" in package 
marrayClasses 
Creating a new generic function for "cbind" in package 
marrayClasses 

Attaching package `marrayClasses':


	The following object(s) are masked from package:base :

	 cbind print rbind 

Loading required package: stepfun 
Loading required package: marrayInput 
Loading required package: marrayPlots 
Creating a new generic function for "plot" in package 
.GlobalEnv 
Loading required package: GO 
Loading required package: hu6800 
\end{Soutput}

After loading the \texttt{hu6800} package, we have access to a number of
different datasets (environments). These provide the many different
mappings from Affymetrix identifiers to other probe identifiers, such
as chromosomal location (in the \texttt{hu6800CHR} environment) and PMID
(in the \texttt{hu6800PMID} environment). Quality control data, counts,
etc., for the mappings are available by calling the function
\texttt{hu6800()} and by examining the help page, \texttt{?hu6800}.
\begin{Sinput}
> hu6800()
\end{Sinput}
\begin{Soutput}
Quality control information for hu6800:
 
Date built:  Thu Feb 13 11:00:27 2003 
Number of probes: 7129 
Probe number missmatch: None 
Probe missmatch: None 
Mappings found for probe based rda files: 
	 hu6800ACCNUM found 7092 of 7129
	 hu6800CHRLOC found 6467 of 7129
	 hu6800CHRORI found 6467 of 7129
	 hu6800CHR found 6882 of 7129
	 hu6800ENZYME found 1067 of 7129
	 hu6800GENENAME found 6913 of 7129
	 hu6800GO found 5731 of 7129
	 hu6800GRIF found 3533 of 7129
	 hu6800LOCUSID found 6918 of 7129
	 hu6800MAP found 6873 of 7129
	 hu6800PATH found 1448 of 7129
	 hu6800PMID found 6837 of 7129
	 hu6800SUMFUNC found 6087 of 7129
	 hu6800SYMBOL found 6913 of 7129
	 hu6800UNIGENE found 6834 of 7129 
Mappings found for non-probe based rda files:
 	 hu6800AFFYCOUNTS found 2149
	 hu6800ENZYME2AFFY found 469
	 hu6800GO2AFFY found 2149
	 hu6800GO2ALLAFFY found 2149
	 hu6800PATH2AFFY found 120
	 hu6800PMID2AFFY found 30866 
\end{Soutput}

The main R functions we will use for dealing with environments are \texttt{ls} (to list the names of objects in a
specified environment) and  \texttt{get} (to search for an R object with
a given name and return its value, if found, in the specified environment).
We obtain the Affymetrix identifiers using \texttt{ls} and note that there are 7,129 identifiers for the
HU6800 chip (this matches the Golub \texttt{exprSets}).
\begin{Sinput}
> affyID <- ls(env = hu6800CHR)
> length(affyID)
\end{Sinput}
\begin{Soutput}
[1] 7129
\end{Soutput}

We now arbitrarily select the probe set with Affymetrix identifier
\texttt{"U18237\_at"} and obtain a number of other IDs corresponding to
this probe set. Note that there may be several PMIDs, i.e., PubMed abstracts, associated
with a given gene.

\begin{Sinput}
> mygene <- affyID[4001]
> mygene
\end{Sinput}
\begin{Soutput}
[1] "U18237_at"
\end{Soutput}
\begin{Sinput}
> get(mygene, env = hu6800ACCNUM)
\end{Sinput}
\begin{Soutput}
[1] "U18237"
\end{Soutput}
\begin{Sinput}
> get(mygene, env = hu6800LOCUSID)
\end{Sinput}
\begin{Soutput}
[1] 23456
\end{Soutput}
\begin{Sinput}
> get(mygene, env = hu6800SYMBOL)
\end{Sinput}
\begin{Soutput}
[1] "ABCB10"
\end{Soutput}
\begin{Sinput}
> get(mygene, env = hu6800GENENAME)
\end{Sinput}
\begin{Soutput}
[1] "ATP-binding cassette, sub-family B (MDR/TAP), member 10"
\end{Soutput}
\begin{Sinput}
> get(mygene, env = hu6800SUMFUNC)
\end{Sinput}
\begin{Soutput}
[1] NA
\end{Soutput}
\begin{Sinput}
> get(mygene, env = hu6800UNIGENE)
\end{Sinput}
\begin{Soutput}
[1] "Hs.1710"
\end{Soutput}
\begin{Sinput}
> get(mygene, env = hu6800CHR)
\end{Sinput}
\begin{Soutput}
[1] "1"
\end{Soutput}
\begin{Sinput}
> get(mygene, env = hu6800CHRLOC)
\end{Sinput}
\begin{Soutput}
        1 
225346509 
\end{Soutput}
\begin{Sinput}
> get(mygene, env = hu6800CHRORI)
\end{Sinput}
\begin{Soutput}
  1 
"-" 
\end{Soutput}
\begin{Sinput}
> get(mygene, env = hu6800MAP)
\end{Sinput}
\begin{Soutput}
[1] "1q42"
\end{Soutput}
\begin{Sinput}
> get(mygene, env = hu6800PMID)
\end{Sinput}
\begin{Soutput}
[1] 10922475 10748049  7766993
\end{Soutput}
\begin{Sinput}
> get(mygene, env = hu6800GO)
\end{Sinput}
\begin{Soutput}
[1] NA
\end{Soutput}

In some cases, we need to obtain data on several genes at once. We
wrote a special function for this purpose: \texttt{multiget}.
\begin{Sinput}
> fivegenes <- affyID[6:10]
> fivegenes
\end{Sinput}
\begin{Soutput}
[1] "AB000409_at"   "AB000410_s_at" "AB000449_at"   "AB000450_at"  
[5] "AB000460_at"  
\end{Soutput}
\begin{Sinput}
> multiget(fivegenes, env = hu6800PMID)
\end{Sinput}
\begin{Soutput}
$"AB000409_at"
[1] 10859165  9155018

$"AB000410_s_at"
 [1] 12244119 12189194 12164330 12119232 12117782 12034821 11992556 11927502
 [9] 11902834 11837743 10449904 10233168  9681819  9348312  9321410  9223306
[17]  9223305  9207108  9197244  9190902  9187114

$"AB000449_at"
[1] 9344656

$"AB000450_at"
[1] 9344656

$"AB000460_at"
[1] 9734812
\end{Soutput}

Instead of relying on the general R functions for environments (e.g., \texttt{get}), the
development version of the \texttt{annotate} package also provides new and more user-friendly
functions for accessing specific identifiers. 
\begin{Sinput}
> getSYMBOL(fivegenes, data = "hu6800")
\end{Sinput}
\begin{Soutput}
  AB000409_at AB000410_s_at   AB000449_at   AB000450_at   AB000460_at 
      "MKNK1"        "OGG1"        "VRK1"        "VRK2"      "C4orf8" 
\end{Soutput}
\begin{Sinput}
> getLL(fivegenes, data = "hu6800")
\end{Sinput}
\begin{Soutput}
  AB000409_at AB000410_s_at   AB000449_at   AB000450_at   AB000460_at 
         8569          4968          7443          7444          8603 
\end{Soutput}
\begin{Sinput}
> getPMID(fivegenes, data = "hu6800")
\end{Sinput}
\begin{Soutput}
$"AB000409_at"
[1] 10859165  9155018

$"AB000410_s_at"
 [1] 12244119 12189194 12164330 12119232 12117782 12034821 11992556 11927502
 [9] 11902834 11837743 10449904 10233168  9681819  9348312  9321410  9223306
[17]  9223305  9207108  9197244  9190902  9187114

$"AB000449_at"
[1] 9344656

$"AB000450_at"
[1] 9344656

$"AB000460_at"
[1] 9734812
\end{Soutput}
\begin{Sinput}
> gg <- getGO(fivegenes, data = "hu6800")
> getGOdesc(gg[[2]], "MF")
\end{Sinput}
\begin{Soutput}
$"GO:0008534"
[1] "purine-specific oxidized base lesion DNA N-glycosylase"

$"GO:0003684"
[1] "damaged DNA binding"

$"GO:0004519"
[1] "endonuclease"
\end{Soutput}

A variety of information about the probes can now easily be obtained
by, for example, querying PubMed, GenBank, and LocusLink, as described below.  In
addition, one can also use R to compute on these data and perform a
number of quality control and exploratory analyses.
\begin{Sinput}
> whChrom <- multiget(affyID, env = hu6800CHR)
> table(unlist(whChrom))
\end{Sinput}
\begin{Soutput}
  1  10  11  12  13  14  15  16  17  18  19   2  20  21  22   3   4   5   6   7 
673 250 414 419 107 235 181 269 440  98 422 443 150 100 171 365 275 294 419 326 
  8   9   X   Y 
236 254 325  26 
\end{Soutput}
\begin{Sinput}
> vv <- sapply(whChrom, length)
> table(vv)
\end{Sinput}
\begin{Soutput}
vv
   1    2 
7119   10 
\end{Soutput}
\begin{Sinput}
> whChrom[vv == 2]
\end{Sinput}
\begin{Soutput}
$"D49410_at"
[1] "X" "Y"

$"HG2868-HT3012_s_at"
[1] "X" "Y"

$"HG3936-HT4206_at"
[1] "X" "Y"

$"J03592_at"
[1] "X" "Y"

$"L39064_rna1_at"
[1] "X" "Y"

$"M16279_at"
[1] "X" "Y"

$"U11090_at"
[1] "X" "Y"

$"U13706_at"
[1] "X" "Y"

$"U82668_rna1_at"
[1] "X" "Y"

$"X17648_at"
[1] "X" "Y"
\end{Soutput}
This yields the distribution of probe sets by chromosome.
Note that there are 10 genes that have been assigned two chromosome locations.
We might want to explore these further by examining resources at the NCBI.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Querying PubMed}

The National Library of Medicine (NLM) provides a great deal of information
on biological data. We have
only just started to explore these resources. We have already
developed tools for interacting with PubMed, but need to develop
further functionality on MeSH and other available resources.
A mapping has been done between LocusLink and PubMed.  This associates specific
articles with specific genes. The articles can be queried interactively using
tools available in R and other systems.
Full text abstracts are readily available; in some cases full text
articles are also available (we don't have the tools to make use of
the later).
We next demonstrate how to interact with PubMed using functions
in \texttt{annotate}.\\

Bioconductor functions for querying PubMed and other WWW databases
from R rely on the \texttt{browseURL} function and the R \texttt{XML}
package to parse query results. 
For more details, please consult articles in  R News (Gentleman \&
Gentry (2002), {\it R News} 2(2); Temple Lang (2001), {\it R News} 1(1)).

\begin{Sinput}
> browseURL("www.r-project.org")
\end{Sinput}

A \texttt{pubMedAbst} class structure was defined for handling 
PubMed abstracts in R. The slots are
\begin{Sinput}
> slotNames("pubMedAbst")
\end{Sinput}
\begin{Soutput}
[1] "authors"      "abstText"     "articleTitle" "journal"      "pubDate"     
[6] "abstUrl"     
\end{Soutput}

The basic engine for talking to PubMed is the function
\texttt{pubmed}. Given a vector of PMIDs, the function either has a
browser display a URL showing the results of the PubMed query for those
identifiers (\texttt{disp="browser"}) or creates an \texttt{XMLdoc}
object with the same data (\texttt{disp="data"}). 
\begin{Sinput}
> pmids <- getPMID(mygene, data = "hu6800")
> pubmed(pmids, disp = "browser")
> absts1 <- pubmed(pmids, disp = "data")
\end{Sinput}

The function \texttt{pm.getabst} provides a simpler way to 
download the specified PubMed abstracts (stored in XML) and create a
list of  \texttt{pubMedAbst} objects. The following commands can be
used to store the PubMed abstracts for 5 genes in a list of objects of
class \texttt{pubMedAbst}, to compute the number of abstracts retrieved
for each gene, and to print the abstract(s) for the first gene. We can
see, for example, that one of the genes has 21 abstracts associated with it.
\begin{Sinput}
> absts2 <- pm.getabst(fivegenes, "hu6800")
\end{Sinput}
\begin{Soutput}
Loading required package: XML 
\end{Soutput}
\begin{Sinput}
> lapply(absts2, length)
\end{Sinput}
\begin{Soutput}
$"AB000409_at"
[1] 2

$"AB000410_s_at"
[1] 21

$"AB000449_at"
[1] 1

$"AB000450_at"
[1] 1

$"AB000460_at"
[1] 1
\end{Soutput}
\begin{Sinput}
> absts2[[1]]
\end{Sinput}
\begin{Soutput}
[[1]]
list()
attr(,"authors")
[1] "R Cuesta"     "G Laroia"     "RJ Schneider"
attr(,"abstText")
[1] "Inhibition of protein synthesis during heat shock limits accumulation of unfolded proteins that might damage eukaryotic cells. We demonstrate that chaperone Hsp27 is a heat shock-induced inhibitor of cellular protein synthesis. Translation of most mRNAs requires formation of a cap-binding initiation complex known as eIF4F, consisting of factors eIF4E, eIF4A, eIF4E kinase Mnk1, poly(A)-binding protein, and adaptor protein eIF4G. Hsp27 specifically bound eIF4G during heat shock, preventing assembly of the cap-initiation/eIF4F complex and trapping eIF4G in insoluble heat shock granules. eIF4G is a specific target of Hsp27, as eIF4E, eIF4A, Mnk1, poly(A)-binding protein, eIF4B, and eIF3 were not bound by Hsp27 and were not recruited into insoluble complexes. Dissociation of eIF4F was enhanced during heat shock by ectopic overexpression of Hsp25, the murine homolog of human Hsp27. Overexpression of Hsc70, a constitutive homolog of Hsp70, prevented loss of cap-initiation complexes and maintained eIF4G solubility. Purified Hsp27 specifically bound purified eIF4G in vitro, prevented in vitro translation, eliminated eIF4G interaction with protein binding factors, and promoted eIF4G insolubilization. These results therefore demonstrate that Hsp27 is a heat-induced inhibitor of eIF4F-dependent mRNA translation."
attr(,"articleTitle")
[1] "Chaperone hsp27 inhibits translation during heat shock by binding eIF4G and facilitating dissociation of cap-initiation complexes."
attr(,"journal")
[1] "Genes Dev"
attr(,"pubDate")
[1] "Jun 2000"
attr(,"abstUrl")
[1] "No URL Provided"
attr(,"class")
[1] "pubMedAbst"

[[2]]
list()
attr(,"authors")
[1] "R Fukunaga" "T Hunter"  
attr(,"abstText")
[1] "We have developed a novel expression screening method for identifying protein kinase substrates. In this method, a lambda phage cDNA expression library is screened by in situ, solid-phase phosphorylation using purified protein kinase and [gamma-32P]ATP. Screening a HeLa cDNA library with ERK1 MAP kinase yielded cDNAs of previously characterized ERK substrates, c-Myc and p90RSK, demonstrating the utility of this method for identifying physiological protein kinase substrates. A novel clone isolated in this screen, designated MNK1, encodes a protein-serine/threonine kinase, which is most similar to MAP kinase-activated protein kinase 2 (MAPKAP-K2), 3pK/MAPKAP-K3 and p90RSK. Bacterially expressed MNK1 was phosphorylated and activated in vitro by ERK1 and p38 MAP kinases but not by JNK/SAPK. Further, MNK1 was activated upon stimulation of HeLa cells with 12-O-tetradecanoylphorbol-13-acetate, fetal calf serum, anisomycin, UV irradiation, tumor necrosis factor-alpha, interleukin-1beta, or osmotic shock, and the activation by these stimuli was differentially inhibited by the MEK inhibitor PD098059 or the p38 MAP kinase inhibitor SB202190. Together, these results indicate that MNK1 is a novel class of protein kinase that is activated through both the ERK and p38 MAP kinase signaling pathways."
attr(,"articleTitle")
[1] "MNK1, a new MAP kinase-activated protein kinase, isolated by a novel expression screening method for identifying protein kinase substrates."
attr(,"journal")
[1] "EMBO J"
attr(,"pubDate")
[1] "Apr 1997"
attr(,"abstUrl")
[1] "No URL Provided"
attr(,"class")
[1] "pubMedAbst"
\end{Soutput}

The functions 
\texttt{pm.titles} and  \texttt{pm.abstGrep} can then be used to
extract the titles from a set of PubMed abstracts and for regular
expression matching on these abstracts, respectively. For the genes with Affy IDs \texttt{fivegenes}, the following
commands extract the abstract titles and search the
abstracts for the word "protein", with lower case "p" or upper case "P".
\begin{Sinput}
> pm.titles(absts2)
\end{Sinput}
\begin{Soutput}
[[1]]
[1] "Chaperone hsp27 inhibits translation during heat shock by binding eIF4G and facilitating dissociation of cap-initiation complexes."         
[2] "MNK1, a new MAP kinase-activated protein kinase, isolated by a novel expression screening method for identifying protein kinase substrates."

[[2]]
 [1] "Conditional targeting of the DNA repair enzyme hOGG1 into mitochondria."                                                                                     
 [2] "Inter-individual variation, seasonal variation and close correlation of OGG1 and ERCC1 mRNA levels in full blood from healthy volunteers."                   
 [3] "A limited association of OGG1 Ser326Cys polymorphism for adenocarcinoma of the lung."                                                                        
 [4] "Protection of human lung cells against hyperoxia using the DNA base excision repair genes hOgg1 and Fpg."                                                    
 [5] "The human OGG1 DNA repair enzyme and its association with orolaryngeal cancer risk."                                                                         
 [6] "Human OGG1 undergoes serine phosphorylation and associates with the nuclear matrix and mitotic chromatin in vivo."                                           
 [7] "hOGG1 Ser(326)Cys polymorphism and modification by environmental factors of stomach cancer risk in Chinese."                                                 
 [8] "Association of the hOGG1 Ser326Cys polymorphism with lung cancer risk."                                                                                      
 [9] "Reciprocal \"flipping\" underlies substrate recognition and catalytic activation by the human 8-oxo-guanine DNA glycosylase."                                
[10] "Expression of 8-oxoguanine DNA glycosylase is reduced and associated with neurofibrillary tangles in Alzheimer's disease brain."                             
[11] "Structure and chromosome location of human OGG1."                                                                                                            
[12] "Expression and differential intracellular localization of two major forms of human 8-oxoguanine DNA glycosylase encoded by alternatively spliced OGG1 mRNAs."
[13] "Genetic polymorphisms and alternative splicing of the hOGG1 gene, that is involved in the repair of 8-hydroxyguanine in damaged DNA."                        
[14] "Augmented expression of a human gene for 8-oxoguanine DNA glycosylase (MutM) in B lymphocytes of the dark zone in lymph node germinal centers."              
[15] "Opposite base-dependent reactions of a human base excision repair enzyme on DNA containing 7,8-dihydro-8-oxoguanine and abasic sites."                       
[16] "Molecular cloning and functional expression of a human cDNA encoding the antimutator enzyme 8-hydroxyguanine-DNA glycosylase."                               
[17] "Cloning and characterization of hOGG1, a human homolog of the OGG1 gene of Saccharomyces cerevisiae."                                                        
[18] "Cloning and characterization of a mammalian 8-oxoguanine DNA glycosylase."                                                                                   
[19] "A mammalian DNA repair enzyme that excises oxidatively damaged guanines maps to a locus frequently lost in lung cancer."                                     
[20] "Cloning of a human homolog of the yeast OGG1 gene that is involved in the repair of oxidative DNA damage."                                                   
[21] "Cloning and characterization of mammalian 8-hydroxyguanine-specific DNA glycosylase/apurinic, apyrimidinic lyase, a functional mutM homologue."              

[[3]]
[1] "Identification of two novel human putative serine/threonine kinases, VRK1 and VRK2, with structural similarity to vaccinia virus B1R kinase."

[[4]]
[1] "Identification of two novel human putative serine/threonine kinases, VRK1 and VRK2, with structural similarity to vaccinia virus B1R kinase."

[[5]]
[1] "The primary structure and genomic organization of five novel transcripts located close to the Huntington's disease gene on human chromosome 4p16.3."
\end{Soutput}
\begin{Sinput}
> sapply(absts2, function(x) pm.abstGrep("[Pp]rotein", x))
\end{Sinput}
\begin{Soutput}
$"AB000409_at"
[1] TRUE TRUE

$"AB000410_s_at"
 [1]  TRUE FALSE FALSE  TRUE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE
[13]  TRUE FALSE  TRUE  TRUE  TRUE FALSE  TRUE  TRUE  TRUE

$"AB000449_at"
[1] TRUE

$"AB000450_at"
[1] TRUE

$"AB000460_at"
[1] TRUE
\end{Soutput}

The new function \texttt{pmAbst2html} from the development version of
\texttt{annotate} takes a list of
\texttt{pubMedAbst} objects and generates an HTML report with
the titles of the abstracts and links to their full page on
PubMed. The report will be stored in the file \texttt{pm.html} in the
working directory.


%%%***<<pmAbst2html,eval=FALSE>>=
\begin{Sinput}
> pmAbst2html(absts2[[2]],filename="pm.html")
\end{Sinput}
%%%@

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Querying GenBank}

Another source of data is GenBank. We can interact with GenBank in
much the same way as with PubMed; the main function for this purpose
is \texttt{genbank}.

\begin{Sinput}
> gbacc <- multiget(fivegenes, hu6800ACCNUM)
> genbank(gbacc, disp = "browser")
> gb <- genbank(gbacc[1], disp = "data")
\end{Sinput}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Querying LocusLink}

Finally, we consider interactions with LocusLink to obtain sequence
and other biological information on probe sets of interest.

\begin{Sinput}
> llid <- getLL(fivegenes, data = "hu6800")
> locuslinkByID(llid)
\end{Sinput}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{HTML reports}

The function \texttt{ll.htlmpage} generates HTML reports, with one row per gene and a clickable entry which opens the LocusLink webpage for that gene. Additional information can be displayed using the 
\texttt{othernames} argument as shown below. Such HTML reports provide an
easy way to communicate results with other researchers working on the same analysis.

\begin{Sinput}
> tengenes <- affyID[1:10]
> llid <- getLL(tengenes, data = "hu6800")
> symb <- getSYMBOL(tengenes, data = "hu6800")
> map <- multiget(tengenes, hu6800MAP)
> res <- data.frame(tengenes, cbind(unlist(symb), unlist(map)))
> names(res) <- c("Affy ID", "Gene symbol", "Chromosomal location")
> ll.htmlpage(llid, filename = "ll.html", title = "HTML report for 10 genes", 
+     othernames = res, table.head = c("LocusID", names(res)), 
+     table.center = TRUE)
\end{Sinput}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Plotting genomic data}

The classes \texttt{chromLoc} and \texttt{chromLocation} are used to
keep track of location information for a single gene and a set of
genes (entire genome), respectively. The object
\texttt{hu6800ChrClass} from the \texttt{EMBO03} course package is an
instance of the class \texttt{chromLocation} for the Affymetrix HU6800
chip. It was constructed using the "byChroms" vignette in the \texttt{geneplotter} package.

\begin{Sinput}
> slotNames("chromLoc")
\end{Sinput}
\begin{Soutput}
[1] "chrom"    "position" "strand"  
\end{Soutput}
\begin{Sinput}
> data(hu6800ChrClass)
> species(hu6800ChrClass)
\end{Sinput}
\begin{Soutput}
[1] "Human"
\end{Soutput}
\begin{Sinput}
> chromNames(hu6800ChrClass)
\end{Sinput}
\begin{Soutput}
 [1] "1"  "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "2"  "20" "21" "22"
[16] "3"  "4"  "5"  "6"  "7"  "8"  "9"  "X"  "Y" 
\end{Soutput}

The \texttt{geneplotter} package provides two main functions for
plotting genomic data: \texttt{cPlot} and \texttt{alongChrom}. These
functions operate on instances of the class \texttt{chromLocation}.
With \texttt{cPlot}, we can render all chromosomes the same length or
we can scale them by their relative lengths. Note that the \texttt{mva} package
in the next release of R (1.7.0) will have new functions for heat maps and dendrograms.

\newpage

\begin{Sinput}
> cPlot(hu6800ChrClass, scale = "relative")
\end{Sinput}
\includegraphics{lab2Annot-cPlot1}

\begin{Sinput}
> cPlot(hu6800ChrClass, scale = "max")
\end{Sinput}
\includegraphics{lab2Annot-cPlot2}

\begin{Sinput}
> data(golubTrain)
> cols <- as.numeric(pData(golubTrain)$ALL.AML) + 1
> alongChrom(golubTrain, chrom = 1, specChrom = hu6800ChrClass, 
+     colors = cols)
\end{Sinput}
\begin{Soutput}
<environment: 0xb829220>
\end{Soutput}
\includegraphics{lab2Annot-alongChrom1}

\begin{Sinput}
> alongChrom(golubTrain, chrom = 22, specChrom = hu6800ChrClass, 
+     plotFormat = "image")
\end{Sinput}
\includegraphics{lab2Annot-alongChrom2}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}
