[BioC] 'AnnotatedDataFrame' and featureNames'

Martin Morgan mtmorgan at fhcrc.org
Thu May 24 15:32:38 CEST 2007


Hi Diego --

The following might help...

"diego arcelli" <diego.arcelli at gmail.com> writes:

> Hi to all
>
> I'd like to resolve this question:
>
>
> in R 2.4 and bioconductor 1.9 I used the follow string to read my phenodata
> in txt file (mysamplehe):
> where "esetmysamples" is my dataset
>
> # Reading and setting phenodata
>
>> pd <- read.phenoData(filename="mysamplesphe.txt", sep="\t", header=TRUE)
>> pData(esetmysamples)
>
> and this to remove AFFX-id probes
>
> ### Removing AFFX-id probes
>
>>ids <- (geneNames(esetmysamples))
>>ids.affx <- grep("^AFFX", ids)
>>ids.noaffx <- setdiff(c(1:length(ids)), ids.affx)
>>esetmysamples <- esetmysamples[ids.noaffx,]
>
> now, in R 2.5 and bioconductor 2.0 I must use read.'AnnotatedDataFrame'
> instead of 'read.phenoData' and 'featureNames'  instead of
>
> and here I have the Warning message:
>
>
>> setwd(workdir)
>> esetmysamples <- rma(mysamples)
> Background correcting
> Normalizing
> Calculating Expression
>> sampleNames(esetmysamples) <- smpls
>>
>> # Removing AFFX-id probes
>> ids <- (geneNames(esetmysamples))
> Warning message:
> 'geneNames' is deprecated.
> Use 'featureNames' instead.
> See help("Deprecated")

ids <- featureNames(esetmysamples)

>> ids.affx <- grep("^AFFX", ids)
>> ids.noaffx <- setdiff(c(1:length(ids)), ids.affx)
>> esetmysamples <- esetmysamples[ids.noaffx,]
>> setwd(workdir)
>> pd <- read.phenoData(filename="mysamplesphe.txt", sep="\t", header=TRUE)
> Warning messages:
> 1: read.phenoData is deprecated, use read.AnnotatedDataFrame instead
> 2: The phenoData class is deprecated, use AnnotatedDataFrame (with
> ExpressionSet) instead

adf <- read.AnnotatedDataFrame(filename="mysamplesphe.txt", sep="\t",
    header=TRUE)

The help page ?read.AnnotatedDataFrame might be helpful here.

>> #esetmysamples <- new("exprSet", exprs = exprs(esetmysamples), phenoData =
> pd)
>> phenoData(esetmysamples) <- pd
> Error in function (classes, fdef, mtable)  :
>         unable to find an inherited method for function "phenoData<-", for
> signature "ExpressionSet", "phenoData"
>>

phenoData(esetmysamples) <- adf

Alternatively, to live with the warning but not the error,

phenoData(esetmysamples) <- as(pd, "AnnotatedDataFrame")

Finally, take a look at section 4 of the vignette

  Biobase - An introduction to Biobase and ExpressionSets

for an approach that doesn't use read.AnnotatedDataFrame.

Hope that helps,

Martin

> Can anyone help me to write the right the R.script?
>
>
> thanks a lot
>
> ardi
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

-- 
Martin Morgan
Bioconductor / Computational Biology
http://bioconductor.org



More information about the Bioconductor mailing list