Cummerbund
3
1
Entering edit mode
12.4 years ago
GPR ▴ 390

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.

• 6.9k views
ADD COMMENT
3
Entering edit mode
12.4 years ago
seidel 11k

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 COMMENT
0
Entering edit mode

THIS WORKED NOW, THANKS A LOT!

ADD REPLY
0
Entering edit mode
10.6 years ago
Paul ★ 1.5k

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

Paul.

ADD COMMENT

Login before adding your answer.

Traffic: 1922 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6