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 ampvis2 NA in metadata error #6213

Merged
merged 3 commits into from
Aug 16, 2024

Conversation

paulzierep
Copy link
Contributor

If there are NA values in the metadata, the subset tool fails with:

Error in if (classes[[name]] == "character" && all(data$metadata[[name]] ==  : 
  missing value where TRUE/FALSE needed

Fixed by setting the values to "NA".

@bernt-matthias any suggestion ?

Copy link
Contributor

@bernt-matthias bernt-matthias left a comment

Choose a reason for hiding this comment

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

Thanks for the initiative. Would be cool to add a corresponding test.

@@ -49,6 +49,7 @@ echo $(R --version | grep "R version")", ampvis2 version" $(R --vanilla --slave
## the additional column in the ist file can the be used
## to filter SampleIDs from select inputs
## (check for character columns only .. since data in the column is otherwise converted to the corresponding type .. which fails)
data\$metadata[is.na(data\$metadata)] <- "NA" ##the comparison fails if NA values are present, see https://stackoverflow.com/questions/7355187/error-in-if-while-condition-missing-value-where-true-false-needed
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we do this in the for loop?

What is data\$metadata[is.na(data\$metadata)] actually doing? Guess some subsetting. Intuitively I would have expected the negation of is.na (but its R, i.e. it might be unintuitive) .. also my question would be if we need to modify anything else in data.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • You are right, this can be fixed outside the loop
  • data\$metadata[is.na(data\$metadata)] selects all cells which are NA
  • I think the data can be untouched, as only the metadata is changed, but if it should be changed to as string as "NA" or undefined or something - I am not sure - the user should probably be warned that the metadata will be modified

@bgruening
Copy link
Member

@bernt-matthias ok from your side?

@bernt-matthias bernt-matthias enabled auto-merge (squash) August 16, 2024 07:19
@bernt-matthias
Copy link
Contributor

Yep. I enabled automerge. Can someone restart tests. I only have my mobile until end of the month.

@bernt-matthias
Copy link
Contributor

Thanks @paulzierep

@bgruening bgruening disabled auto-merge August 16, 2024 08:34
@bgruening bgruening merged commit 9ed0c30 into galaxyproject:main Aug 16, 2024
14 checks passed
nilchia pushed a commit to pavanvidem/tools-iuc that referenced this pull request Aug 24, 2024
* fix NA

* bump version

* added test and improved the fix
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.

3 participants