Question: RUVseq control genes - invalid subscript type 'list'
1
3.4 years ago by
eteleeb10
eteleeb10 wrote:

Hi,

I am using RUVseq for removing unwanted variation with a number of housekeeping genes as control genes but I got this error:

Error in Ycenter[, cIdx] : invalid subscript type 'list'

This is the code I use:

batchCorrectedSet <- RUVg(as.matrix(countTable), control.genes, k=1)

Also, if I remove "as.matrix" from the command I got this error:

unable to find an inherited method for function ‘RUVg’ for signature ‘"data.frame", "data.frame", "numeric"’

Any help will be appreciated. Thank you.

-A

ruvseq • 794 views
modified 3.4 years ago • written 3.4 years ago by eteleeb10
Answer: RUVseq control genes - invalid subscript type 'list'
0
3.4 years ago by
davide risso830
davide risso830 wrote:

Hi,

the first error is because your object "control.genes" is a list, while the function requires a vector (of integer or characters). Note that this can happen if control.genes is a data.frame (data.frames are lists), which is what I'm guessing from the second error.  If that's the case, make sure than when you're extracting the proper column, it's character (or integer) and not a factor.

As for your second error, the first argument of RUVg needs to be a matrix, it will not work with data.frames. Your first call using as.matrix is fine.

Answer: RUVseq control genes - invalid subscript type 'list'
0
3.4 years ago by
eteleeb10
eteleeb10 wrote:

Thank you Davide for your reply. I am reading the housekeeping genes as a data.frame and selection the first column that has the gene IDs. I used as.vector() but now I am having this error:

Error in Ycenter[, cIdx] : subscript out of bounds

Thank you.

You have to make sure that all the IDs in the control.genes vector are present in countTable.

You can use the intersect() or the match() functions to ensure that. Something along these lines should work:

mycontrols <- intersect(control.genes, rownames(countTable))
batchCorrectedSet <- RUVg(as.matrix(countTable), mycontrols, k=1)

Provided that your countTable object has row.names.

Answer: RUVseq control genes - invalid subscript type 'list'
0
3.4 years ago by
eteleeb10
eteleeb10 wrote:

Oops!. I see the problem now. I have transcript IDs in the count table instead of gene IDs. Thank you Davide for your help. I greatly appreciate it.