[BioC] Converting annotate lists to a matrix
John Zhang
jzhang at jimmy.harvard.edu
Thu Feb 10 14:44:24 CET 2005
>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().
You may try:
> xx <- as.list(hu6800PATH)
> xx <- unlist(xx, use.names = TRUE)
> xx <- cbind(names(xx), xx)
The first column of xx will be probe ids with an integer appended to the end if
a probe has multiple mappings. Use pattern match to remove the trailing integers
from the first column then you are done.
>
>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?
>
>Thanks
>Mick
>
>_______________________________________________
>Bioconductor mailing list
>Bioconductor at stat.math.ethz.ch
>https://stat.ethz.ch/mailman/listinfo/bioconductor
Jianhua Zhang
Department of Medical Oncology
Dana-Farber Cancer Institute
44 Binney Street
Boston, MA 02115-6084
More information about the Bioconductor
mailing list