Replace ctwas_ld_loader with ld_loader LD_info mode#463
Merged
Conversation
Add LD_info mode to ld_loader(): accepts a data.frame with LD_file (and optionally SNP_file) columns, loading .cor.xz blocks on demand via process_LD_matrix(). This is the fourth mode alongside R_list, X_list, and ld_meta_path. Remove ctwas_ld_loader() entirely. Its functionality is now covered by: loader <- ld_loader(LD_info = get_ctwas_meta_data(...)$LD_info) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
process_LD_matrix() now auto-detects variant file format: - .bim (PLINK1): 6 or 9 column tab-separated, no header - .pvar/.pvar.zst (PLINK2): header starting with #CHROM, read via existing read_pvar_text() When snp_file_path is NULL, tries .bim, .pvar, .pvar.zst in order. The ld_loader LD_info mode now passes NULL to let auto-detection work instead of hardcoding .bim. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The LD_info mode now auto-detects and handles: 1. Pre-computed .cor.xz + .bim/.pvar (custom block format) 2. PLINK1 prefix (.bed/.bim/.fam) - LD computed via compute_LD() 3. PLINK2 prefix (.pgen/.pvar/.psam) - LD computed via compute_LD() Format is detected by checking which files exist at the LD_file path using has_plink2_files() and has_plink1_files(). Falls back to process_LD_matrix() for .cor.xz blocks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
LD_infomode told_loader(): accepts a data.frame withLD_file(and optionallySNP_file) columns, loading.cor.xzblocks on demand viaprocess_LD_matrix()ctwas_ld_loader()entirely — its functionality is now covered byld_loader(LD_info = get_ctwas_meta_data(...)$LD_info)ld_loader()now has 4 unified modes:R_list,X_list,ld_meta_path+regions,LD_infoUsage
Test plan
R CMD checkpassesctwas_ld_loaderdirectly)🤖 Generated with Claude Code