To make some sense of the mess I made in the comments.
You were trying to reproduce the example from the SummarizedExperimet vignette. Let's see what each statement does:
nrows <- 200
ncols <- 6
This line constructs a count matrix with random values from the uniform distribution. The number of rows is the number of genes, columns are samples:
counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows)
This one defines the genes' chromosomal locations (you skipped it which is fine)
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))
Here they build the metadata table with one row for each sample (6) and they give each row one parameter, namely the Treatment which is either ChIP or Input
colData <- DataFrame(Treatment=rep(c("ChIP", "Input"), 3),
row.names=LETTERS[1:6])
Now build the container:
SummarizedExperiment(assays=list(counts=counts),
rowRanges=rowRanges, colData=colData)
The part you're failing on is generating the metadata. If you have your own data then you should put it in a count matrix and generate the metadata table properly with the correct dimensions.
Needless to say, there are packages that can generate SummarizedExperiment for you for some data sets.
It could help if you gave some examples to your errors or what you were trying to achieve.
I tried running this command :
And it shows error:
Don't create an answer to provide more info. This makes the question looks like it's been answered. Use the 'Add reply' button to reply to a comment.
You didn't generate
colData
properly, you have only one row in there, you should remove the quotes from1:20962
. But that is not the only error I thinkAs I have very basic knowledge about R. Can you suggest how can I modify them?
Hello parinv,
May I ask you please how did you generate the gene expression level from the probe levels. I would like to know which package did you use for this purpose.
Thank you!
Hi ryme,
I used summarize function first to summarize the probe-level data and then used probe2gene function from the EnrichmentBrowser package.
Hope this is useful.
Hello parinv,
May I ask you please how did you generate the gene expression level from the probe levels. I would like to know which package did you use for this purpose.
Thank you!
This past thread should be helpful: Human Exon array probeset to gene-level expression Also: How to combine expression values of multiple probes for one gene?
You can also consider an answer by Asaf at the end of the thread.