Hello Biostars!
I hope you are shining bright!
Today, I'm dealing with a very basic problem that's plotting lines color change. It's very easy in general plot function and ggplot. But in case of a function by ChIPseeker - 'plotAvgProf2', I'm not able to figure how to give arguments as there's not default argument like 'col' or 'colour' in the function :
plotAvgProf2 package:ChIPseeker R Documentation
plotAvgProf
Description:
plot the profile of peaks that align to flank sequences of TSS
Usage:
plotAvgProf2(peak, weightCol = NULL, TxDb = NULL, upstream = 1000,
downstream = 1000, xlab = "Genomic Region (5'->3')",
ylab = "Read Count Frequency", conf, facet = "none", free_y = TRUE,
verbose = TRUE, ...)
Arguments:
peak: peak file or GRanges object
weightCol: column name of weight
TxDb: TxDb object
upstream: upstream position
downstream: downstream position
xlab: xlab
ylab: ylab
conf: confidence interval
facet: one of 'none', 'row' and 'column'
free_y: if TRUE, y will be scaled by AvgProf
verbose: print message or not
...: additional parameter
I don't even how to edit the function too :
> plotAvgProf2
function (peak, weightCol = NULL, TxDb = NULL, upstream = 1000,
downstream = 1000, xlab = "Genomic Region (5'->3')", ylab = "Read Count Frequency",
conf, facet = "none", free_y = TRUE, verbose = TRUE, ...)
{
if (verbose) {
cat(">> preparing promoter regions...\t", format(Sys.time(),
"%Y-%m-%d %X"), "\n")
}
promoter <- getPromoters(TxDb = TxDb, upstream = upstream,
downstream = downstream)
if (verbose) {
cat(">> preparing tag matrix...\t\t", format(Sys.time(),
"%Y-%m-%d %X"), "\n")
}
if (is(peak, "list")) {
tagMatrix <- lapply(peak, getTagMatrix, weightCol = weightCol,
windows = promoter)
}
else {
tagMatrix <- getTagMatrix(peak, weightCol, promoter)
}
if (verbose) {
cat(">> plotting figure...\t\t\t", format(Sys.time(),
"%Y-%m-%d %X"), "\n")
}
if (!(missingArg(conf) || is.na(conf))) {
p <- plotAvgProf.internal(tagMatrix, xlim = c(-upstream,
downstream), xlab = xlab, ylab = ylab, conf = conf,
facet = facet, free_y = free_y)
}
else {
p <- plotAvgProf.internal(tagMatrix, xlim = c(-upstream,
downstream), xlab = xlab, ylab = ylab, facet = facet,
free_y = free_y)
}
return(p)
}
<bytecode: 0x14adad08>
<environment: namespace:ChIPseeker>
By default, it gives blue n brown colour for 2 samples . I need to change that. Please help me out. Thank you in advance :)
Thank you Guangchuang! I'll try it now. And how the thickness of the line can be changed in the plot? Can we use all the ggplot2 plot styling functions with plotAvgProf2?
Greetings of the day Guangchuang! I tried the below commands , but it gave me error:
How should I give 'scale_color_manual' in the command?
I figured out the error was due to absence of library(ggplot2). Still after adding this. I got this: