A Python package for omics data visualization with a focus on PCA plotting
Project description
omixvizpy
A Python package for omics data visualization, particularly focused on Principal Component Analysis (PCA) plotting.
Features
- PCA Visualization: Create comprehensive PCA plots with multiple grouping options
- Flexible Plotting: Support for scatter plots and pair plots of principal components
- Customizable: Easy-to-use functions with extensive customization options
- Publication Ready: High-quality plots suitable for scientific publications
Installation
From PyPI (recommended)
pip install omixvizpy
From Source
git clone https://github.com/Leslie-Lu/omixvizpy.git
cd omixvizpy
pip install -e .
Quick Start
import omixvizpy
# Plot PCA results with covariates
omixvizpy.plot_pca(
eigenvec_file="path/to/your/eigenvec.txt",
covar_file="path/to/your/covariates.csv",
cov1="Country_of_birth", # First covariate
cov2="Ethnic_background", # Second covariate (optional)
legend_title_cov1="Country of Birth", # Legend title for first covariate
legend_title_cov2="Ethnicity", # Legend title for second covariate
cov1_levels=["England", "Wales", "Scotland", "Others"], # Labels for first covariate
cov2_levels=["White", "Asian", "Black", "Others"], # Labels for second covariate
fig_path="output/directory", # Output directory
fig1_name="variance_explained", # Variance plot
fig2_name="pc1_vs_pc2", # PC1 vs PC2 scatter plot
fig3_name="pca_by_country", # Pairplot by first covariate
fig4_name="pca_by_ethnicity", # Pairplot by second covariate
fig1_size=(11, 9), # Size of variance explained plot
fig2_size=(12, 12), # Size of PC1 vs PC2
save_figs=True # Save figures instead of displaying
)
Function Reference
plot_pca
Create comprehensive PCA visualization plots.
Parameters:
eigenvec_file(str): Path to the eigenvec file containing PCA resultscovar_file(str): Path to the CSV file containing covariate informationcov1(str): Name of the first covariate column (default: 'Country_of_birth')cov2(Optional[str]): Name of the second covariate columnlegend_title_cov1(str): Title for the first covariate's legendlegend_title_cov2(Optional[str]): Title for the second covariate's legendcov1_levels(List[str]): Labels for the first covariate's valuescov2_levels(Optional[List[str]]): Labels for the second covariate's valuesfig_path(Optional[str]): Directory path where figures will be savedfig1_name(str): Name for the variance explained plot (default: 'variance_explained')fig2_name(str): Name for the PC1 vs PC2 scatter plotfig3_name(str): Name for the pairplot colored by first covariatefig4_name(str): Name for the pairplot colored by second covariatefig1_size(Tuple[int, int]): Size of the variance explained plot (default: (11, 9))fig2_size(Tuple[int, int]): Size of the PC1 vs PC2 scatter plot (default: (12, 12))save_figs(bool): Whether to save the figures (default: False)
Returns:
- Displays interactive plots and optionally saves them as PNG files
Input Data Format
Eigenvec File
The eigenvec file should be a tab-separated file with the following columns:
eid: Sample identifierPC1,PC2,PC3, etc.: Principal component values
Covariate File
The covariate file should be a comma-separated (CSV) file with the following structure:
eid: Sample identifier (matching eigenvec file)- Additional columns for covariates (e.g.,
Country_of_birth,Ethnic_background)- Values in these columns should correspond to the levels specified in
cov1_levelsandcov2_levels - The order of levels in
cov*_levelsdetermines the order in the plot legend
- Values in these columns should correspond to the levels specified in
Requirements
- Python >=3.8
- pandas >=1.3.0
- matplotlib >=3.3.0
- seaborn >=0.11.0
- numpy >=1.20.0
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Citation
If you use omixvizpy in your research, please cite:
@software{omixvizpy,
title={omixvizpy: A Python package for omics data visualization},
author={Zhen Lu},
year={2025},
url={https://github.com/Leslie-Lu/omixvizpy}
}
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file omixvizpy-0.1.2.tar.gz.
File metadata
- Download URL: omixvizpy-0.1.2.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
752ef88dd295e204128eca676a806d9045de0b156c690bd21f9ab3b1f1a53a7c
|
|
| MD5 |
f2776d1e22026585989f141bc15c30de
|
|
| BLAKE2b-256 |
89b4ff0612e0ac71c005a83dbf5d912bd5b843a9230d0c2bbbe799622208fd1c
|
File details
Details for the file omixvizpy-0.1.2-py3-none-any.whl.
File metadata
- Download URL: omixvizpy-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a7f373e94d8a63d4a5f86d5e8655613494112dc1afebc296814d6edff4c3d27
|
|
| MD5 |
3a0caf4beb0fa4609c991241734b0da0
|
|
| BLAKE2b-256 |
4249f9f1815796e44075e68b1447649e05ea9d8cf9e61983f459db55d98d0955
|