Closed yarden closed 9 years ago
Nevermind, I realized this was written for a very old edgeR version (and possibly old rpy2). I rewrote a wrapper to edgeR with rpy2 that looks something like this:
robjects.r('''
library(edgeR)
''')
base = importr("base")
# Assume two groups (pairwise comparison)
groups = robjects.r('''1:2''')
read_delim = robjects.r["read.delim"]
counts_file_params = {"sep": delimiter,
"row.names": gene_id_col}
counts = read_delim(counts_fname, **counts_file_params)
print "counts: ", counts
# can include lib.sizes here if needed
params = {'group' : groups}
y = robjects.r.DGEList(counts, **params)
y = robjects.r.calcNormFactors(y)
y = robjects.r.estimateCommonDisp(y)
et = robjects.r.exactTest(y, dispersion=dispersion)
tags = robjects.r.topTags(et)
tags_df = tags[0]
result = {"exactTest": et,
"tags": tags_df,
"y": y}
return result
Yarden -- sorry I missed this the other day. You're right, that code is crazy old and certainly not up to date with the best thing to do now. Thanks so much for the updated code for anyone who's looking at this. If you want to submit a pull request I'm happy to pull in a new script to not confuse anyone. Sorry again about the old code and thanks again.
Hi Brad,
In your nice
count_diffexp.py
script (https://github.com/chapmanb/bcbb/blob/5a773e3212bc7d20776cdecc12ad75c64ab2a694/stats/count_diffexp.py), you use rpy2 to call edgeR. The script referencesrobjects.globalEnv
but it looks like at least in my rpy2 version it'srobjects.globalenv
-- do you know what explains the difference?Thanks, Yarden