Skip to main content

Pipeline for efficient genomic data processing.

Project description

GenVarLoader

GenVarLoader provides a fast, memory efficient data loader for training sequence models on genetic variation. For example, this can be used to train a DNA language model on human genetic variation (e.g. Nucleotide Transformer).

Features

  • Respects memory budget
  • Supports insertions and deletions
  • Scales to 100,000s of individuals
  • Fast!
  • Extensible to new file formats (drop a feature request!)
  • Coming soon: re-aligning tracks (e.g. expression, chromatin accessibility) to genetic variation (e.g. BigRNA)

Installation

pip install genvarloader

A PyTorch dependency is not included since it requires special instructions.

Quick Start

import genvarloader as gvl

ref_fasta = 'reference.fasta'
variants = 'variants.pgen' # highly recommended to convert VCFs to PGEN
regions_of_interest = 'regions.bed'

Create readers for each file providing sequence data:

ref = gvl.Fasta(name='ref', path=ref_fasta, pad='N')
var = gvl.Pgen(variants)
varseq = gvl.FastaVariants(name='varseq', reference=ref, variants=var)

Put them together and get a torch.DataLoader:

gvloader = gvl.GVL(
    readers=varseq,
    bed=regions_of_interest,
    fixed_length=1000,
    batch_size=16,
    max_memory_gb=8,
    batch_dims=['sample', 'ploid'],
    shuffle=True,
)

dataloader = gvloader.torch_dataloader()

And now you're ready to use the dataloader however you need to:

# implement your training loop
for batch in dataloader:
    ...

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

genvarloader-0.1.10.tar.gz (30.3 kB view details)

Uploaded Source

Built Distribution

genvarloader-0.1.10-py3-none-any.whl (35.2 kB view details)

Uploaded Python 3

File details

Details for the file genvarloader-0.1.10.tar.gz.

File metadata

  • Download URL: genvarloader-0.1.10.tar.gz
  • Upload date:
  • Size: 30.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.10.12 Linux/3.10.0-1160.49.1.el7.x86_64

File hashes

Hashes for genvarloader-0.1.10.tar.gz
Algorithm Hash digest
SHA256 f559958d9989847fa6c28be6cc7a58aad7ad12e78e0ae0e518cbbcab042b98db
MD5 adb090deb5f15ac35560b7738dc468fe
BLAKE2b-256 8743f6bab75264024e24d71a9584eb0c2ce33da89828b24551e55c5d4443565f

See more details on using hashes here.

File details

Details for the file genvarloader-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: genvarloader-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 35.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.10.12 Linux/3.10.0-1160.49.1.el7.x86_64

File hashes

Hashes for genvarloader-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 fa7724e75687654cb29e70a21a4b2b33ce735d201500853b0242427365ee577c
MD5 bf51065ca28ccaeedff239afebfa5961
BLAKE2b-256 c5c1d627aa64fca38a06d27c2337d8ccf95f15f195e3d21a2f93c72830e180ca

See more details on using hashes here.

Supported by

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