[BioC] Converting annotate lists to a matrix

Wolfgang Huber huber at ebi.ac.uk
Thu Feb 10 13:47:02 CET 2005


Hi Michael,
try this:


res = do.call("rbind", args=lapply(seq(along=xx), function(i)
                  cbind(names(xx)[i], xx[[i]])))


 > res[1:5,]
      [,1]        [,2]
[1,] "Z22536_at" "04010"
[2,] "Z22536_at" "04060"
[3,] "Z22536_at" "04350"
[4,] "X60221_at" "00190"
[5,] "X60221_at" "00193"


Michael watson (IAH-C) wrote:
> Hi
> 
> This is kind of an R problem, but on bioconductor data.  For example, I
> have the hu6800PATH environment from the hu6800 annotation package.  The
> example in the help is this:
> 
> xx <- as.list(hu6800PATH)
> xx <- xx[!is.na(xx)]
> 
> What I actually want is a matrix with two columns, the first being probe
> id and the second being pathway id - I'm going to do some relational
> joins with this data using merge().
> 
> I've got as far as:
> 
> as.matrix(unlist(xx))
> 
> But that doesn't give me exactly what I want.  The rownames of the
> resulting matrix are set to the probe_ids but where there are duplicate
> probe ids (where probes are in >1 pathway) then R appends a numerator on
> the end.
> 
> Can anyone help me convert the list format from an annotation package to
> a matrix as I describe above?

-- 
Best regards
   Wolfgang

-------------------------------------
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