Repository navigation
getTop: use include.lowest = FALSE by default for prevalence - #926
TuomasBorman merged 3 commits into
Conversation
antagomir
left a comment
There was a problem hiding this comment.
Could work. Let's discuss the comments first.
|
Thanks for the PR! Existing code using method = "prevalence" will now return different features, it changes the behavior. Please state this in the PR description so it goes into NEWS, and bump the version to 1.23.2. |
sort (alphabetical output) no longer clashes with sort = TRUE in the getPrevalence() call, so the call does not need do.call().
|
I bumped the version to 1.23.2, added a NEWS entry, and added a behaviour change section to the description (46fadb1). Your suggestion works and reads better: sort is now a regular argument of getTop() (generic, method and docs), so the prevalence branch is a plain getPrevalence(assay(x, assay.type), sort = TRUE, na.rm = na.rm, ...) call with no do.call() (df2a206). |
|
Thanks @chenyangsu ! I will merge this now. In separate PR, add your name to DESCRIPTION file so you will be credited from your contribution. -Tuomas |
Calling
getTop(GlobalPatterns, method = "prevalence", top = 5)returns features with prevalences 0.08 to 0.42 (and can include all-zero rows) becausegetTop()hardcodesinclude.lowest = TRUEingetPrevalence(). With the defaultdetection = 0,x >= 0assigns every non-negative row prevalence 1, diverging fromgetPrevalence()'s documented defaultinclude.lowest = FALSE; passingsortorinclude.lowestalso triggers a duplicate-argument error.getTop()now forwards...togetPrevalence()without the hardcodedinclude.lowest = TRUE, sogetPrevalence()'s defaultinclude.lowest = FALSEapplies, and it passesna.rm.sort(alphabetical order of the output) is a regular argument ofgetTop(), so it no longer clashes with thesort = TRUEused to rank features. Happy to exposeinclude.lowestexplicitly ingetTop()instead if you prefer.Behaviour change
Existing code using
getTop(..., method = "prevalence")can return different features. With the defaultdetection = 0, every feature had prevalence 1, so the returned features were not the most prevalent ones; now they are ranked by the share of samples where the abundance is abovedetection, as ingetPrevalence(). Withdetection > 0, abundances exactly equal todetectionno longer count as present.include.lowest = TRUEgives the previous counting. Version bumped to 1.23.2, with a NEWS entry.Testing:
test-8summaries.R(15 passed),test-5prevalence.R(73 passed),test-0utilites.R(44 passed).