Skip to content

Commit

Permalink
Raster art updates
Browse files Browse the repository at this point in the history
  • Loading branch information
RCollins13 committed May 27, 2022
1 parent 701defa commit 5adfd54
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
7 changes: 5 additions & 2 deletions analysis/paper/plot/large_segments/plot_dnm_comparisons.R
Original file line number Diff line number Diff line change
Expand Up @@ -663,16 +663,19 @@ sapply(names(dnms), function(cohort){

# Collapsed distribution of excess DNMs across all NDD segments
pct.cutoff <- 0
width.buffer <- 0
sapply(names(dnms), function(cohort){
if(cohort == "DDD_plus_ASC"){
min.excess.for.norm <- 1.9
min.excess.ineq <- ">="
}else if(cohort == "DDD"){
min.excess.for.norm <- 0.9
min.excess.ineq <- ">="
width.buffer <- 0.3
}else{
min.excess.for.norm <- 0.1
min.excess.ineq <- ">"
width.buffer <- 0.3
}
sapply(csqs, function(csq){
cnv.marker.wex <- 0
Expand Down Expand Up @@ -701,7 +704,7 @@ sapply(names(dnms), function(cohort){
round(min.excess.for.norm, 0), ")'", sep="")
}
pdf(paste(out.prefix, cohort, csq, "excess_dnm_distrib_bygene.pdf", sep="."),
height=2, width=2.75)
height=2, width=2.75+width.buffer)
dnm.excess.cdf.barplots(ndd.segs[which(ndd.segs$cnv %in% cnv.types), ],
dnms[[cohort]], cohort=cohort, csq=csq,
norm=F, legend=T, pct.cutoff=pct.cutoff,
Expand All @@ -710,7 +713,7 @@ sapply(names(dnms), function(cohort){
dev.off()
cat(paste(cohort, csq, "\n"))
pdf(paste(out.prefix, cohort, csq, "excess_dnm_distrib_bygene.norm.pdf", sep="."),
height=2, width=2.5)
height=2, width=2.5+width.buffer)
dnm.excess.cdf.barplots(ndd.segs[which(ndd.segs$cnv %in% cnv.types), ],
dnms[[cohort]], cohort=cohort, csq=csq,
min.excess=min.excess.for.norm, norm=T, legend=F,
Expand Down
8 changes: 8 additions & 0 deletions analysis/paper/plot/large_segments/plot_example_miami.R
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ mini.miami <- function(del, dup, max.p=10,
### RSCRIPT BLOCK ###
#####################
require(rCNV2, quietly=T)
require(rasterpdf, quietly=T)
require(optparse, quietly=T)

# List of command-line options
Expand Down Expand Up @@ -231,4 +232,11 @@ png(out.png, height=dim.scalar*1.4*300, width=dim.scalar*1.95*300, res=300, fami
mini.miami(del, dup, del.cutoff=del.cutoff, dup.cutoff=dup.cutoff, cutoff.label=cutoff.label,
middle.axis.width=1.25, xaxis.label=xaxis.label, sig.col=graphabs.green, max.p=8)
dev.off()
out.pdf <- gsub(".png$", ".pdf", out.png)
raster_pdf(out.pdf, height=dim.scalar*1.4, width=dim.scalar*1.95, units="in", res=600)
# pdf(out.pdf, height=dim.scalar*1.4, width=dim.scalar*1.95)
mini.miami(del, dup, del.cutoff=del.cutoff, dup.cutoff=dup.cutoff, cutoff.label=cutoff.label,
middle.axis.width=1.25, xaxis.label=xaxis.label, sig.col=graphabs.green, max.p=8)
dev.off()


Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ primary.vs.secondary.scatter <- function(pvals.1, pvals.2, keep.idx=NULL,
### RSCRIPT BLOCK ###
#####################
require(rCNV2, quietly=T)
require(rasterpdf, quietly=T)
require(optparse, quietly=T)

# List of command-line options
Expand Down Expand Up @@ -404,9 +405,14 @@ cat(paste("Median lambda, deletions & duplications only:", round(median(c(del.1$
n.plots.wide <- 9
n.plots.tall <- ceiling(length(hpos) / n.plots.wide)
dim.scalar <- 7.5 / 10
png(paste(out.prefix, "qq_grid_byHPO.png", sep="."),
height=dim.scalar*300*n.plots.tall, width=dim.scalar*300*n.plots.wide,
res=300)
# png(paste(out.prefix, "qq_grid_byHPO.png", sep="."),
# height=dim.scalar*300*n.plots.tall, width=dim.scalar*300*n.plots.wide,
# res=300)
raster_pdf(paste(out.prefix, "qq_grid_byHPO.pdf", sep="."),
height=dim.scalar*n.plots.tall, width=dim.scalar*n.plots.wide,
units="in", res=600)
# pdf(paste(out.prefix, "qq_grid_byHPO.pdf", sep="."),
# height=dim.scalar*n.plots.tall, width=dim.scalar*n.plots.wide)
par(mfrow=c(n.plots.tall, n.plots.wide))
for(hpo in hpos){
mini.qq(del.1, dup.1, hpo, title.cex=0.42, axis.cex=0.7, blue.bg=FALSE)
Expand All @@ -426,14 +432,22 @@ lambda.scatter(del.1, dup.1, hpo.n, blue.bg=FALSE)
dev.off()

# Scatterplots of primary vs. secondary P-values
png(paste(out.prefix, "primary_vs_secondary_pvalue.DEL.png", sep="."),
height=prim.vs.sec.png.dim*300, width=prim.vs.sec.png.dim*300, res=300)
# png(paste(out.prefix, "primary_vs_secondary_pvalue.DEL.png", sep="."),
# height=prim.vs.sec.png.dim*300, width=prim.vs.sec.png.dim*300, res=300)
raster_pdf(paste(out.prefix, "primary_vs_secondary_pvalue.DEL.pdf", sep="."),
height=prim.vs.sec.png.dim, width=prim.vs.sec.png.dim, units="in", res=600)
# pdf(paste(out.prefix, "primary_vs_secondary_pvalue.DEL.pdf", sep="."),
# height=prim.vs.sec.png.dim, width=prim.vs.sec.png.dim)
primary.vs.secondary.scatter(del.1$pvals, del.2$pvals, cutoff.1=del.cutoff,
sig.color=cnv.colors[1], nonsig.color=control.cnv.colors[1],
pt.cex=0.175, blue.bg=FALSE, parmar=c(2.5, 2.5, 0.15, 0.15))
dev.off()
png(paste(out.prefix, "primary_vs_secondary_pvalue.DUP.png", sep="."),
height=prim.vs.sec.png.dim*300, width=prim.vs.sec.png.dim*300, res=300)
# png(paste(out.prefix, "primary_vs_secondary_pvalue.DUP.png", sep="."),
# height=prim.vs.sec.png.dim*300, width=prim.vs.sec.png.dim*300, res=300)
raster_pdf(paste(out.prefix, "primary_vs_secondary_pvalue.DUP.pdf", sep="."),
height=prim.vs.sec.png.dim, width=prim.vs.sec.png.dim, units="in", res=600)
# pdf(paste(out.prefix, "primary_vs_secondary_pvalue.DUP.pdf", sep="."),
# height=prim.vs.sec.png.dim, width=prim.vs.sec.png.dim)
primary.vs.secondary.scatter(dup.1$pvals, dup.2$pvals, cutoff.1=dup.cutoff,
sig.color=cnv.colors[2], nonsig.color=control.cnv.colors[2],
pt.cex=0.175, blue.bg=FALSE, parmar=c(2.5, 2.5, 0.15, 0.15))
Expand Down
2 changes: 1 addition & 1 deletion docker/rcnv-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ RUN apt-get -qqy clean && \
# (Note that beeswarm _is_ available through conda but we need >=v0.4, and there
# is a very complex dependency issue in conda that makes it easier to install
# directly with R here)
RUN Rscript -e "sapply(c('EQL', 'beeswarm'),\
RUN Rscript -e "sapply(c('EQL', 'beeswarm', 'rasterpdf'),\
function(pkg){install.packages(pkg,repos='https://cloud.r-project.org')})"
ARG rCNV2_Rpkg_source="/opt/rCNV2/source/rCNV2_0.1.0.tar.gz"
RUN Rscript -e "install.packages('$rCNV2_Rpkg_source', source=TRUE, repos=NULL)"
Expand Down

0 comments on commit 5adfd54

Please # to comment.