Skip to content

Commit

Permalink
Removed deprecated ggplot code, changed default values for assembly a…
Browse files Browse the repository at this point in the history
…nd normlization
  • Loading branch information
schmic05 committed Mar 19, 2024
1 parent 289cea7 commit c6037ea
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 21 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Authors@R: c(
role = c("aut")),
person("Fabian", "Mueller", email = "[email protected]",
role = c("aut", "cre")))
Date: 2024-01-25
Version: 2.21.1
Date: 2024-03-19
Version: 2.21.2
Suggests:
Category,
GOstats,
Expand Down
4 changes: 2 additions & 2 deletions R/agePrediction.R
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ add.quantile.plot <- function(report, object, actualAges, predictedAges){
density.frame <- data.frame(Difference=density$x,Density=density$y)
median <- median(diff)

plot <- ggplot(data,aes(x=Difference,y=0.0))+geom_density(aes(y=..density..))+geom_point(aes(label=Sample))+geom_text(aes(label=Sample),hjust=.5,vjust=1.5,size=3,colour='#BE1E2D')+geom_area(data=subset(density.frame,Difference>=q1 & Difference<=q99),aes(x=Difference,y=Density),fill='#75BC1C')+geom_area(data=subset(density.frame,Difference<=q1),aes(x=Difference,y=Density),fill='#BE1E2D')+geom_area(data=subset(density.frame,Difference>=q99),aes(x=Difference,y=Density),fill='#BE1E2D')+geom_vline(xintercept=median)+ylab("Density")
plot <- ggplot(data,aes(x=Difference,y=0.0))+geom_density(aes(y=after_stat(density)))+geom_point(aes(label=Sample))+geom_text(aes(label=Sample),hjust=.5,vjust=1.5,size=3,colour='#BE1E2D')+geom_area(data=subset(density.frame,Difference>=q1 & Difference<=q99),aes(x=Difference,y=Density),fill='#75BC1C')+geom_area(data=subset(density.frame,Difference<=q1),aes(x=Difference,y=Density),fill='#BE1E2D')+geom_area(data=subset(density.frame,Difference>=q99),aes(x=Difference,y=Density),fill='#BE1E2D')+geom_vline(xintercept=median)+ylab("Density")
report.plot <- createReportPlot("age_prediction_quantile", report)
print(plot)
report.plot <- off(report.plot)
Expand Down Expand Up @@ -612,7 +612,7 @@ add.age.histogram <- function(report,ages){
data <- data.frame(Age=ages)
colors <- rnb.getOption("colors.category")
gradient <- rnb.getOption("colors.gradient")
plot <- ggplot(data,aes(x=Age))+geom_histogram(aes(fill=..count..,y=..density..),binwidth=5) +geom_density(color=colors[2])+scale_fill_gradient(low=gradient[1],high=gradient[2],name="Count")+ylab("Density")
plot <- ggplot(data,aes(x=Age))+geom_histogram(aes(fill=after_stat(count),y=after_stat(density)),binwidth=5) +geom_density(color=colors[2])+scale_fill_gradient(low=gradient[1],high=gradient[2],name="Count")+ylab("Density")
report.plot <- createReportPlot("predicted_ages_histogram",report)
print(plot)
report.plot <- off(report.plot)
Expand Down
2 changes: 1 addition & 1 deletion R/controlPlotsBiSeq.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ rnb.plot.biseq.coverage.hist<-function(
dframe<-data.frame(Coverage=covg.rnbs)
#TODO: cut after 95 percentile of coverage
pp <- ggplot(dframe, aes_string(x = "Coverage")) + coord_cartesian(xlim=c(0,max.covg))+
labs(x = "Coverage", y = "# CpGs") + geom_histogram(aes_string(y = "..count.."), binwidth = 10)
labs(x = "Coverage", y = "# CpGs") + geom_histogram(aes(y = after_stat(count)), binwidth = 10)

if(writeToFile) {
print(pp)
Expand Down
3 changes: 1 addition & 2 deletions R/differentialVariability.R
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ create.diffMeth.diffVar.subsample <- function(df2p,dens.subsample,is.special=NUL
pp <- rnb.message.plot("Could not assess density")
} else {
pp <- ggplot(df2p.sub) + aes_string(x=colnames(df2p)[1],y=colnames(df2p)[2]) +
stat_density2d(geom="tile", fill=DENS.COLORS.LOW[1], aes(,alpha=..density..^0.25), contour=FALSE, n=dens.n, h=stable.h) +
stat_density2d(geom="tile", fill=DENS.COLORS.LOW[1], aes(alpha=after_stat(density)^0.25), contour=FALSE, n=dens.n, h=stable.h) +
scale_alpha(range = c(0.0, 1),guide=FALSE) +
geom_vline(xintercept = rank.cut.diffMeth,linetype='dotted') + geom_hline(yintercept = rank.cut.diffVar,linetype='dotted')+
scale_color_manual(values=c(rnb.getOption("colors.category")[c(1,2,4)],DENS.COLORS.LOW[1]))
Expand All @@ -739,7 +739,6 @@ create.diffMeth.diffVar.subsample <- function(df2p,dens.subsample,is.special=NUL
ss <- as.numeric(dens.subsample)
if(nrow(df2p.special)>ss){
pp <- pp + geom_point(data=df2p.special,aes_string(x=colnames(df2p)[1],y=colnames(df2p)[2],colour=colnames(df2p)[3]),size=0.4) + guides(fill=FALSE)
#pp <- pp + stat_density2d(data = df2p.special, geom="tile", aes(fill=colnames(df2p)[3],alpha=..density..^0.25), contour=FALSE, n =dens.n, h=stable.h)+scale_fill_manual(values=c(rnb.getOption("colors.category")[c(1,2,4)],DENS.COLORS.LOW[1]))
}else{
pp <- pp + geom_point(data=df2p.special,aes_string(x=colnames(df2p)[1],y=colnames(df2p)[2],colour=colnames(df2p)[3]),size=1) + guides(fill=FALSE)
}
Expand Down
2 changes: 1 addition & 1 deletion R/filtering.R
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ rnb.section.na.removal.internal <- function(report, dataset.class, numSamples, n
binwidth <- max((binwidth[2] - binwidth[1]) / 40, 1)
rplot <- createReportPlot(x$fname, report, width = 5, height = 5)
pp <- ggplot(dframe, aes_string(x = "x")) + labs(x = "Number of missing values", y = "Frequency") +
geom_histogram(aes_string(y = "..count.."), binwidth = binwidth)
geom_histogram(aes(y = after_stat(count)), binwidth = binwidth)
if (0 < threshold && threshold < 1) {
pp <- pp + geom_vline(xintercept = threshold * numSamples, linetype = "dotted")
}
Expand Down
4 changes: 2 additions & 2 deletions R/plottingUtils.R
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ rnb.plot.beta.comparison <- function(beta.values, fprefix, report = NULL, qq.len
rplot <- createReportPlot(fnames[2], report, width = 6.8, height = 5.2)
pp <- ggplot(dframe, aes_string(x = "value")) + coord_cartesian(xlim = c(0, 1)) +
labs(x = expression(beta), y = "Density") +
geom_histogram(aes_string(y = "..density.."), binwidth = 0.02) +
geom_histogram(aes(y = after_stat(density)), binwidth = 0.02) +
facet_grid(vtype ~ .) + theme(plot.margin = pmargins)
print(pp)
off(rplot)
Expand Down Expand Up @@ -1467,7 +1467,7 @@ create.densityScatter <- function(df2p,is.special=NULL,dens.subsample=FALSE,dens
pp <- rnb.message.plot("Could not assess density")
} else {
pp <- ggplot(df2p.sub) + aes_string(x=colnames(df2p)[1],y=colnames(df2p)[2]) +
stat_density2d(geom="tile", fill=DENS.COLORS.LOW[1], aes(,alpha=..density..^0.25), contour=FALSE, n=dens.n, h=stable.h) +
stat_density2d(geom="tile", fill=DENS.COLORS.LOW[1], aes(alpha=after_stat(density)^0.25), contour=FALSE, n=dens.n, h=stable.h) +
scale_alpha(range = c(0.0, 1))
if (sparse.points > 0){
if (sparse.points <= 1){
Expand Down
2 changes: 1 addition & 1 deletion R/regionProfiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ rnb.plot.region.profile.density <- function(rnb.set, sample, region.type="", reg
stable.h <- c(stable.bandwidth.fun(df2p$relative.coord),stable.bandwidth.fun(df2p$meth))

pp <- ggplot(df2p) + aes(x=relative.coord,y=meth) +
stat_density2d(geom="tile",fill="#1F78B4", aes(alpha=..density..^0.25), contour = FALSE, h=stable.h) +
stat_density2d(geom="tile",fill="#1F78B4", aes(alpha=after_stat(density)^0.25), contour = FALSE, h=stable.h) +
ylim(0, 1) + ylab("methylation") + xlab("relative position") + theme(legend.position="none") +
geom_vline(xintercept = c(0,1), linetype = "solid",size=1.5)
return(pp)
Expand Down
14 changes: 7 additions & 7 deletions inst/extdata/RnBeadsDJ/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ RNB.MODULES.LOG.MSG <- c(
"exploratory_analysis"="Exploratory Analysis",
"differential_methylation"="Differential Methylation"
)
RNB.PLATFORMS <- c("Bisulfite Sequencing"="biseq", "Illumina EPIC"="illEpic", "Illumina EPIC v2"="illEpicv2", "Illumina 450k"="ill450k", "Illumina27k"="ill27k")
RNB.PLATFORMS <- c("Bisulfite Sequencing"="biseq", "Illumina EPIC"="illEpic", "Illumina EPIC v2"="illEpicv2", "Illumina 450k"="ill450k", "Illumina27k"="ill27k", 'Illumina MMBC'='illMMBC')
RNB.ASSEMBLIES <- rnb.get.assemblies()
RNB.TABLE.SEPS <- c("comma" = ",", "tab"="\t")
RNB.BED.STYLES <- c("BisSNP"="BisSNP", "ENCODE"="Encode", "EPP"="EPP", "Bismark cytosine"="bismarkCytosine", "Bismark coverage"="bismarkCov")
RNB.FILTERING.SNP <- c("No filtering"="no", "3 SNPs"="3", "5 SNPs"="5", "Any SNPs"="any") ## TODO: Include SNPs MAF from the new hg38 annotation
RNB.NORMALIZATION.METHODS=c("none", "bmiq", "illumina", "swan", "minfi.funnorm", "wm.dasen", "wm.nasen", "wm.betaqn", "wm.naten", "wm.nanet", "wm.nanes", "wm.danes", "wm.danet", "wm.danen", "wm.daten1", "wm.daten2", "wm.tost", "wm.fuks", "wm.swan")
RNB.NORMALIZATION.BG.METHODS <- c("none", "methylumi.noob", "methylumi.goob", "enmix.oob")
RNB.NORMALIZATION.METHODS=c("none", "bmiq", "illumina", "swan", "minfi.funnorm", "wm.dasen", "wm.nasen", "wm.betaqn", "wm.naten", "wm.nanet", "wm.nanes", "wm.danes", "wm.danet", "wm.danen", "wm.daten1", "wm.daten2", "wm.tost", "wm.fuks", "wm.swan", "scaling.internal")
RNB.NORMALIZATION.BG.METHODS <- c("none", "methylumi.noob", "methylumi.goob", "enmix.oob", "sesame.noobsb")
RNB.IMPUTATION.METHODS <- c("none", "mean.cpgs", "mean.samples", "random", "knn")
RNB.TRACKHUB.FORMATS <- c("bigBed", "bigWig")
RNB.SVA.NUM.METHODS <- c("leek", "be")
Expand Down Expand Up @@ -834,7 +834,7 @@ ui <- tagList(useShinyjs(), navbarPage(
tags$div(title=RNB.OPTION.DESC["normalization.method"], tags$code("normalization.method"))
),
tags$td(
selectInput("rnbOptsI.normalization.method", NULL, RNB.NORMALIZATION.METHODS, selected="wm.dasen")
selectInput("rnbOptsI.normalization.method", NULL, RNB.NORMALIZATION.METHODS, selected="scaling.internal")
),
tags$td(
verbatimTextOutput("rnbOptsO.normalization.method")
Expand All @@ -845,7 +845,7 @@ ui <- tagList(useShinyjs(), navbarPage(
tags$div(title=RNB.OPTION.DESC["normalization.background.method"], tags$code("normalization.background.method"))
),
tags$td(
selectInput("rnbOptsI.normalization.background.method", NULL, RNB.NORMALIZATION.BG.METHODS, selected="none")
selectInput("rnbOptsI.normalization.background.method", NULL, RNB.NORMALIZATION.BG.METHODS, selected="sesame.noobsb")
),
tags$td(
verbatimTextOutput("rnbOptsO.normalization.background.method")
Expand Down Expand Up @@ -1479,7 +1479,7 @@ server <- function(input, output, session) {
shinyjs::disable("rnbOptsI.normalization.background.method")
shinyjs::disable("rnbOptsI.exploratory.correlation.qc")
} else {
shinyjs::disable("rnbOptsI.assembly")
#shinyjs::disable("rnbOptsI.assembly")
shinyjs::disable("rnbOptsI.import.bed.style")
shinyjs::disable("rnbOptsI.filtering.coverage.threshold")
shinyjs::disable("rnbOptsI.filtering.low.coverage.masking")
Expand Down Expand Up @@ -1587,7 +1587,7 @@ server <- function(input, output, session) {
assemblySel <- reactive({
interfaceSetting <- input$rnbOptsI.assembly
res <- "hg19"
if (isBiseq() && !is.null(interfaceSetting)){
if (!is.null(interfaceSetting)){
res <- interfaceSetting
}
rnb.options(assembly=res)
Expand Down
6 changes: 3 additions & 3 deletions inst/extdata/options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name Type Named Null Values Default
analysis.name character no yes NULL
logging logical no no TRUE
email character no yes NULL
assembly character no no hg19
assembly character no no hg38
columns.pairing integer.vector yes yes NULL
analyze.sites logical no no TRUE
region.types character.vector no yes NULL
Expand Down Expand Up @@ -49,8 +49,8 @@ qc.cnv logical no no FALSE
qc.cnv.refbased logical no no FALSE
preprocessing logical no no TRUE
normalization logical no yes NULL
normalization.method character no no (none,scaling,scaling.internal,scaling.reference,bmiq,illumina,methylumi.illumina,swan,minfi.funnorm,wm.dasen,wm.nasen,wm.betaqn,wm.naten,wm.nanet,wm.nanes,wm.danes,wm.danet,wm.danen,wm.daten1,wm.daten2,wm.tost,wm.fuks,wm.swan) wm.dasen
normalization.background.method character no no (none,subtraction,sesame.noob,sesame.noobsb,methylumi.noob,methylumi.goob,enmix.oob) none
normalization.method character no no (none,scaling,scaling.internal,scaling.reference,bmiq,illumina,methylumi.illumina,swan,minfi.funnorm,wm.dasen,wm.nasen,wm.betaqn,wm.naten,wm.nanet,wm.nanes,wm.danes,wm.danet,wm.danen,wm.daten1,wm.daten2,wm.tost,wm.fuks,wm.swan) scaling.internal
normalization.background.method character no no (none,subtraction,sesame.noob,sesame.noobsb,methylumi.noob,methylumi.goob,enmix.oob) sesame.noobsb
normalization.plot.shifts logical no no TRUE
filtering.whitelist character no yes NULL
filtering.blacklist character no yes NULL
Expand Down

0 comments on commit c6037ea

Please sign in to comment.