Entering edit mode
9.4 years ago
Bogdan
★
1.4k
Dear all,
I would appreciate a help with writing for a "for loop" with "autoplot" function :
I read a list of genes (chr, start, end) from a file, and would like to use the AUTOPLOT function to display each of these genes (in ggbio package) : but I am not obtaining any result. Any insights ? thank you,
-- bogdan
the R script is the following :
g <- read.delim("list_GENES",header=TRUE, stringsAsFactors=FALSE)
for (j in 1:nrow(g))
{
chr <- g[j,]$chr ;
start <- g[j,]$start ;
end <- g[j,]$end ;
gene <- g[j,]$gene ;
region <- GRanges(chr, IRanges(start,end)) ;
png("gene.png")
autoplot(Homo.sapiens, which = region, stat = "reduce", color = "blue", fill = "blue", names.expr="SYMBOL")
dev.off()
}
where the file "list_GENES" is in the format:
chr start end gene
chr16 8663964 8855703 ABAT
chr11 77484160 77741533 ALG8
chr11 69024132 69186057 CCND1
chr1 109424543 109642035 CELSR2
chr15 99517335 99748326 CHSY1
chr6 151733634 152220321 ESR1
Yeah? What seems to be the problem? What happens?
It looks like youre going to overwrite the file gene.png repeatedly...
https://support.bioconductor.org/p/63439/