Skip to main content

lostruct-py

This is a reimplementation of lostruct from the original code: Lostruct. Please cite the original paper

Build Status DOI

Demonstration / How to use

Please see the Example Notebook

Installation

Lostruct-py is available on PyPi pip install lostruct-py is the easiest way to get started.

Citing

Please use our DOI to cite this specific project. Also please cite the original Lostruct paper and CyVCF2.

DOI: 10.5281/zenodo.3997086

Original Lostruct Paper

Please cite the original lostruct paper:

Li, Han, and Peter Ralph. "Local PCA shows how the effect of population structure differs along the genome." Genetics 211.1 (2019): 289-304.

CyVCF2

This paper also uses cyvcf2 for fast VCF processing and should be cited:

Brent S Pedersen, Aaron R Quinlan, cyvcf2: fast, flexible variant analysis with Python, Bioinformatics, Volume 33, Issue 12, 15 June 2017, Pages 1867–1869, https://doi.org/10.1093/bioinformatics/btx057

Changes from Lostruct R package

Please note numpy and R are different when it comes to row-major vs. column-major. Essentially, many things in the python version will be transposed from R.

Requirements

Python >= 3.6 (may work with older versions). Developed on Python 3.8.5

  • numba
  • numpy
  • pandas
  • scipy
  • skbio
  • sklearn
  • cyvcf2

CyVCF2 requires zlib-dev, libbz2-dev, libcurl-dev, liblzma-dev, and probably others

Easiest to install all of these through conda

Correlation Data

Used Medicago HapMap sister taxa chromsome 1, processed, and run with LoStruct

Data

bcftools annotate chr1-filtered-set-2014Apr15.bcf -x INFO,FORMAT | bcftools view -a -i 'F_MISSING<=0.2' | bcftools view -q 0.05 -q 0.95 -m2 -M2 -a -Oz -o chr1-filtered.vcf.gz

Lostruct Processing

Rscript run_lostruct.R -t SNP -s 95 -k 10 -m 10 -i data/

This generates the mds_coords.tsv that is used in the correlation comparison.

FAQ / Notes

Future

Currently the end-user is expected to save the outputs. But could be good to save it in a similar way to lostruct R-code. Please open an issue if you need this.

PCA, MDS, PCoA

PCoA returns the same results as lostruct's MDS implementation (cmdscale). In the example Jupyter notebook you can see the correlation is R =~ 0.998. Some examples of other methods of clustering / looking at differences are included in the notebook.

Casting complex values to real discards the imaginary part

This is fine.

Metadata

Release files for lostruct-py 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lostruct-py 0.0.3
File Size Uploaded Provenance Actions
lostruct-py-0.0.3.tar.gz 6.2 kB Without provenance Details for lostruct-py-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lostruct-py 0.0.3
File Interpreter ABI Platform Actions
lostruct_py-0.0.3-py3-none-any.whl Python 3 none any Details for lostruct_py-0.0.3-py3-none-any.whl

Total release size: 15.5 kB

Release files / lostruct-py-0.0.3.tar.gz

Download URL lostruct-py-0.0.3.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
249c815f875ebf5510f6485936cf95c664d46533cca01c61b8151459dabf8571
BLAKE2b-256 checksum
How to use checksums
740b0000f5f016632b5be2de38e43155a9e5afe98bcdc49ec2eaf9ed526466b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / lostruct_py-0.0.3-py3-none-any.whl

Download URL lostruct_py-0.0.3-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d273601612ae1a2cafff289e073241d9faa13a79257e67ac543ddba4a6d39c2
BLAKE2b-256 checksum
How to use checksums
e63323faff851f0c6f718fb1c80fabb414645a8f89e3b9bbb606252cdba196e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Security for lostruct-py 0.0.3

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.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page