Hi, everyone When I ran this cript, There is Error in substring(tmp.subject, tmp.end[ex] + 1, tmp.start[ex + 1] - 1) : invalid substring argument(s)
Could someone figure out what the problem is? for(i in 1:length(genebody[,1])){ tmp.id<-as.vector(genebody[i,1]) # get gene id tmp.subject<-as.vector(genebody[i,2]) # get gene sequence tmp.exons<-exons[which(exons[,1]==tmp.id),] # get exons of the selected genes tmp.pattern<-as.vector(tmp.exons[,3]) # define exons as patterns for alignment tmp.align<-pairwiseAlignment(pattern=tmp.pattern, subject=tmp.subject,type="local") # align all exons pairwise to gene sequence tmp.start<-start(subject(tmp.align)) # vector of all alignment starts tmp.end<-end(subject(tmp.align)) # vector of all alignment ends for(ex in 1:(length(tmp.end)-1)){ # extract introns tmp.intron<-substr(tmp.subject,tmp.end[ex]+1,tmp.start[ex+1]-1) introns<-rbind(introns,cbind(tmp.id,tmp.end[ex]+1,tmp.start[ex+1]-1,tmp.intron)) } } Thank you -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-substr-tp4074312p4074312.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.