winpca 1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
winpca-1.3/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Luka Moritz Blumer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
winpca-1.3/PKG-INFO ADDED
@@ -0,0 +1,105 @@
1
+ Metadata-Version: 2.4
2
+ Name: winpca
3
+ Version: 1.3
4
+ Summary: WinPCA - A package for windowed principal component analysis
5
+ Author-email: Moritz Blumer <lmb215@cam.ac.uk>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Luka Moritz Blumer
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/MoritzBlumer/winpca
29
+ Requires-Python: >=3.9
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: numpy
33
+ Requires-Dist: pandas
34
+ Requires-Dist: scikit-allel
35
+ Requires-Dist: plotly>=6
36
+ Requires-Dist: kaleido>=1
37
+ Requires-Dist: pcangsd>=1.36.4
38
+ Dynamic: license-file
39
+
40
+
41
+ # _WinPCA_
42
+
43
+ A package for windowed principal component analysis.
44
+ WinPCA performs principal component analyses (PCA) in sliding windows along chromosomes. Both hard-called genotypes (input: VCF or TSV) and genotype likelihoods (input: VCF, TSV or BEAGLE) encoding **biallelic SNPs** are accepted. WinPCA uses [scikit-allel](https://scikit-allel.readthedocs.io/en/stable/stats/decomposition.html?highlight=pca) to perform PCAs on genotype data and [PCAngsd](https://github.com/Rosemeis/pcangsd) methods for genotype likelihood (GL, PL) data.
45
+
46
+ WinPCA can aid the initial exploration of new datasets since no prior grouping of input samples is necessary to visualize genetic structure. It has also been used to [identify chromosome-scale inversions in cichlids and to visualize the recombination landscape in a species cross](https://www.biorxiv.org/content/10.1101/2024.07.28.605452v2.full) (Fig. 2) or to [identify ancestry tracts in a hybrid mouse](https://www.biorxiv.org/content/10.1101/2024.08.31.610610v2.full) (Fig. 6).
47
+
48
+ ![example_pca_plot](assets/example.png)
49
+ <br />
50
+ <br />
51
+
52
+
53
+ # Installation
54
+
55
+ ## mamba/conda
56
+
57
+ Simplest install with mamba or conda:
58
+ ```
59
+ mamba install -c conda-forge -c bioconda winpca
60
+ ```
61
+
62
+ ## git
63
+
64
+ ### _Dependencies_
65
+ Please ensure to have these dependencies installed and accessible from your current shell environment: Python packages: [numpy](https://anaconda.org/anaconda/numpy), [pandas](https://anaconda.org/anaconda/pandas), [scikit-allel](https://anaconda.org/conda-forge/scikit-allel), [plotly](https://anaconda.org/plotly/plotly):
66
+ ```
67
+ mamba install numpy pandas scikit-allel "plotly>=6"
68
+ ```
69
+
70
+ Additionally, to run WinPCA on genotype likelihood (GL/PL) data: [PCAngsd](https://github.com/Rosemeis/pcangsd) (installation instructions included), and to render PNG/PDF/SVG plots, [kaleido](https://anaconda.org/channels/conda-forge/packages/python-kaleido/overview).
71
+ <br />
72
+ <br />
73
+
74
+ ### _Obtain WinPCA_
75
+ ```
76
+ git clone https://github.com/MoritzBlumer/winpca.git # clone github repository
77
+ chmod +x winpca/winpca # make exceutable
78
+ ```
79
+ <br />
80
+
81
+ # Quick start
82
+ _Minimal command line to visualize PC 1 along a chromosome (using GT data from a VCF)_:
83
+ <br />
84
+
85
+ ```
86
+ # windowed PCA with default settings (after adding winpca to $PATH)
87
+ winpca pca PREFIX VCF_PATH CHROM_NAME:1-CHROM_SIZE
88
+
89
+ # make a plot of principal component 1 and color by inversion state
90
+ winpca chromplot PREFIX CHROM_NAME:1-CHROM_SIZE -m METADATA_PATH -g METADATA_COLUMN_NAME
91
+ ```
92
+
93
+
94
+ _Please refer to the help messages (winpca {method} -h) or to the [wiki](https://github.com/MoritzBlumer/winpca/wiki) for the full documentation, file format specifications, more use cases and a tutorial to produce the above plot._
95
+
96
+ <br />
97
+
98
+
99
+ ## Citation
100
+ Blumer LM, Good JM & Durbin R (2025). [WinPCA: A package for windowed principal component analysis](https://doi.org/10.1093/bioinformatics/btaf529). _Bioinformatics_, btaf529.
101
+
102
+ ## Contact
103
+
104
+ Moritz Blumer: lmb215@cam.ac.uk
105
+
winpca-1.3/README.md ADDED
@@ -0,0 +1,66 @@
1
+
2
+ # _WinPCA_
3
+
4
+ A package for windowed principal component analysis.
5
+ WinPCA performs principal component analyses (PCA) in sliding windows along chromosomes. Both hard-called genotypes (input: VCF or TSV) and genotype likelihoods (input: VCF, TSV or BEAGLE) encoding **biallelic SNPs** are accepted. WinPCA uses [scikit-allel](https://scikit-allel.readthedocs.io/en/stable/stats/decomposition.html?highlight=pca) to perform PCAs on genotype data and [PCAngsd](https://github.com/Rosemeis/pcangsd) methods for genotype likelihood (GL, PL) data.
6
+
7
+ WinPCA can aid the initial exploration of new datasets since no prior grouping of input samples is necessary to visualize genetic structure. It has also been used to [identify chromosome-scale inversions in cichlids and to visualize the recombination landscape in a species cross](https://www.biorxiv.org/content/10.1101/2024.07.28.605452v2.full) (Fig. 2) or to [identify ancestry tracts in a hybrid mouse](https://www.biorxiv.org/content/10.1101/2024.08.31.610610v2.full) (Fig. 6).
8
+
9
+ ![example_pca_plot](assets/example.png)
10
+ <br />
11
+ <br />
12
+
13
+
14
+ # Installation
15
+
16
+ ## mamba/conda
17
+
18
+ Simplest install with mamba or conda:
19
+ ```
20
+ mamba install -c conda-forge -c bioconda winpca
21
+ ```
22
+
23
+ ## git
24
+
25
+ ### _Dependencies_
26
+ Please ensure to have these dependencies installed and accessible from your current shell environment: Python packages: [numpy](https://anaconda.org/anaconda/numpy), [pandas](https://anaconda.org/anaconda/pandas), [scikit-allel](https://anaconda.org/conda-forge/scikit-allel), [plotly](https://anaconda.org/plotly/plotly):
27
+ ```
28
+ mamba install numpy pandas scikit-allel "plotly>=6"
29
+ ```
30
+
31
+ Additionally, to run WinPCA on genotype likelihood (GL/PL) data: [PCAngsd](https://github.com/Rosemeis/pcangsd) (installation instructions included), and to render PNG/PDF/SVG plots, [kaleido](https://anaconda.org/channels/conda-forge/packages/python-kaleido/overview).
32
+ <br />
33
+ <br />
34
+
35
+ ### _Obtain WinPCA_
36
+ ```
37
+ git clone https://github.com/MoritzBlumer/winpca.git # clone github repository
38
+ chmod +x winpca/winpca # make exceutable
39
+ ```
40
+ <br />
41
+
42
+ # Quick start
43
+ _Minimal command line to visualize PC 1 along a chromosome (using GT data from a VCF)_:
44
+ <br />
45
+
46
+ ```
47
+ # windowed PCA with default settings (after adding winpca to $PATH)
48
+ winpca pca PREFIX VCF_PATH CHROM_NAME:1-CHROM_SIZE
49
+
50
+ # make a plot of principal component 1 and color by inversion state
51
+ winpca chromplot PREFIX CHROM_NAME:1-CHROM_SIZE -m METADATA_PATH -g METADATA_COLUMN_NAME
52
+ ```
53
+
54
+
55
+ _Please refer to the help messages (winpca {method} -h) or to the [wiki](https://github.com/MoritzBlumer/winpca/wiki) for the full documentation, file format specifications, more use cases and a tutorial to produce the above plot._
56
+
57
+ <br />
58
+
59
+
60
+ ## Citation
61
+ Blumer LM, Good JM & Durbin R (2025). [WinPCA: A package for windowed principal component analysis](https://doi.org/10.1093/bioinformatics/btaf529). _Bioinformatics_, btaf529.
62
+
63
+ ## Contact
64
+
65
+ Moritz Blumer: lmb215@cam.ac.uk
66
+
@@ -0,0 +1,13 @@
1
+ """
2
+ WinPCA modules.
3
+ """
4
+
5
+
6
+ ## METADATA
7
+ __author__ = 'Moritz Blumer, 2024'
8
+ __version__ = '1.3'
9
+ __email__ = 'lmb215@cam.ac.uk'
10
+
11
+
12
+ ## IMPORT CONFIG
13
+ from . import config