[BioC] Limma and Names Assignment

Sean Davis sdavis2 at mail.nih.gov
Fri Oct 14 11:03:03 CEST 2011


On Fri, Oct 14, 2011 at 4:40 AM, Ovokeraye Achinike-Oduaran
<ovokeraye at gmail.com> wrote:
>
> Hi all,
>
> In trying to create a contrast matrix of interest, I thought it would
> be easier to assign one-word names to the different disease states. I
> seem to have gotten it to work for the GDS3715 data set that happens
> to be a 3x2 factorial experiment, I think. But for the seemingly less
> complex GDS3665, I  can't seem to get it right. It keeps giving me
> these errors(below). Any ideas as to what I could possibly be doing
> wrong? Any help will be greatly appreciated.
>
> Thanks.
>
> -Avoks
>
>
>
> >gds3665dat = getGEO('GDS3665',destdir=".")
> >gds3665eset = GDS2eSet(gds3665dat, do.log2=TRUE)
> > groups= pData(gds3665eset)$disease.state
> > groups
>  [1] diabetes diabetes diabetes diabetes diabetes control  control  control
>  [9] control  control
> Levels: control diabetes
>
> > groups[groups=="control"]="Control"
> Warning message:
> In `[<-.factor`(`*tmp*`, groups == "control", value = "Control") :
>  invalid factor level, NAs generated
> > groups[groups=="diabetes"]="T2D"
> Warning message:
> In `[<-.factor`(`*tmp*`, groups == "diabetes", value = "T2D") :
>  invalid factor level, NAs generated

Hi, Avoks.

"groups" above is a factor, not a character vector.  They look the
same, but they are different.  In the case below, you used paste()
which creates a character vector; hence, the behavior is different.
If you convert to a character vector first, things will work as
expected.

groups <- as.character(groups)

Alternatively, you can use levels() to change the levels for the
factor.  Check the help for levels, relevel, factor, and as.character
for details.

Sean


> > groups
>  [1] <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>
> Levels: control diabetes
>
> This, however, works just fine.
>
> gds3715dat = getGEO('GDS3715',destdir=".")
> gds3715eset = GDS2eSet(gds3715dat, do.log2=TRUE)
> groups = paste(pData(gds3715eset)$disease.state,
> pData(gds3715eset)$agent, sep =".")
> groups[groups=="insulin sensitive.untreated"]= "IS.U"
> groups[groups=="insulin resistant.untreated"]= "IR.U"
> groups[groups=="diabetic.untreated"]= "T2D.U"
> groups[groups=="insulin sensitive.insulin"]= "IS.T"
> groups[groups=="insulin resistant.insulin"]= "IR.T"
> groups[groups=="diabetic.insulin"]= "T2D.T"
> > sessionInfo()
> R version 2.13.2 (2011-09-30)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=English_xxx  LC_CTYPE=English_xxx
> [3] LC_MONETARY=English_xxx LC_NUMERIC=C
> [5] LC_TIME=English_xxx
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] XML_3.4-2.2     RCurl_1.6-10.1  bitops_1.0-4.1  puma_2.4.0
> [5] mclust_3.4.10   affy_1.30.0     limma_3.8.3     GEOquery_2.19.4
> [9] Biobase_2.12.2
>
> loaded via a namespace (and not attached):
> [1] affyio_1.20.0         preprocessCore_1.14.0 tools_2.13.2
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor



More information about the Bioconductor mailing list