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

fix: logical in ModelNegativeADTnorm.r #47

Merged
merged 2 commits into from
Jun 15, 2024
Merged

Conversation

maxkarlsson
Copy link
Contributor

In ModelNegativeADRnorm there is a logical that will always return FALSE, and the corresponding if statement (dealing with the case when a model could not be fit for some markers) will thus never trigger. This PR fixes this.

The issue comes from the use of all.equal, which will return TRUE if all elements across two vectors are equal, and a string if they are not. The isFALSE function would thus return FALSE whether all.equal returns TRUE or a string.

Here is an example:

mu1 <- 1:10
adt_log <- matrix(1:100, nrow = 10, ncol = 10)
rownames(adt_log) <- paste0("protein", 1:10)

# Lengths are equal, expected to return FALSE
isFALSE(length(mu1) == length(rownames(adt_log)))
# [1] FALSE

isFALSE(all.equal(length(mu1), length(rownames(adt_log))))        
# [1] FALSE



# Lengths are NOT equal, expected to return TRUE
mu1 <- 1:9

isFALSE(length(mu1) == length(rownames(adt_log)))
# [1] TRUE

isFALSE(all.equal(length(mu1), length(rownames(adt_log))))
# [1] FALSE

Copy link
Collaborator

@MattPM MattPM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maxkarlsson discovered an isolated unnecessary call to all.equal for this conditional related to the ModelNegativeADTnorm function. The proposed code corrects the issue. Approved. thank you!
-Matt

@MattPM MattPM merged commit 4c93d29 into niaid:master Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants