Subscript out of bounds


#1

How to solve error the folowing:
Error in G[i, ] : subscript out of bounds when using Drivernet R ?

Im importing a 412 x 31 matrix:
dat<-read.table(file="DRIVER.txt", row.names = NULL,header=TRUE, sep="\t")
mymatrix<-as.matrix(dat) # change to matrix

dim(mymatrix)
[1] 412 31

computeDrivers(patMutMatrix=mymatrix, patOutMatrix=mymatrix, influenceGraph=mymatrix, outputFolder = NULL,printToConsole = FALSE, weighted = FALSE)

Error in G[i, ] : subscript out of bounds...
Any thoughts on how to solve...


#2

I hope the following illustrates your error:

# Define matrix A with 10 rows and 5 columns
A = matrix(data = rnorm(50), nrow = 10, ncol = 5)
# Ask for the 10th row
print(A[10,])
# Ask for the 5th column
print(A[,5])
# Ask for the 11th row
print(A[11,])
# Ask for the 6th column
print(A[,6])

#3

Im trying to analyze a 412 by 31 matrix with the DriverNet package, however,
Im constantly getting that error. The code for DriverNet is straightforward:

Usage
computeDrivers(patMutMatrix, patOutMatrix, influenceGraph, outputFolder = NULL, printToConsole = FALSE, weighted = FALSE)

So, a matrix is created first from a table (412 x 31):

mydata<-read.table(file="Driver.txt", row.name = 1, header=TRUE, sep="\t")
mymatrix <-as.matrix(mydata, nrow = 412, ncol = 31)

computeDrivers(patMutMatrix = mymatrix, patOutMatrix= mymatrix, influenceGraph=mymatrix, outputFolder = NULL,

  •            printToConsole = FALSE, weighted = FALSE)
    

Error in G[i, ] : subscript out of bounds

Thanks again,


#4

The most likely source of the error message is that the data you are putting into the algorithm are not in the format that the function expects. You have put the same matrix in the first three arguments to computeDrivers, but these are meant to be three different types of information, so it seems likely that you need to do a few more steps before your data are ready for the algorithm.

The best place to start is probably reviewing the documentation for the package. I notice that the package includes some functions to pre-process data into the format required, and it also includes sample data which you could compare to your input data to see if you're on the right track.

(Beyond being able to skim documentation with the best of them, I have no experience with this specific package — you may have more luck finding people who do over on the Bioconductor support site)