### R code from vignette source 'vignettes/annotationTools/inst/doc/annotationTools.Rnw' ################################################### ### code chunk number 1: annotationTools.Rnw:30-31 (eval = FALSE) ################################################### ## annotation_HGU133Plus2<-read.csv('HG-U133_Plus_2_annot.csv',colClasses='character',comment.char='#') ################################################### ### code chunk number 2: annotationTools.Rnw:36-38 ################################################### annotationFile<-system.file('extdata','HG-U133_Plus_2_annot_part.csv',package='annotationTools') annotation_HGU133Plus2<-read.csv(annotationFile,colClasses='character',comment.char='#') ################################################### ### code chunk number 3: annotationTools.Rnw:43-44 ################################################### myPS<-c('117_at','1007_s_at') ################################################### ### code chunk number 4: annotationTools.Rnw:49-50 ################################################### library(annotationTools) ################################################### ### code chunk number 5: annotationTools.Rnw:53-54 ################################################### getGENESYMBOL(myPS,annotation_HGU133Plus2) ################################################### ### code chunk number 6: annotationTools.Rnw:61-62 ################################################### getGENEONTOLOGY(myPS,annotation_HGU133Plus2) ################################################### ### code chunk number 7: annotationTools.Rnw:67-68 ################################################### getGENEONTOLOGY(myPS,annotation_HGU133Plus2,specifics=2) ################################################### ### code chunk number 8: annotationTools.Rnw:75-76 ################################################### ls(grep('annotationTools',search())) ################################################### ### code chunk number 9: annotationTools.Rnw:81-82 ################################################### colnames(annotation_HGU133Plus2) ################################################### ### code chunk number 10: annotationTools.Rnw:92-94 ################################################### homologeneFile<-system.file('extdata','homologene_part.data',package='annotationTools') homologene<-read.delim(homologeneFile,header=FALSE) ################################################### ### code chunk number 11: annotationTools.Rnw:99-101 ################################################### myGenes<-c(5982,93587) getHOMOLOG(myGenes,10090,homologene) ################################################### ### code chunk number 12: annotationTools.Rnw:108-116 ################################################### ps_human<-'1053_at' geneID_human<-getGENEID(ps_human,annotation_HGU133Plus2) geneID_mouse<-getHOMOLOG(geneID_human,10090,homologene) annotationFile<-system.file('extdata','Mouse430_2_annot_part.csv',package='annotationTools') annotation_Mouse4302<-read.csv(annotationFile,colClasses='character') geneID_mouse<-unlist(geneID_mouse) ps_mouse<-getPROBESET(geneID_mouse,annotation_Mouse4302) ps_mouse ################################################### ### code chunk number 13: annotationTools.Rnw:123-125 ################################################### affyOrthologFile<-system.file('extdata','HG-U133_Plus_2_ortholog_part.csv',package='annotationTools') orthologs_HGU133Plus2<-read.csv(affyOrthologFile,colClasses='character') ################################################### ### code chunk number 14: annotationTools.Rnw:130-131 ################################################### getHOMOLOG('1053_at','Mouse430_2',orthologs_HGU133Plus2,cluster=TRUE,clusterCol=1,speciesCol=4,idCol=3) ################################################### ### code chunk number 15: annotationTools.Rnw:141-142 (eval = FALSE) ################################################### ## orthoTable<-ps2ps(annotation_HGU133Plus2,annotation_Mouse4302,homologene,10090) ################################################### ### code chunk number 16: annotationTools.Rnw:147-162 (eval = FALSE) ################################################### ## annotation_HGU133Plus2<-read.csv('HG-U133_Plus_2_annot.csv',colClasses='character',comment.char='#') ## annotation_Mouse4302<-read.csv('Mouse430_2_annot.csv',colClasses='character',comment.char='#') ## homologene<-read.delim('homologene.data',header=F) ## target_species<-10090 ## ## ps_HGU133Plus2<-annotation_HGU133Plus2[,1] ## gid_HGU133Plus2<-getGENEID(ps_HGU133Plus2,annotation_HGU133Plus2) ## length_gid_HGU133Plus2<-sapply(gid_HGU133Plus2,function(x) {length(x)}) ## gid_Mouse4302<-getHOMOLOG(unlist(gid_HGU133Plus2),target_species,homologene) ## length_gid_Mouse4302<-sapply(gid_Mouse4302,function(x) {length(x)}) ## ps_Mouse4302<-getPROBESET(unlist(gid_Mouse4302),annotation_Mouse4302) ## ## ps_Mouse4302_1<-compactList(ps_Mouse4302,length_gid_Mouse4302) ## ps_Mouse4302_2<-compactList(ps_Mouse4302_1,length_gid_HGU133Plus2) ## gid_Mouse4302_1<-compactList(gid_Mouse4302,length_gid_HGU133Plus2) ################################################### ### code chunk number 17: annotationTools.Rnw:167-171 (eval = FALSE) ################################################### ## ps_Mouse4302_2<-lapply(ps_Mouse4302_2,function(x) {unique(x)}) ## ps_Mouse4302_2<-lapply(ps_Mouse4302_2,function(x) {if (length(x)>1) na.omit(x) else x}) ## gid_Mouse4302_1<-lapply(gid_Mouse4302_1,function(x) {unique(x)}) ## gid_Mouse4302_1<-lapply(gid_Mouse4302_1,function(x) {if (length(x)>1) na.omit(x) else x}) ################################################### ### code chunk number 18: annotationTools.Rnw:176-179 (eval = FALSE) ################################################### ## orthoTable<-cbind(ps_HGU133Plus2,listToCharacterVector(gid_HGU133Plus2,sep=','),listToCharacterVector(gid_Mouse4302_1,sep=','),listToCharacterVector(ps_Mouse4302_2,sep=',')) ## colnames(orthoTable)<-c('ps_HGU133Plus2','gid_HGU133Plus2','gid_Mouse4302','ps_Mouse4302') ## write.table(orthoTable,file='HGU133Plus2_Mouse4302.txt',sep='\t',col.names=T,row.names=F) ################################################### ### code chunk number 19: annotationTools.Rnw:184-186 (eval = FALSE) ################################################### ## orthoTable<-ps2ps(annotation_HGU133Plus2,annotation_Mouse4302,homologene,10090) ## write.table(orthoTable,file='HGU133Plus2_Mouse4302.txt',sep='\t',col.names=T,row.names=F) ################################################### ### code chunk number 20: annotationTools.Rnw:199-200 ################################################### data(orthologs_example) ################################################### ### code chunk number 21: annotationTools.Rnw:205-208 ################################################### selection<-1:8 ps_mouse<-table_mouse$Probe.Set.ID[selection] table_mouse[selection,] ################################################### ### code chunk number 22: annotationTools.Rnw:213-215 ################################################### orthops<-getOrthologousProbesets(ps_mouse,table_human,ortho) orthops[[1]] ################################################### ### code chunk number 23: annotationTools.Rnw:220-221 ################################################### table_human_absM<-data.frame(I(table_human[,1]),I(abs(table_human[,2]))) ################################################### ### code chunk number 24: annotationTools.Rnw:226-228 ################################################### orthops_maxAbsM<-getOrthologousProbesets(ps_mouse,table_human_absM,ortho,max,forceProbesetSelection=TRUE) orthops_maxAbsM[[1]] ################################################### ### code chunk number 25: annotationTools.Rnw:233-235 ################################################### orthops_maxAbsM_ind<-match(unlist(orthops_maxAbsM[[1]]),table_human[,1]) table_human[orthops_maxAbsM_ind,2] ################################################### ### code chunk number 26: annotationTools.Rnw:242-250 ################################################### table_human_absT<-data.frame(I(table_human[,1]),I(abs(table_human[,3]))) orthops_maxAbsT<-getOrthologousProbesets(ps_mouse,table_human_absT,ortho,max,forceProbesetSelection=TRUE) orthops_maxAbsT_ind<-match(unlist(orthops_maxAbsT[[1]]),table_human[,1]) plot(table_mouse[selection,2],table_human[orthops_maxAbsM_ind,2],pch=19,col='gray',cex=1.5,xlab='log fold change in mouse',ylab='log fold change in human') abline(h=0) abline(v=0) abline(0,1) points(table_mouse[selection,2],table_human[orthops_maxAbsT_ind,2],pch=3,col=1) ################################################### ### code chunk number 27: annotationTools.Rnw:259-261 ################################################### ps_human<-ortho[match(ps_mouse,ortho[,1]),4] ps_human ################################################### ### code chunk number 28: annotationTools.Rnw:266-270 ################################################### ps_human<-lapply(ps_human,function(x){strsplit(x,',')[[1]]}) length_ps_human<-sapply(ps_human,length) gs_human<-lapply(ps_human,function(x){listToCharacterVector(getGENESYMBOL(x,annot_HGU133A))}) gs_human ################################################### ### code chunk number 29: annotationTools.Rnw:275-276 ################################################### existing_ps_human<-!is.na(ps_human) ################################################### ### code chunk number 30: annotationTools.Rnw:281-282 ################################################### LFC_mouse<-table_mouse$M[rep(match(ps_mouse[existing_ps_human],table_mouse$Probe.Set.ID),length_ps_human[existing_ps_human])] ################################################### ### code chunk number 31: annotationTools.Rnw:287-288 ################################################### LFC_human<-table_human$log2FC.HD.caudate.grade.0.2.vs.controls[match(unlist(ps_human[existing_ps_human]),table_human$Probe.Set.ID)] ################################################### ### code chunk number 32: annotationTools.Rnw:293-298 (eval = FALSE) ################################################### ## plot(LFC_mouse,LFC_human,col=rep(1:length(ps_human[existing_ps_human]),length_ps_human[existing_ps_human]),pch=16,cex=1.5,xlab='log fold change in mouse',ylab='log fold change in human') ## abline(h=0) ## abline(v=0) ## abline(0,1) ## legend(x=0.25,y=-0.77,legend=lapply(gs_human[existing_ps_human],function(x){paste(unique(x),sep=',')}),text.col=1:length(ps_human[existing_ps_human])) ################################################### ### code chunk number 33: annotationTools.Rnw:303-308 ################################################### plot(LFC_mouse,LFC_human,col=rep(1:length(ps_human[existing_ps_human]),length_ps_human[existing_ps_human]),pch=16,cex=1.5,xlab='log fold change in mouse',ylab='log fold change in human') abline(h=0) abline(v=0) abline(0,1) legend(x=0.25,y=-0.77,legend=lapply(gs_human[existing_ps_human],function(x){paste(unique(x),collapse=',')}),text.col=1:length(ps_human[existing_ps_human])) ################################################### ### code chunk number 34: annotationTools.Rnw:322-323 ################################################### sessionInfo()