[BioC] Edit sample Names

Aedin aedin.culhane at ucd.ie
Wed Feb 11 19:06:47 MET 2004

Hi James,
You can use basename and dirname to pull these apart. Try:

sub(dirname(a), "", a)
sub(paste(dirname(a), "/", sep=""), "", a)

Would this do it?

Aedin Culhane

-----Original Message-----
From: bioconductor-bounces at stat.math.ethz.ch
[mailto:bioconductor-bounces at stat.math.ethz.ch]On Behalf Of James
Sent: 11 February 2004 17:53
To: yenlin at stanford.edu; bioconductor at stat.math.ethz.ch
Subject: Re: [BioC] Edit sample Names

I am sure you could extract the sampleNames, hit them with sub and then
put them back in, but I don't know regular expressions well enough to
tell you how to do it (I just tried and failed miserably).

My ugly hack would be to do something like this:

filenames <- list.files(pattern="\\.[cC][eE][lL]$") #Gets all .cel or
.CEL files in current directory

Then, if you used all these files you can do:

sampleNames(eset) <- filenames # Where eset is the exprSet (or
AffyBatch) you need to fix.

otherwise you can subset the filenames to choose the ones you used,
e.g., filenames[c(1,3,4,5,6)] or whatever.

My preferred way to set up the AffyBatch is to use the above list of
filenames in the call to ReadAffy so you don't have the long names:

Data <- ReadAffy(filenames=filenames)



James W. MacDonald
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109

>>> Yen Lin Chia <yenlin at stanford.edu> 02/10/04 06:25PM >>>

When I do Data<-ReadAffy(widget=TRUE), the sample names appeared to be
what I want, i.e. 10E, 2D, etc.  But, after the data are read, when I
type sampleNames(Data), the sample names is the whole path of the
like c:\my documents\....\....CEL, the names are simply too long for
histogram.  Anybody know how to fix the sample names?


Yen Lin

Bioconductor mailing list
Bioconductor at stat.math.ethz.ch 

Bioconductor mailing list
Bioconductor at stat.math.ethz.ch

More information about the Bioconductor mailing list