[BioC] how to plot a consensus clustering in a PDF file?

Martin Morgan mtmorgan at fhcrc.org
Tue Jan 22 21:32:24 CET 2008


Hi Artur

It looks like 'consensus' uses (in plot.consensus.kmeans) the command

get(getOption("device"))()

at the start of it's plotting routine. So try

> options(device="pdf")
> consensus(<your args here>)
> dev.off()

once you've navigated R's concept of its working directory (using
setwd) to point to where you'd like the pdf to be saved. It will
create a file Rplots.pdf. (you could get fancier here, writing your
own function as a kind of pseudo-device to forward the right arguments
to pdf, mypdf=function() pdf("testfile.pdf") and set
options(device="mypdf")). Not sure why maanova does things this way,
or whether this will work for all plots.

Also it's the 'maanova' package.

Hope that helps

Martin


"Artur Veloso" <abveloso at gmail.com> writes:

> Dear all,
>
> I am using the MAANOVA package to create k-means clusters and wanted to save
> the graphs produced by the function "consensus" in a PDF file. I don't get
> any error messages when I write my code, but when I try to open the file I
> get a message that it can't be opened because there are no pages in the
> document. Am I doing something wrong? Does anyone know of a way to go around
> this?
>
> Thanks a lot!
>
> Artur Veloso
> Masters in Marine Biology Candidate
> College of Charleston, South Carolina
>
> # this works fine, so I don't think the problem is creating the pdf file
> pdf("test_file.pdf")
> plot(1:10,1:10)
> dev.off()
>
> # this also works, but the pdf file does not get the consensus plot
> library(maanova)
> dolphin.maanova <- read.madata
> ("maanova_males_data.txt","maanova_males_design.txt",arrayType="oneColor",
>                    probeid=1,intensity=2)
> dolphin.maanova.fit <- fitmaanova(madata=dolphin.maanova,formula=~+Sample)
> genes <- read.csv("bioc.males.numbers.csv",header=T)
> genes.cluster <- macluster(dolphin.maanova.fit,term="Sample" ,
> idx.gene=genes[,2],what="gene",method="kmean",kmean.ngroup=8)
> pdf("teste.pdf")
> bioc.males.consensus <- consensus(bioc.males.cluster,0.5)
> dev.off()
>
>
>> sessionInfo()
> R version 2.6.1 (2007-11-26)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] maanova_1.8.0
>
> loaded via a namespace (and not attached):
> [1] tools_2.6.1
>
> 	[[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
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M2 B169
Phone: (206) 667-2793



More information about the Bioconductor mailing list