Skip to main content

Add your description here

Project description

lanctools

Tools for working with local ancestry data in the .lanc file format. This package contains two main components:

  1. A function (and corresponding CLI) for converting FLARE and RFMix files to the .lanc format
  2. A LancData class with methods for fast querying of local ancestry and local ancestry-masked genotypes

Installation

pip install lanctools

Quickstart

To load and query local ancestry data for a set of variants::

import numpy as np

from lanctools import LancData

ld = LancData(
    plink_prefix="chr1",
    lanc_file="chr1.lanc",
    ancestries=["YRI", "CEU"]
)

idx_var = np.arange(100, dtype=np.uint32)

lanc = ld.get_lanc(idx_var) # (N, 100, 2): phased local ancestry
geno = ld.get_geno(idx_var) # (N, 100, 2): phased genotypes
lanc_geno = ld.get_lanc_geno(idx_var) # (N, 100, len(ancestries))

To convert a FLARE (or RFMix) local ancestry file to .lanc:

from lanctools import convert_to_lanc

convert_to_lanc(
    file="chr1.anc.vcf.gz",
    file_fmt="FLARE",
    plink_prefix="chr1",
    output="chr1.lanc"
)

To perform the above conversion using the CLI tool:

lanctools convert-flare --file chr1.anc.vcf.gz --plink_prefix chr1 --output chr1.lanc

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lanctools-0.0.0.tar.gz (60.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lanctools-0.0.0-cp312-cp312-macosx_26_0_arm64.whl (74.5 kB view details)

Uploaded CPython 3.12macOS 26.0+ ARM64

File details

Details for the file lanctools-0.0.0.tar.gz.

File metadata

  • Download URL: lanctools-0.0.0.tar.gz
  • Upload date:
  • Size: 60.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for lanctools-0.0.0.tar.gz
Algorithm Hash digest
SHA256 07a8c99148f49115d5d308df14ea186a811ba5d444047244c0215f1abc450b2f
MD5 2ae1e9d68d8e7146473538b3bd8ac043
BLAKE2b-256 6edd406b38a635e53af9c3c517a7cc641382e894e995618eded3b3101476ae14

See more details on using hashes here.

File details

Details for the file lanctools-0.0.0-cp312-cp312-macosx_26_0_arm64.whl.

File metadata

  • Download URL: lanctools-0.0.0-cp312-cp312-macosx_26_0_arm64.whl
  • Upload date:
  • Size: 74.5 kB
  • Tags: CPython 3.12, macOS 26.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for lanctools-0.0.0-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 29431507864b2c3fd82c34bdb6b47eae7d8285e75228fc85fa0c5e4e475cace1
MD5 289437a907be5301136cb4e8b536d42f
BLAKE2b-256 7f183450cd4668fffc32c4757f510ce865dceb84a69b7f0276470a979e4d8211

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page