Question: GAGE and Pathview from RNA-Seq: 'ref.idx' and 'samp.idx' when no replicates
gravatar for user31888
14 months ago by
United States
user3188830 wrote:

I am new to R and I am sure it is a very trivial question.

I am following the 'RNA-Seq Data Pathway and Gene-set Analysis Workflows' (here:

At steps 3 and 4 (sections 4.4 and 4.5), there is the following commands:

> library(gage)
> ref.idx=5:8
> samp.idx=1:4
> data(
> #knockdown and control samples are unpaired
> cnts.kegg.p <- gage(cnts.norm, gsets =, ref = ref.idx, samp = samp.idx, compare ="unpaired")
#differential expression: log2 ratio or fold change, uppaired samples
> cnts.d= cnts.norm[, samp.idx]-rowMeans(cnts.norm[, ref.idx])

where 'ref.idx' and 'samp.idx' are the numeric vectors of column numbers for the reference and target conditions respectively.

In the example taken in this workflow, the data frame consists of 4 target samples (columns 1 to 4) and 4 reference samples (columns 5 to 8).

But my data only contains 1 reference sample (column 1) and 1 target sample (column 2). So I get the 'ref.idx' and 'amp.idx' based on pattern matching in the column names as follows:

> cn=colnames(cnts)
> ref.idx=grep('REF',cn,
> samp.idx=grep('SAMP',cn,
> ref.idx
[1] 1
> samp.idx
[1] 2

Since gage expect a numeric vector, the last command below returns an error:

> exp.d = exp.fc[, samp.idx]-rowMeans(exp.fc[, ref.idx])
Error in exp.fc[, samp.idx] : incorrect number of dimensions​
ADD COMMENTlink modified 14 months ago by Luo Weijun1.4k • written 14 months ago by user3188830
gravatar for Luo Weijun
14 months ago by
Luo Weijun1.4k
United States
Luo Weijun1.4k wrote:
You should do something like: ref.idx=1 samp.idx=2 cnts.kegg.p <- gage(cnts.norm, gsets =, ref= ref.idx, samp = samp.idx)
ADD COMMENTlink written 14 months ago by Luo Weijun1.4k

I tried that, but it returned the same error. Anyway, I used the edgeR fork to bypass the 'exp.d' calculation and it works now. Thanks !

ADD REPLYlink written 14 months ago by user3188830
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 360 users visited in the last hour