Pipeline for efficient genomic data processing.
Project description
GenVarLoader
GenVarLoader aims to enable training sequence models on 10's to 100's of thousands of individuals' personalized genomes.
Installation
pip install genvarloader
A PyTorch dependency is not included since it requires special instructions.
Quick Start
import genvarloader as gvl
reference = '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=reference, pad='N')
var = gvl.Pgen(variants)
varseq = gvl.FastaVariants(name='varseq', fasta=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,
num_workers=2
)
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
Release history Release notifications | RSS feed
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.6.tar.gz
(29.3 kB
view hashes)
Built Distribution
Close
Hashes for genvarloader-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba6ff425a9f0f1fa7f6c2670d9ec945a2273434f692371b517d0fcb8638172c2 |
|
MD5 | eb362acf0f4dc6232f56ab92d90d3b17 |
|
BLAKE2b-256 | f39eb3258b381cafc2f0e233eea48323a075557b2b9e91bf8ccfe086905c3edb |