GAGE and Pathview from RNA-Seq: 'ref.idx' and 'samp.idx' when no replicates
Entering edit mode
user31888 ▴ 30
Last seen 3.7 years ago
United States

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​
GAGE pathview • 1.1k views
Entering edit mode
Luo Weijun ★ 1.5k
Last seen 4 weeks ago
United States
You should do something like: ref.idx=1 samp.idx=2 cnts.kegg.p <- gage(cnts.norm, gsets =, ref= ref.idx, samp = samp.idx)
Entering edit mode

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 !


Login before adding your answer.

Traffic: 389 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6