R script
0
0
Entering edit mode
Fangxin Hong ▴ 810
@fangxin-hong-912
Last seen 10.2 years ago
> Hi Fangxin > can you send me the R script you mentioned in your > e-mail below: > "Thanks, Robert. > I made the functions myself using the handout from the > short Course(this June), it turns out to be pretty > simple. So I would provide the R script of doing this > if somebody ask for. > Good day. > Fangxin" You guys are fast! I attached the R script below. I used ATH1 array as example, you can change it to whatever system you are using. For example, I am looking for genes (on ATH1 array) that contain "replication" in GOterm. Good luck! Fangxin ####### #function used to search for GO terms ########### GOTerm2Tag=function(term) { GTL=eapply(GOTERM,function(x) { grep(term,x at Term,value=TRUE) }) Glen=sapply(GTL,length) names(GTL[Glen>0]) } ##Example (get GOID of the terms that contain replication) GO.rep=GOTerm2Tag("replication") ######## #GO for all genes on ATH1 array ######## GO.Ath1=mget(AffyID,ath1121501GO) ##GO for all genes on ATH1 GOID.Ath1=sapply(GO.Ath1, function(x) { ##GO term for all genes on ATH1 onts=sapply(x, function(z) z$GOID) }) ######### #FUNCTION: Search for genes that contain the target GOID ######### GOID2Gene=function(GOID,GOID.Ath1) { ##GOID: target GOID you are looking in gene GOID.finder=sapply(GOID.Ath1,function(x) { grep(GOID,unlist(x),value=TRUE) }) GOID.finder.len=sapply(GOID.finder,length) names(GOID.finder.len>0) } ##Example: output AffyID of genes that has GOID "GO:0016563" > GOID2Gene("GO:0016563",GOID.Ath1) ######Example#################################### #look for all genes that involve in replication #output AffyID of all genes involving in replication ########## AffyID.rep=c() for ( i in GO.rep) { AffyID.rep=c(AffyID.rep,GOID2Gene(i,GOID.Ath1)) } AffyID.rep.unique=unique(AffyID.rep) -------------------- Fangxin Hong Ph.D. Plant Biology Laboratory The Salk Institute 10010 N. Torrey Pines Rd. La Jolla, CA 92037 E-mail: fhong at salk.edu (Phone): 858-453-4100 ext 1105
GO GO • 795 views
ADD COMMENT

Login before adding your answer.

Traffic: 574 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6