[BioC] how to exrtact col. names from exprs()

Adaikalavan Ramasamy ramasamy at cancer.org.uk
Sat Aug 14 00:30:04 CEST 2004


mat <- matrix( rnorm(6), nc=3 )
colnames(mat) <- c( "C.cel", "A.cel", "B.cel" )
mat
          C.cel      A.cel     B.cel
[1,] -0.7519613 -0.8182346 0.4788695
[2,] -1.7171199  1.4231551 0.5341957
 
mapping <- cbind( c("A.cel", "B.cel", "C.cel"), c("first", "second",
"third") )
mapping
     [,1]    [,2]    
[1,] "A.cel" "first" 
[2,] "B.cel" "second"
[3,] "C.cel" "third" 
  
match( as.character(colnames(mat)), as.character(mapping[ ,1]) )
[1] 3 1 2
ord <- match( colnames(mat), as.character(mapping[ ,1]) )
colnames(mat) <- mapping[ ord, 2 ]
mat
          third      first    second
[1,] -0.7519613 -0.8182346 0.4788695
[2,] -1.7171199  1.4231551 0.5341957

 

On Fri, 2004-08-13 at 22:53, S Peri wrote:
> Dear group, 
>  
> I have 50 CEL files. I have the expression values and
> the colnames extracted as matrix files. The colnames
> are named with the .cel file names. Now in a different
> file the .CEL files are referenced to sample name. I
> am interested in classifying the studies based on
> samples. 
> The other file looks like this:
> 
> XXXXXXXXX.CEL     xxKL_98
> XXXXXxxxX.CEL     X2KL_98
> XXXXXXXXX.CEL     X4KL_99
> .....
> 
> 
> 
> Now in R my output looks like this:
> 
> > colnames(gliexp)[1:6]
> 
> [1] "XXXXXXXXX.CEL" "XXXXXXXXXXX.CEL" "XXXXXXXXXX.CEL"
> "XXXXXXXXXXXXXXXX.CEL" "XXXXXXXXXXX.CEL"
> 
> 
> I tried using grep function and it takes up only one
> pattern. If I have to do this for whole study I would
> have to do 150 times and I cannot do that. 
> Is there some way similar to grep() or just grep()
> itself where it takes more patterns.  where I can
> define certain files (as patterns) as one go and
> classiffy them as some category.  The file names are
> unique with numbers and doe not seem to have specific
> pattern. 
> 
> Please help me. 
> thank you
> 
> Cheers
> S
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
>



More information about the Bioconductor mailing list