regular expression for targets
2
0
Entering edit mode
@darteta001ikasleehues-2388
Last seen 10.2 years ago
Dear list, I have a set of gpr files that I have read in using read.maimages(), all of them ending with the number and the date of the experiment. When I plot the intensities using boxplot() I get the full name of the sample, i.e. with these long endings. How can I remove these endings? > data$targets FileName slide 27_3_210408 slide 27_3_210408.gpr slide 28_3_210408 slide 28_3_210408.gpr slide 31_3_210408 slide 31_3_210408.gpr slide 32_3_220408 slide 32_3_220408.gpr slide 33_3_220408 slide 33_3_220408.gpr . . . After looking in the archives of BioC and R I tried the following code and variations of that but with no luck (I am probably far off the right expression). I am trying to store the filenames under a vector that can be given as argument to boxplot > names = sub('(_3_)(\.)','',data$targets,perl=TRUE) Can anyone help me? Thanks D.
• 840 views
ADD COMMENT
0
Entering edit mode
Jenny Drnevich ★ 2.0k
@jenny-drnevich-2812
Last seen 5 months ago
United States
HI David, Once you figure out how to cut down the names to something shorter, you can just tell read.maimages() to use those short names instead of the file names. See ?read.maimages and the names argument: names: character vector of names to be associated with each array as column name. Defaults to removeExt(files). That way, you'll have the shorter names no matter what. Cheers, Jenny At 04:31 AM 7/16/2008, Carlos J. Gil Bellosta wrote: >Or you can use strsplit to break the name of the file up to the ".". > >Regards, > >Carlos J. Gil Bellosta >http://www.datanalytics.com > >_______________________________________________ >Bioconductor mailing list >Bioconductor at stat.math.ethz.ch >https://stat.ethz.ch/mailman/listinfo/bioconductor >Search the archives: >http://news.gmane.org/gmane.science.biology.informatics.conductor Jenny Drnevich, Ph.D. Functional Genomics Bioinformatics Specialist W.M. Keck Center for Comparative and Functional Genomics Roy J. Carver Biotechnology Center University of Illinois, Urbana-Champaign 330 ERML 1201 W. Gregory Dr. Urbana, IL 61801 USA ph: 217-244-7355 fax: 217-265-5066 e-mail: drnevich at illinois.edu
ADD COMMENT
0
Entering edit mode
@joern-toedling-1244
Last seen 10.2 years ago
Try myNames = gsub("\\_.*$","", data$targets$FileName) Note that "names" is not a good name for a variable since there already is a very fundamental function called 'names', which you probably don't want to maks. Regards, Joern DAVID ARTETA GARCIA wrote: > Dear list, > > I have a set of gpr files that I have read in using read.maimages(), > all of them ending with the number and the date of the experiment. > When I plot the intensities using boxplot() I get the full name of the > sample, i.e. with these long endings. How can I remove these endings? > >> data$targets > FileName > slide 27_3_210408 slide 27_3_210408.gpr > slide 28_3_210408 slide 28_3_210408.gpr > slide 31_3_210408 slide 31_3_210408.gpr > slide 32_3_220408 slide 32_3_220408.gpr > slide 33_3_220408 slide 33_3_220408.gpr > . > . > . > > After looking in the archives of BioC and R I tried the following code > and variations of that but with no luck (I am probably far off the > right expression). I am trying to store the filenames under a vector > that can be given as argument to boxplot > >> names = sub('(_3_)(\.)','',data$targets,perl=TRUE) > > Can anyone help me? > > Thanks > > D.
ADD COMMENT
0
Entering edit mode
Or you can use strsplit to break the name of the file up to the ".". Regards, Carlos J. Gil Bellosta http://www.datanalytics.com
ADD REPLY

Login before adding your answer.

Traffic: 697 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