Entering edit mode
6.9 years ago
hassanlou110
▴
40
Hello every body, I am trying to subset data in an gset, but I am running into issue. Here's essentially what I'm attempting:
library(Biobase)
library(GEOquery)
library(limma)
dataset <- "GSE21942"
platform <- "GPL570"
load series and platform data from GEO
gset <- getGEO(dataset, GSEMatrix =TRUE, AnnotGPL=TRUE, destdir ="../data/" )
if (length(gset) > 1) idx <- grep(platform, attr(gset, "names")) else idx <- 1
gset <- gset[[idx]]
ex <- exprs(gset)
data normalization
ex <- log2(ex)
ex <- normalizeQuantiles(ex)
sub-setting data
colnames(ex) <- c(paste("control", 1:15), paste("MS", 1:14))
ex <- ex[,!colnames(ex) %in% c("MS 10", "MS 11", "MS 13")]
gr <- c(rep("control",15), rep("MS",11))
pData(gset) <- read.table("../source/phenod1.txt", header = T, sep="\t" )
exprs(gset) <- ex
After returning ex in to gset I encountered to this error:
Error in .validate_assayDataElementReplace(obj, value) : object and replacement value have different dimensions
I know that now my assayData is different from my pData How can I solve the problem?
How can I subset my assayData?
I use this command:
which is has equal sample names of "MS 10", "MS 11", "MS 13" but this Error apear:
please kindly help me!
Try this:
Your other command should be:
Hi thank you for your replay but this Error appear:
Dear Kevin, Before I updating my R and RStudio, I didn't have this problem. It means I subsetted ex and it automatically changed the other objects in the ExpressionSet and there was no difference in ex and assayData dimensions. But now, I don't know....why?
Why are you trying to filter the assayData object with the colnames from
ex
? You can just filter on theex
ExpressionSet object, an that will then automatically the other objects in the ExpressionSet object.Your comments do not match up to your initial post...
Dear Kevin, Before I updating my R and RStudio, I didn't have this problem. It means I subsetted ex and it automatically changed the other objects in the ExpressionSet and there was no difference in ex and assayData dimensions. But now, I don't know....why?
Okay, yes, different things can change across different versions of R.
How are you creating / reading in the assayData object? Can you share all code related to assayData?
This is my code for reading assayData:
and this is colnames(ex) after subsitting:
which is without MS 10, MS 11, MS 13.
I can not return ex to my gset:
Okay, so you could try:
I try that, unfortunately this error appears:
type
str(assayData(gset))
As I have limitation in comment insertion, I answer you by editing this comment
Dear Kevin, It don't work again!!!
assayData is just a reference to the expression values, which can be accessed with
exprs()
Try this:
Also, why are you using this line:
exprs(gset) <- ex
? That will cause a lot of issues.Dear Kevin Thank you very much for your support and help, it finally worked in R version 3.1.2 instead of 3.4.3. Thanks a lot again!