pyVMO
pyVMO (python Variant Memmap Object), a Python toolkit to help you work with huge variant matrices.
Installation
pip install pyvmo
Usage
From GWAS
- Compress and index your raw vcf files
bgzip your_raw.vcf
tabix -p vcf your_raw.vcf.gz
- Convert the vcf file to vmo, which is a numpy based memmap file (memory map) that will help you read oversized matrices to get the job done in limited memory
shell
PyVMO converter -vcf2vmo your_raw.vcf.gz test.vmo
python
from pyvmo import VMO
vmo_path = "give_me_your_vmo_path"
raw_vcf_file = "your_raw.vcf.gz"
vmo = VMO(vmo_path)
vmo.store_vcf_to_vmo(raw_vcf_file)
- Extraction of useful submatrices by sample listing, variant site quality control
shell
PyVMO extractor sample.id.list test.vmo filter.vmo
python
# extract by sample list
spl_idx_list = vmo.get_samples_index(sample_id_list)
spl_vmo_path = "give_me_your_sample_list_filtered_vmo_path"
spl_vmo = vmo.extract_sub_vmo(spl_vmo_path, spl_idx_list=spl_idx_list)
# extract by variant site quality control
var_idx_list = spl_vmo.site_filter(maf_thr=0.05, mis_thr=0.5, chunk_size=1000, n_jobs=20)
var_vmo_path = "give_me_your_variant_site_filtered_vmo_path"
var_vmo = spl_vmo.extract_sub_vmo(var_vmo_path, var_idx_list=var_idx_list)
- Convert the vmo file into bimbam format
shell
PyVMO converter -vmo2bimbam filter.vmo filter.bimbam
python
bimbam_file = "give_me_your_bimbam_file_path"
var_vmo.to_bimbam(bimbam_file)
- get genetic distance matrix
shell
PyVMO distance filter.vmo ibs.matrix
From Other practices
- Get numpy array from vmo
m = var_vmo.get_matrix()
- Get the sample list
sample_list = var_vmo.get_sample_info()
- Get the variant information in a pandas dataframe
from yxsql import pickle_load_obj, pickle_dump_obj
var_info_df = var_vmo.get_variant_info()
var_index = 1
chr_id = var_info_df.iloc[i]['CHROM']
pos = int(var_info_df.iloc[i]['POS'])
ref = var_info_df.iloc[i]['REF']
alt = pickle_load_obj(var_info_df.iloc[i]['ALT']) # alt is a list
qual = pickle_load_obj(var_info_df.iloc[i]['QUAL'])
filter = pickle_load_obj(var_info_df.iloc[i]['FILTER'])
info = pickle_load_obj(var_info_df.iloc[i]['INFO']) # info is a dict
Metadata
Release files for pyVMO 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyvmo-0.0.7.tar.gz | 11.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyVMO-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.5 kB
Release files / pyvmo-0.0.7.tar.gz
| Download URL | pyvmo-0.0.7.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37db57734629e4edf9118f51438475d864b74dbb289921b766b516f316303194
|
|
BLAKE2b-256 checksum How to use checksums |
81ba37af47980e33dc9cbc7610d552e8c0ed7360f94bcf43f5366b4bca13cb82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.7
|
Release files / pyVMO-0.0.7-py3-none-any.whl
| Download URL | pyVMO-0.0.7-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e79c81879ba91b937a01129bdb7fe7e065aa0be02a3ccc643671a593f8512a57
|
|
BLAKE2b-256 checksum How to use checksums |
66fdac1b33a321100e38235174ce1959bfca25fe3b256ca91770e7e88df68d0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.7
|
Security for pyVMO 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.