[BioC] Conversion of affymetrix annotation environment to matrix

Wolfgang Huber huber at ebi.ac.uk
Fri Mar 10 16:42:53 CET 2006


Hi Michael,

fun = function(i) {
   res = matrix(unlist(lis[[i]]), ncol=3, byrow=TRUE)
   cbind(rep(names(lis)[i], nrow(res)), res)
}

z = do.call("rbind", lapply(seq(along=lis), fun))

will do (see below), I wonder if anybody can give a simpler solution!


Best wishes
  Wolfgang

 > z
       [,1]        [,2]         [,3]  [,4]
  [1,] "155157_at" "GO:0006281" "NAS" "BP"
  [2,] "155157_at" "GO:0016538" "ISS" "MF"
  [3,] "155157_at" "GO:0016538" "NAS" "MF"
  [4,] "155122_at" NA           NA    NA
  [5,] "155036_at" NA           NA    NA
  [6,] "154985_at" NA           NA    NA
  [7,] "154948_at" "GO:0003743" "ISS" "MF"
  [8,] "154948_at" "GO:0005085" "IDA" "MF"
  [9,] "154948_at" "GO:0005085" "ISS" "MF"



michael watson (IAH-C) wrote:
> Hi
> 
> I want to convert the drosgenome1GO environment to a matrix with
> columns:
> 
> Affy-probe_id, GOID, GOEvidence, GOOntology
> 
> I have figured out that if I do:
> 
> lis <- as.list(drosgenome1GO)
> lis2 <- lis[!is.na(lis)]
> m <- matrix(unlist(lis2), ncol=3, byrow=TRUE)
> 
> I get something approaching what I want (ie a matrix with columns GO ID,
> GO Evidence and GO Ontology), but I also want the actual affy probe ids
> in there as a column (I eventually want to do a table join from the
> output of topTable() to this table)
> 
> Thanks
> Mick

-------------------------------------
Wolfgang Huber
European Bioinformatics Institute
European Molecular Biology Laboratory
Cambridge CB10 1SD
England
Phone: +44 1223 494642
Fax:   +44 1223 494486
Http:  www.ebi.ac.uk/huber



More information about the Bioconductor mailing list