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

Add mehod to go from SNP-level (SNPObject) to window-level ancestry information (LocalAncestryObject) #17

Merged

Conversation

miriambt
Copy link
Collaborator

Implemented the convert_to_window_level method within the SNPObject class to aggregate ancestry data into genomic windows within a LocalAncestryObject. This method supports three flexible options for defining windows:

  1. Fixed Window Size:
    Specify a uniform size using window_size. The last window on each chromosome may be larger if SNPs are not evenly divisible by the size.

  2. Custom Start and End Positions:
    Define windows with physical_pos (a 2D array of [start, end] base-pair coordinates).

    • If chromosomes is not provided and the dataset has only one chromosome, all windows are assumed to belong to that chromosome.
    • If multiple chromosomes exist but chromosomes is missing, an error will be raised.
    • Optionally, specify window_sizes to store the SNP count per window.
  3. Matching Existing Windows:
    Reuse window definitions (physical_pos, chromosomes, window_sizes) from an existing laiobj.

@miriambt miriambt added the enhancement New feature or request label Jan 10, 2025
@miriambt miriambt requested review from salcc and davidbonet January 10, 2025 12:11
snputils/ancestry/genobj/local.py Show resolved Hide resolved
@salcc salcc merged commit 2b01d03 into main Jan 10, 2025
6 checks passed
@salcc salcc deleted the feature/PSW-112-implement-method-to-convert-to-window-level branch January 10, 2025 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants