[BioC] Edit sample Names
James MacDonald
jmacdon at med.umich.edu
Wed Feb 11 19:15:41 MET 2004
It would on a *nix box, but not on win32. Note that the names are c:\my
documents\otherdirs\celfile.CEL
> a <- "c:\my documents\otherdirs\celfile.CEL"
> dirname(a)
[1] "."
> basename(a)
[1] "c:my documentsotherdirscelfile.CEL"
Blame it on Bill G. ;-D
Best,
Jim
James W. MacDonald
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623
>>> Aedin <aedin.culhane at ucd.ie> 02/11/04 01:06PM >>>
Hi James,
You can use basename and dirname to pull these apart. Try:
a<-"c:/progra~1/test"
basename(a)
dirname(a)
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
MacDonald
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)
HTH,
Jim
James W. MacDonald
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623
>>> Yen Lin Chia <yenlin at stanford.edu> 02/10/04 06:25PM >>>
Hi,
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
file,
like c:\my documents\....\....CEL, the names are simply too long for
histogram. Anybody know how to fix the sample names?
Thanks.
Yen Lin
_______________________________________________
Bioconductor mailing list
Bioconductor at stat.math.ethz.ch
https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor
_______________________________________________
Bioconductor mailing list
Bioconductor at stat.math.ethz.ch
https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor
More information about the Bioconductor
mailing list