Skip to content
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

[Bug]: Incorrect labelling of the "Ratio of M and U Intensities" box plots #265

Open
lw371 opened this issue Nov 28, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@lw371
Copy link
Collaborator

lw371 commented Nov 28, 2024

Contact Details

[email protected]

What happened?

In the produced html QC report the "Ratio of M and U Intensities" labelling of the box plots can sometimes be incorrect. For example for samples where I have genders of Male (M), Female (F), and fully methylated controls (C) the C plot is incorrectly labelled as 'M'.
Mislabeled box plot

How can the bug be reproduced?

No response

Relevant log output

No response

@lw371 lw371 added the bug Something isn't working label Nov 28, 2024
@sof202
Copy link
Collaborator

sof202 commented Nov 29, 2024

Code in question:

```{r, intensRatio, fig.width = 10, fig.height = 5, echo = FALSE}
par(mfrow = c(1,1))
par(mar = c(4,4,4,1))
hist(QCmetrics$intens.ratio, xlab = "Ratio of M:U intensities", breaks = 25, main = "", col = "gray")
for(i in 2:ncol(plotCols)){
if(length(unique(plotCols[!is.na(QCmetrics$intens.ratio),i])) > 1){
model<-lm(QCmetrics$intens.ratio ~ plotCols[,i])
anova(model)
legendDat<-legendParams[[i-1]]
boxplot(QCmetrics$intens.ratio ~ plotCols[,i], col = legendDat[,2], names = legendDat[,1], xlab = "", ylab = "Ratio M:U", main = paste("Split by ", colnames(plotCols)[i]))
title(main = paste("ANOVA P =", signif(anova(model)[1,5], 3)), line = 0.5, adj = 1)
}
}

@sof202
Copy link
Collaborator

sof202 commented Nov 29, 2024

I'm think that the order of legendParams is not guaranteed to be the same order as whatever the boxplot() function thinks to make with plotCols[[]]. Which causes the problem. I'm going to assume we can fix this by changing line 279 to:

boxplot(QCmetrics$intens.ratio ~ legendDat[,1], ...)

As this accomplishes the same thing, but ensures consistent ordering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants