-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
limit the coverage bar height #121
Comments
I also met the same problem |
@bernatgel Can you please help us here!! |
I tried using Bigwig file obtained from deeptools command:
And then used ## Reading reference genome
p <- readDNAStringSet("curtisi.fa")
## Creating custom Granges###################
t <- data.frame(p@ranges)
t$names <- stringr::str_split(t$names,pattern = " | ", simplify = TRUE)[,1]
t$start <- 1
# Removing contigs
df <- t[!grepl("contig", t$names),]
df <- data.frame(chr=df$names,start=df$start,end=df$width)
gr <- makeGRangesFromDataFrame(df)
#I just have one bigwig file
big.wig.files <- dir(path = "~/Documents/try",
pattern = ".bw",
all.files = T,
full.names = T)
kp <- plotKaryotype(genome = gr,cex =0.8)
kp <- kpAddBaseNumbers(kp, tick.dist = 1e6, cex=0.5, units="Mb", tick.len = 5, add.units = "TRUE")
out.at <- autotrack(1:length(big.wig.files),
length(big.wig.files),
margin = 0.3,
r0 = 0.3,
r1 = 1)
i=1
bigwig.file <- big.wig.files[i]
at <- autotrack(i, length(big.wig.files), r0 = out.at$r0, r1 = out.at$r1, margin = 0.2)
# Plot bigwig
kp <- kpPlotBigWig(kp,
data = bigwig.file,
ymax = "per.chr", ymin = 0,
r0 = at$r0,
col="red",
r1 = at$r1)
computed.ymax <- ceiling(kp$latest.plot$computed.values$ymax)
# Add track axis
kpAxis(kp,
ymin = 0
ymax = computed.ymax,
numticks = 2,
r0 = at$r0,
r1 = at$r1,
cex = 0.5)
|
Hi @Rohit-Satyam and @airichli This is a missing option in karyoploteR, and one that should be included. One way to achieve this should be via clipping, but due to limitations in the way the R processes clippings and the internal structure of karyoploteR, this optimal option is the most difficult. Another option would be to include a new parameter, something along the lines of "max.y.plot" or "clip.data.at.ymax" or something a bit more descriptive, and simply modify the coverage so anything over a certain threshold is changed to the maximum allowed coverage. This would allow you to create the image in the first post without the big towers, and simply adjust the ymax as you wish. Implementing this should be fairly easy, but I cannot do it right now and the next few weeks (I'm away from the lab). But the idea would be to add something like:
to line 109 in https://github.com/bernatgel/karyoploteR/blob/master/R/kpPlotBAMCoverage.R If you can do this and use the modified version (you do not need to rebuild the package, even! simply run the modified function definition after loading karyoploteR) and it should work. Hope this helps in the meantime! Bernat |
Hi Developers!!
I am trying to limit the
yaxis
range of coverage because some of the regions have extraordinarily high coverage which make other regions look deprived of any reads. This is giving us a false sense that the coverage of genome is poor. However, when I try usingymax
andymin
to limit the bar height I am unable to control the bar height. Isn't there a way to scale the coverage??Here is the code that I used:
Kindly help!!
![saving_plot1](https://user-images.githubusercontent.com/55479480/166071726-68414bf6-964f-4c75-9739-6cc54801b571.jpeg)
The text was updated successfully, but these errors were encountered: