Edit sample Names
2
0
Entering edit mode
Yen Lin Chia ▴ 50
@yen-lin-chia-610
Last seen 9.7 years ago
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
• 902 views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 1 day ago
United States
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@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@stat.math.ethz.ch https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor
ADD COMMENT
0
Entering edit mode
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@stat.math.ethz.ch [mailto:bioconductor-bounces@stat.math.ethz.ch]On Behalf Of James MacDonald Sent: 11 February 2004 17:53 To: yenlin@stanford.edu; bioconductor@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@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@stat.math.ethz.ch https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor _______________________________________________ Bioconductor mailing list Bioconductor@stat.math.ethz.ch https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor
ADD REPLY
0
Entering edit mode
@james-w-macdonald-5106
Last seen 1 day ago
United States
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@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@stat.math.ethz.ch [mailto:bioconductor-bounces@stat.math.ethz.ch]On Behalf Of James MacDonald Sent: 11 February 2004 17:53 To: yenlin@stanford.edu; bioconductor@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@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@stat.math.ethz.ch https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor _______________________________________________ Bioconductor mailing list Bioconductor@stat.math.ethz.ch https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor
ADD COMMENT
0
Entering edit mode
Hi James Yes you are right, its a forward and back lash effect, > a <- "c:\my documents\otherdirs\celfile.CEL" > a [1] "c:my documentsotherdirscelfile.CEL" > a <- "c:/my documents/otherdirs/celfile.CEL" > basename(a) [1] "celfile.CEL" Aedin -----Original Message----- From: bioconductor-bounces+aedin.culhane=ucd.ie@stat.math.ethz.ch [mailto:bioconductor-bounces+aedin.culhane=ucd.ie@stat.math.ethz.ch]On Behalf Of James MacDonald Sent: 11 February 2004 18:16 To: yenlin@stanford.edu; bioconductor@stat.math.ethz.ch; aedin.culhane@ucd.ie Subject: RE: [BioC] Edit sample Names 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@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@stat.math.ethz.ch [mailto:bioconductor-bounces@stat.math.ethz.ch]On Behalf Of James MacDonald Sent: 11 February 2004 17:53 To: yenlin@stanford.edu; bioconductor@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@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@stat.math.ethz.ch https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor _______________________________________________ Bioconductor mailing list Bioconductor@stat.math.ethz.ch https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor _______________________________________________ Bioconductor mailing list Bioconductor@stat.math.ethz.ch https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor
ADD REPLY

Login before adding your answer.

Traffic: 512 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

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

Powered by the version 2.3.6