Skip to content

Add LD-pruned biallelic SNP access method - #1067

Closed
adilraza99 wants to merge 7 commits into
malariagen:masterfrom
adilraza99:GH-1049-add-ld-pruning-support
Closed

Add LD-pruned biallelic SNP access method#1067
adilraza99 wants to merge 7 commits into
malariagen:masterfrom
adilraza99:GH-1049-add-ld-pruning-support

Conversation

@adilraza99

Copy link
Copy Markdown
Contributor

Summary

Add support for generating LD-pruned SNP datasets from the existing biallelic SNP call pipeline.

Changes

  • introduce AnophelesLdAnalysis mixin
  • add biallelic_snp_calls_ld_pruned() method
  • add ld_params.py for LD pruning parameters
  • integrate the mixin into AnophelesDataResource
  • add tests for LD pruning behaviour

Implementation

The method builds on top of biallelic_snp_calls():

  1. load SNP dataset using the existing pipeline
  2. compute genotype reference counts
  3. apply LD pruning using allel.locate_unlinked
  4. filter variants using _dask_compress_dataset
  5. return an LD-pruned xarray.Dataset

Notes

  • implementation follows the repository's cooperative mixin architecture
  • returned dataset remains compatible with downstream processing (including PLINK export)
  • LD pruning operates on datasets optionally thinned using the existing n_snps parameter

Tests

Added tests to verify:

  • variant count is reduced after pruning
  • dataset structure remains valid
  • compatibility with downstream workflows

closes #1049

@adilraza99
adilraza99 force-pushed the GH-1049-add-ld-pruning-support branch from 4795931 to c4aae55 Compare March 7, 2026 06:28
@adilraza99

Copy link
Copy Markdown
Contributor Author

Hi @jonbrenas,

I ran a quick local check of the new method on a small region. The LD-pruned dataset returns fewer variants than the original SNP calls and behaves as expected with the existing pipeline.

Attaching a screenshot from the local run for reference.
Screenshot 2026-03-07 at 11 55 12 AM

@adilraza99
adilraza99 force-pushed the GH-1049-add-ld-pruning-support branch from c4aae55 to 7a55c6c Compare March 7, 2026 07:00
@adilraza99
adilraza99 force-pushed the GH-1049-add-ld-pruning-support branch from 7a55c6c to 08903d4 Compare March 7, 2026 09:42
@adilraza99

Copy link
Copy Markdown
Contributor Author

@jonbrenas could you take a look at this when you have a moment?

@adilraza99

adilraza99 commented Mar 7, 2026

Copy link
Copy Markdown
Contributor Author

Hi @jonbrenas, thanks for the clarification. I tried an implementation based on the discussion and also ran a quick local verification where the variant count decreases after pruning. When you have time, could you please take a look and let me know if this direction makes sense?

@adilraza99 adilraza99 closed this Mar 15, 2026
@adilraza99
adilraza99 deleted the GH-1049-add-ld-pruning-support branch March 15, 2026 21:36
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.

Adding Admixture functionalities to the API

1 participant