fix quantile_twas_weight colnames missing issue #269
Merged
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.
FIX Error 1: LD Clumping and Pruning Error
Issue:
When performing LD clumping and pruning from QR screen results, the following error occurred:
Error: invalid assignment for reference class field ‘nrow’, should be from class “numeric” or a subclass (was class “NULL”)
Cause:
This error occurs when the union of SNPs after LD clumping contains only one SNP. Since there is only one SNP, the process cannot proceed to LD pruning, which requires more than one SNP.
Solution:
To fix this, I modified the process so that when only one SNP remains after LD clumping, the function directly returns the final SNPs without attempting LD pruning.
FIX Error 2: check_remove_highcorr_snp and Missing
dimnames
Issue:
When processing check_remove_highcorr_snp, the following error occurred:
Error in dimnames(x) <- dn :
length of 'dimnames' [2] not equal to array extent
Calls: quantile_twas_weight_pipeline ... calculate_qr_and_pseudo_R2 -> check_remove_highcorr_snp -> colnames<-
Cause:
This error happens when only one SNP passes the
corr_filter
function. In such cases, the column name ofX_filter
is lost, leading to a mismatch in the dimensions.Solution:
To resolve this, I ensured that when a matrix contains only one column, the column name is preserved. This prevents the loss of
colnames
in cases where only one SNP passes through the filter.Additional Improvements:
In addition to fixing these two issues, I reviewed other functions to ensure that
colnames
andrownames
are consistently preserved, especially in cases where the matrix has only one column or row.