Error In Taglist I Subscript Out Of Bounds
ago by Guest User • 12k Guest User • 12k wrote: I am new to R and edgeR. I am trying to follow to example 9. Case Study: deep-sequenced short tags from the edgeR manual. I download the data from http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSM272105 by clicking the full table and then saving webpage as .txt file containing First 4 rows as below folled by fifth which contains the tag seq and count. #SEQUENCE = #COUNT = #TPM = tags per million SEQUENCE COUNT TPM CATCGCCAGCGGGCACC 1 0.37 Now we I follow the steps of 9.3 reading data and creating the DGElist: After running < d<- readDGE(targets, skip = 5, comment.char = "#"), I get Error in taglist[[i]] : subscript out of bounds Can anyone please help, how I can solve this issue. Best regards, Ashutosh -- output of sessionInfo(): R version 3.0.2 (2013-09-25) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] edgeR_3.4.2 limma_3.18.7 -- Sent via the guest posting facility at bioconductor.org. edger ADD COMMENT • link • Not following Follow via messages Follow via email Do not follow modified 2.8 years ago by Mark Robinson • 870 • written 2.8 years ago by Guest User • 12k 0 2.8 years ago by Mark Robinson • 870 Mark Robinson • 870 wrote: Dear Ashutosh, I wasn't able to (nicely) get exactly the same files from GEO, but here is an alternative: See: http://www.ebi.ac.uk/arrayexpress/experiments/E-MTAB-71/samples/ f <- "ftp://ftp.ebi.ac.uk/pub/databases/microarray/data/experiment/MTA B/E-MTAB-71/E-MTAB-71.raw.1.zip" bf <- basename(f) download.file(f, bf) # download ZIP from ArrayExpress unzip(bf) # should put the 8 TXT files in current dir tg <- dir(".","^DLCK|WT") library("edgeR") counts <- readDGE(tg)$counts counts[is.na(counts)] <- 0 grp <- sapply(colnames(counts),function(u) strsplit(u,"_")[[1]][1]) d <- DGEList(counts=counts, group=grp) This should return: > d An object of class "DGEList" $counts DLCK.TG_1 DLCK.TG_2 DLCK.TG_3 DLCK.TG_4 WT_1 WT_3 WT_4 WT_6 AAAAAAAAAAAAAAAAA 22653 3059 1366 6574 7782 35096 6623 9633 AAAAAAAAAAAAAAAAC 82 51 55 93 412 134 335 519 AAAAAAAAAAAAAAAAG 2 3 7 9 59 5 45 84 AAAAAAAAAAAAAAAAT 118 471 359 717 1842 94 2465 3311 AAAAAAAAAAAAAAACA 67 4 4 12 17 108 12 21 844311 more rows ... $samples group lib.size norm.f
post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Error : subscript out of bounds m<-matrix(byrow=FALSE) t<-as.list(na.exclude(x)) j<-0 o<-0 for(i in 1:998) { d<- 5*(i-1)+3 if(t[[d]][[1]]>80) { j<-j+1 e[j]<-d l<-length(t[[d]]) u<-t[[d]] price_rand<-t[[d-1]] n<-0 for(k in 1:l) { if((u[k]>49)&&(u[k]<51)) { n<-n+1 m[n,j]<-price_rand[k] } } } } I am getting error in assigning the values to a matrix. *Error in m[n, j] <- price_rand[k] : subscript out of bounds* * * How to correct this https://support.bioconductor.org/p/56743/ ? Please suggest me the correct method. Thanx for the help in the advance -- Avinash Barnwal Final year undergraduate student Statistics and informatics Department of Mathematics IIT Kharagpur [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code. Michael Weylandt http://r.789695.n4.nabble.com/Error-subscript-out-of-bounds-td3804276.html Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: Error : subscript out of bounds Take a look at "m". Your error should be quite clear More generally: we don't do homework help on this list. Michael Weylandt On Sat, Sep 10, 2011 at 12:59 PM, avinash barnwal < [hidden email]> wrote: > m<-matrix(byrow=FALSE) > t<-as.list(na.exclude(x)) > j<-0 > o<-0 > for(i in 1:998) > { > d<- 5*(i-1)+3 > if(t[[d]][[1]]>80) > { > j<-j+1 > e[j]<-d > l<-length(t[[d]]) > u<-t[[d]] > price_rand<-t[[d-1]] > n<-0 > for(k in 1:l) > { > > > > > > > if((u[k]>49)&&(u[k]<51)) > { > n<-n+1 > m[n,j]<-price_rand[k] > } > } > } > } > > I am getting error in assigning the values to a matrix. > *Error in m[n, j] <- price_rand[k] : subscript out of bounds* > * > * > How to correct this ? > Please suggest me the correct method. > > Thanx for the help
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the http://stackoverflow.com/questions/15031338/subscript-out-of-bounds-general-definition-and-solution company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Subscript out of bounds - general definition and solution? up vote 16 down vote favorite 18 When working with R error in I frequently get the error message "subscript out of bounds". For example: # Load necessary libraries and data library(igraph) library(NetData) data(kracknets, package = "NetData") # Reduce dataset to nonzero edges krack_full_nonzero_edges <- subset(krack_full_data_frame, (advice_tie > 0 | friendship_tie > 0 | reports_to_tie > 0)) # convert to graph data farme krack_full <- graph.data.frame(krack_full_nonzero_edges) # Set vertex attributes for (i in V(krack_full)) { for (j in names(attributes)) { krack_full <- set.vertex.attribute(krack_full, j, index=i, attributes[i+1,j]) } error in taglist } # Calculate reachability for each vertix reachability <- function(g, m) { reach_mat = matrix(nrow = vcount(g), ncol = vcount(g)) for (i in 1:vcount(g)) { reach_mat[i,] = 0 this_node_reach <- subcomponent(g, (i - 1), mode = m) for (j in 1:(length(this_node_reach))) { alter = this_node_reach[j] + 1 reach_mat[i, alter] = 1 } } return(reach_mat) } reach_full_in <- reachability(krack_full, 'in') reach_full_in This generates the following error Error in reach_mat[i, alter] = 1 : subscript out of bounds. However, my question is not about this particular piece of code (even though it would be helpful to solve that too), but my question is more general: What is the definition of a subscript-out-of-bounds error? What causes it? Are there any generic ways of approaching this kind of error? r matrix sna share|improve this question asked Feb 22 '13 at 19:00 histelheim 1,40921339 1 @January has it. It means you're trying to get something, say a column or row, that doesn't exist. For example, say your table has 10 rows and your function tries to call for row 15. –Ben Feb 22 '13 at 19:16 1 And for anyone who's wondering about this PARTICULAR piece of code (from the McFarland network analysis labs) it's because igraph has changed its indexing scheme from 0-based to 1-based, and so '(i-1)' in 'subc