LMSstat_python: Python implementation of LMSstat (https://github.com/SNUFML/LMSstat)
Installation
pip install lmsstat
Usage
Input format: the first two columns must be Sample (col 0) and Group (col 1). The remaining columns are treated as metabolites/features.
t-test, u-test, ANOVA, and Kruskal-Wallis test
from lmsstat import stat
import pandas as pd
data = pd.read_csv("data.csv")
result = stat.allstats(data)
# result = stat.allstats(data, p_adj=False) # When you don't want to adjust p-value
result.to_csv('result.csv', index=False) # Save the result as a csv file
Normality test
보정되지 않은 결과이므로 주의.
from lmsstat import stat
import pandas as pd
path = "data.csv"
data = pd.read_csv(path)
result = stat.norm_test(data)
result
Data Standardization
import pandas as pd
from lmsstat import stat
path = "data.csv"
data = pd.read_csv(path)
scaled_data = stat.scaling(data)
scaled_data.to_csv("scaled_data.csv")
scaled_data
PCA
from lmsstat import plot
import pandas as pd
data = pd.read_csv("data.csv")
pca_plt = plot.plot_pca(data, n_components=2)
pca_plt[0].show()
print(f"R2: {pca_plt[1]}, Q2: {pca_plt[2]}") # R2, Q2
PLS-DA
from lmsstat import plot
import pandas as pd
data = pd.read_csv("data.csv")
plsda_plt = plot.plot_plsda(data, n_components=2)
plsda_plt[0].show()
print(f"R2X: {plsda_plt[1]}, R2Y: {plsda_plt[2]}, Q2: {plsda_plt[3]}") # R2, Q2
print(plsda_plt[4].head()) # VIP ranking (DataFrame)
Box plot, Bar plot
각각 현재 작업 디렉토리 밑에 만들어진 boxplot, barplot 폴더에 자동으로 저장됨.
from lmsstat import plot, stat
import pandas as pd
data = pd.read_csv("data.csv")
stats_res = stat.allstats(data)
plot.plot_box(data, stats_res, test_type="t-test")
plot.plot_bar(data, stats_res, test_type="t-test")
# plot only significant metabolites for the selected test (default alpha=0.05)
# plot.plot_box(data, stats_res, test_type="t-test", significant_only=True)
# plot.plot_bar(data, stats_res, test_type="t-test", significant_only=True, alpha=0.01)
# limit parallelism (use 1 to run serially)
# plot.plot_box(data, stats_res, test_type="t-test", max_workers=1)
# plot.plot_bar(data, stats_res, test_type="t-test", max_workers=2)
# if your environment shows growing memory usage with long runs, you can restart workers periodically
# plot.plot_box(data, stats_res, test_type="t-test", max_workers=4, restart_every=500)
# boxplot point rendering options
# plot.plot_box(data, stats_res, test_type="t-test", points="none")
# plot.plot_box(data, stats_res, test_type="t-test", points="non_outliers")
Heatmap
from lmsstat import plot
import pandas as pd
data = pd.read_csv("data.csv")
plot.plot_heatmap(data)
Metadata
Release files for lmsstat 0.1.1
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 | Actions |
|---|---|---|---|---|
| lmsstat-0.1.1.tar.gz | 978.3 kB | Without provenance | Details for lmsstat-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lmsstat-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for lmsstat-0.1.1-py3-none-any.whl |
Total release size: 1.0 MB
Release files / lmsstat-0.1.1.tar.gz
| Download URL | lmsstat-0.1.1.tar.gz |
|---|---|
| Size | 978.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
604faa4bc50dc8622e71417138b25021920fc695bf8bb772bdf4b48a896b1c9f
|
|
BLAKE2b-256 checksum How to use checksums |
e6401e624fa1055c0c5dc3f01686c5f9f0dfc5f27ef5967893375a0876d4e1a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.5
|
Release files / lmsstat-0.1.1-py3-none-any.whl
| Download URL | lmsstat-0.1.1-py3-none-any.whl |
|---|---|
| Size | 24.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca5c220eae46c1ce947510445ee7e8ad08163ad64cbb2622900db5d832fa9933
|
|
BLAKE2b-256 checksum How to use checksums |
5cab9b858ab8afaba32d2a39fb5ba1a92e61541a3a9700e87741d89865c0edbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.5
|
Security for lmsstat 0.1.1
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.