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 quantile_twas_weight colnames missing issue #269

Merged
merged 2 commits into from
Oct 10, 2024
Merged

Conversation

al4225
Copy link
Contributor

@al4225 al4225 commented Oct 10, 2024

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 of X_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 and rownames are consistently preserved, especially in cases where the matrix has only one column or row.

@gaow gaow merged commit ec87745 into cumc:main Oct 10, 2024
3 of 4 checks passed
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