Hi Ryan,
We use the RaggedExperiment
class because it allows you to do much more than what a simple data.frame
can do.
Have a look at the assay-functions
example at:
https://code.bioconductor.org/browse/RaggedExperiment/blob/master/inst/scripts/assay-functions-Ex.R
To highlight some of the examples, you can filter by non-silent mutations and reduce to genic regions via qreduceAssay
using gn
as the reference:
nonsilent <- function(scores, ranges, qranges)
any(scores != "Silent")
mutations <- qreduceAssay(mre, gn, nonsilent, "Variant_Classification")
To summarize the percentages (e.g., about 13947 rows have 0 % mutations):
table(rowSums(!is.na(mutations)) / ncol(mutations))
0 0.0111111111111111 0.0222222222222222 0.0333333333333333 0.0444444444444444 0.0555555555555556 0.0666666666666667 0.0777777777777778
13947 5163 2034 838 356 166 123 95
0.0888888888888889 0.1 0.111111111111111 0.122222222222222 0.133333333333333 0.144444444444444 0.155555555555556 0.166666666666667
41 43 31 27 26 10 15 9
0.177777777777778 0.188888888888889 0.2 0.211111111111111 0.222222222222222 0.233333333333333 0.244444444444444 0.255555555555556
15 8 7 21 7 9 5 3
0.266666666666667 0.277777777777778 0.288888888888889 0.3 0.322222222222222 0.333333333333333 0.344444444444444 0.355555555555556
4 7 4 5 1 1 1 1
0.366666666666667 0.377777777777778 0.411111111111111 0.422222222222222 0.433333333333333 0.511111111111111 0.522222222222222
1 1 3 1 1 1 2
You may be able to reconstruct the data.frame
from the data but I am not aware of the specific data organization (i.e., shape, variables, etc.) that you are looking for.
Perhaps mcols()
provides what you are looking for.
Best regards,
Marcel
I have previously seen that example that you highlight and it does not answer my question. The core of my question here is in concern to whether I can reconstruct the underlying
data.frame
when given aRaggedExperiement
of mutation data. There may be methods inRaggedExperiment
that replicate what I was doing on thedata.frame
when readingdata_mutations.txt
was directly, but my question was not about that.The specific data organization that I am looking for is an equivalent
data.frame
built from aRaggedExperiment
-- as far as I have seen the latter does not provide what I need, while the former is how I was solving the problem prior to exploring use of thecBioPortalData
package.Hi Ryan,
We do not have a way to easily go backwards to a
data.frame
but it can be done. We provide these data structures because they make use of powerfulGRanges
/ Bioconductor ecosystem.Without a concrete example, I can only provide limited help as I don't know what kind of
data.frame
you are looking for.If you're looking for the raw data, you could obtain that via the
downloadStudy
, anduntarStudy
functions incBioPortalData
.Please be more specific with illustrative and reproducible examples.
See this link https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
Best regards,
Marcel
I was trying to avoid doing this if I could. I was hoping there was an "easy" way to go from RaggedExperiment to data.frame, but it seems that using the raw data via downloadStudy is the most fit solution.
Thank you for your help!
I was looking into this more and it seems like you could use the
as.data.frame
method.There will likely be some information loss with this conversion.