Question: Cummerbund
1
gravatar for GPR
6.8 years ago by
GPR310
Mexico
GPR310 wrote:

Hello, I am learning how to use cummeRbund and while I have gotten acquainted with some of its functions, there is one that has me naively puzzled. I have a list of a about 10 gene names and want to create a gene set with them. The final purpose will be to make a heatmap. My question is how exactly do I go about feeding that list of genes in a command-line like:

data(sampleData)
myGeneIds<-sampleIDs
myGeneIds

followed by

myGenes<-getGenes(cuff,myGeneIds)
myGenes

followed by

h <- csHeatmap(myGenes,cluster='both')
h

Finally, I have been creating plots for other functions, but can't find out how to make a png/pdf/tiff file out of it.

Any help is appreciated. G.

• 5.3k views
ADD COMMENTlink modified 5.0 years ago by Paul1.3k • written 6.8 years ago by GPR310
3
gravatar for seidel
6.8 years ago by
seidel6.8k
United States
seidel6.8k wrote:

You simply create a vector of your gene IDs like in the code above, and then use that in the getGenes() function. You use the same type of identifiers used in your cufflinks data.

myGeneIds <- c("gene1","gene2","gene3","gene4")
myGenes <- getGenes(cuff,myGeneIds)

To create png/pdf/tiff files of the plots, you can use the functions for those as follows:

pdf(file="myNicePlot.pdf")
csHeatmap(myGenes,cluster='both')
dev.off()

There are similar functions such as png() and tiff(), jpeg(), etc. This should create a file in the current working directory (but notice I removed the assignment to the variable "h", and just called the csHeatmap() function by itself). Another way to create files is to simply create them so you can see them in the graphics window on your computer, but then copy the output to a file with a function called dev.copy2pdf() like so (this time using your code verbatim):

h <- csHeatmap(myGenes,cluster='both')
dev.copy2pdf(file="myNicePlot.pdf")

You might try ?dev.copy2pdf to see other options. I tend to generate a lot of plots, but save very few. The nice thing about this method is you can see your optimizations and tweaks to a plot and then save the ones you like at will with a single line.

ADD COMMENTlink modified 6.8 years ago • written 6.8 years ago by seidel6.8k

THIS WORKED NOW, THANKS A LOT!

ADD REPLYlink written 6.8 years ago by GPR310
0
gravatar for Paul
5.0 years ago by
Paul1.3k
European Union
Paul1.3k wrote:

Or just simply ggsave(file='name_your_file.jpg') (you can use extension *eps, *svg).

Paul.

ADD COMMENTlink written 5.0 years ago by Paul1.3k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1986 users visited in the last hour