Open mirkocelii opened 3 years ago
hello, I want to create several PDF files with Functional_enrichment Doplot as Chipseeker vignette with a for loop. http://bioconductor.org/packages/devel/bioc/vignettes/ChIPseeker/inst/doc/ChIPseeker.html but the PDF are empty with no pages.
If I avoid the for loop e run the commands one by one, it works. am I doing something wrong? this is the code
library(ReactomePA) library(ChIPseeker) library(TxDb.Hsapiens.UCSC.hg19.knownGene) txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene library(clusterProfiler) files <- getSampleFiles() peakList <- lapply(files, readPeakFile) peakAnnoList <- lapply(files, annotatePeak, TxDb=txdb, tssRegion=c(-3000, 3000), verbose=FALSE) for( i in names(peakAnnoList)) { cat(i) peak = peakList[[i]] peakAnno = peakAnnoList[[i]] pathway1 <- enrichPathway(as.data.frame(peakAnno)$geneId) head(pathway1, 2) gene <- seq2gene(peak, tssRegion = c(-1000, 1000), flankDistance = 3000, TxDb=txdb) pathway2 <- enrichPathway(gene) head(pathway2, 2) pdf( paste("Functional_enrichment",i,"pathway1.pdf",sep="."),10,10) dotplot( pathway1,title = paste("Functional enrichment", sam)) dev.off() pdf( paste("Functional_enrichment",i,"pathway2.pdf",sep="."),10,10) dotplot( pathway2,title = paste("Functional enrichment", sam)) dev.off() }
try print the dotplot.
print
dotplot
pdf(file) print(dotplot()) dev.off()
hello, I want to create several PDF files with Functional_enrichment Doplot as Chipseeker vignette with a for loop. http://bioconductor.org/packages/devel/bioc/vignettes/ChIPseeker/inst/doc/ChIPseeker.html but the PDF are empty with no pages.
If I avoid the for loop e run the commands one by one, it works. am I doing something wrong? this is the code