Fix NULL row names in NMF matrix for sig_tally() Wang method#474
Draft
Fix NULL row names in NMF matrix for sig_tally() Wang method#474
Conversation
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix NULL row names in NMF matrix with sig_tally() Wang method
Fix NULL row names in NMF matrix for sig_tally() Wang method
Dec 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using
sig_tally()with the Wang method, the NMF matrix row names are NULL, particularly for single-sample cases. The Steele method correctly preserves sample IDs as row names.Root Cause
The matrix generation transposes a components-by-samples matrix to samples-by-components. R's transpose doesn't reliably preserve dimension names in edge cases (e.g., single-column matrices).
Changes
Example
The fix ensures consistent behavior across all sample counts and aligns with the Steele method's row name handling.
Original prompt
This section details on the original issue you should resolve
<issue_title>NULL Row Names in NMF Matrix When Using sig_tally() with Wang Method</issue_title>
<issue_description>Hi @ShixiangWang,
Hope you're well.
Just noticed that when using the sig_tally() function with the Wang method, the row names in the resulting NMF matrix (tally_wang$nmf_matrix) are unexpectedly NULL. This behavior is inconsistent with the expected outcome, where the row names would ideally be the sample IDs, as observed when using the S (Steele) method. Reprex below: