Converstion of Ranged Summarized Experiment to Data Frame
1
0
Entering edit mode
sylvie2 • 0
@sylvie2-24355
Last seen 4.1 years ago

Hi,

Is it possible to convert a Ranged Summarized Experiment into a Matrix or a Data Frame. If so can you provide a script to do so?

Thanks!

SummarizedExperiment RangedSummarizedExperiment • 3.5k views
ADD COMMENT
0
Entering edit mode
svlachavas ▴ 830
@svlachavas-7225
Last seen 13 months ago
Germany/Heidelberg/German Cancer Resear…

Dear Sylvie,

could you provide more details about the data type that you analyze, and your goal ? Generally the scope of this group is not just to provide scripts, rather to assist in specific tasks and technical-methodological questions regarding R packages and Bioconductor-

based on your question, initially you can read in the detail the R package RaggedExperiment:

http://bioconductor.org/packages/release/bioc/vignettes/RaggedExperiment/inst/doc/RaggedExperiment.html#7*assayfunctions

where it provides various functions to represent ranged data into a resulting matrix-

more directly, you could use the function assay as illustrated below or directly type ?RangedSummarizedExperiment:

nrows <- 200; ncols <- 6
counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows)
rowRanges <- GRanges(rep(c("chr1", "chr2"), c(50, 150)),
                     IRanges(floor(runif(200, 1e5, 1e6)), width=100),
                     strand=sample(c("+", "-"), 200, TRUE),
                     feature_id=sprintf("ID%03d", 1:200))
colData <- DataFrame(Treatment=rep(c("ChIP", "Input"), 3),
                     row.names=LETTERS[1:6])
rse <- SummarizedExperiment(assays=SimpleList(counts=counts),
                     rowRanges=rowRanges, colData=colData)

xx <- assay(rse)
head(xx)
            A        B        C         D         E        F
[1,] 3412.971 9201.326 8040.690 5732.4395 1662.0214 1865.154
[2,] 4691.457 8856.418 5962.201 3237.7014 3872.6439 6712.661
[3,] 4542.271 7572.359 9178.876 4994.8515 8413.9258 2322.053
[4,] 7670.194 3332.390 5971.705 9894.6457 5655.6748 5615.336
[5,] 8056.919 2571.537 1035.424  374.3122 5812.4404 2452.022
[6,] 2013.136 1619.997 9314.377 3784.2708  654.1187 2885.155

Hope that helps,

Efstathios

ADD COMMENT
0
Entering edit mode

Dear Efstathios,

I'm working with single cell ATAC datasets. I was trying to generate a heatmap showing accessibiltiy to transcription factor motif sequences by calling geneAccessibility() and heatmapGeneAccessibility from ATACCoGAPS both command lines from the latter.

However I was getting error messages owing to the fact that I was working with RangedSummarizedExperiment rather that a dataframe. Hence my need for a workaround.

ADD REPLY
0
Entering edit mode

Dear Sylvie,

I have never worked with single cell ATAC analysis-however, I think it would be much more helpful, instead of giving general descriptions, to either modify your post, or create a new one, including some example code that lead to your error, along with your sessionInfo. Additionally, you should tag also the responsive R packages that included the relative functions. Then, more people could comment or provide suggestions about your errors.

Efstathios

ADD REPLY

Login before adding your answer.

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