Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Big cleanup of affymatrix importer. Now use E@exprs to get matrix from loaded data.

Also made row and colname import better by ensuring vector-handling, ensuring that getting single column/row data works without being converted into a single string instead of string in a list.
Removed ;1-hack and use NO_CONVERSION to ensure no extra computation is done when calculating r stuff.
Now AffyMatrix data is named as such.
This commit is contained in:
Truls Alexander Tangstad 2006-04-22 17:59:15 +00:00
parent d26dd54f5b
commit 553bfbe1ae
1 changed files with 21 additions and 15 deletions

View File

@ -186,19 +186,25 @@ class CelFileImportFunction(Function):
chooser.add_filter(cel_filter) chooser.add_filter(cel_filter)
chooser.add_filter(all_filter) chooser.add_filter(all_filter)
if chooser.run() == gtk.RESPONSE_OK: try:
logger.log('debug', "Selected files: %s" % ", ".join(chooser.get_filenames())) if chooser.run() == gtk.RESPONSE_OK:
rpy.r.library("affy") rpy.r.library("affy")
# hack: we append ";1" to make sure no r-object is returned to python (faster)
rpy.r('At.aBatch <- ReadAffy(filenames=c("%s"));1' % '", "'.join(chooser.get_filenames())) silent_eval = rpy.with_mode(rpy.NO_CONVERSION, rpy.r)
# we destroy it immediately to keep it from being on silent_eval('E <- ReadAffy(filenames=c("%s"))' % '", "'.join(chooser.get_filenames()))
# screen while we do something with the files
chooser.destroy() m = rpy.r('m <- E@exprs')
# also here we append ";1"
rpy.r('At.eSet <- expresso(At.aBatch, bg.correct=F, summary.method="liwong", pmcorrect.method="pmonly", normalize.method="qspline");1') vector_eval = rpy.with_mode(rpy.VECTOR_CONVERSION, rpy.r)
m = rpy.r('At.m <- exprs(At.eSet)') rownames = vector_eval('rownames(m)')
rownames = rpy.r('rownames(At.m)') colnames = vector_eval('colnames(m)')
colnames = rpy.r('colnames(At.m)')
return [dataset.Dataset(m, (('ids', rownames), ('filename', colnames)))] # We should be nice and clean up after ourselves
else: rpy.r.rm(["E", "m"])
if m:
return [dataset.Dataset(m, (('ids', rownames), ('filename', colnames)), "AffyMatrix Data")]
else:
logger.log("notice", "No data loaded from importer.")
finally:
chooser.destroy() chooser.destroy()