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.9.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

genvarloader-0.1.9-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: genvarloader-0.1.9.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.8 Linux/4.18.0-477.21.1.el8_8.x86_64

File hashes

Hashes for genvarloader-0.1.9.tar.gz
Algorithm Hash digest
SHA256 f087f7bb959535fca5e94fb0b2744fbebe6d91ff05eee08c9ff997b898c50cb0
MD5 7b67a5adc85acfe34e29bc6b74c5cb9a
BLAKE2b-256 db1299b944d52aaa58def40c0ccf163ac2c541de57691d6ca8316737c86df786

See more details on using hashes here.

File details

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

File metadata

  • Download URL: genvarloader-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 35.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.8 Linux/4.18.0-477.21.1.el8_8.x86_64

File hashes

Hashes for genvarloader-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 b248ed0c34352be1043c9bd224a1b663211274762813cbef9a28426ce46dfa9c
MD5 8d5a5756e2c3afe67a6832db51796edd
BLAKE2b-256 05d853820df113a9d3ff95fca0875627bc03d2bff81b8146f804053701d1f963

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