Metadata-Version: 2.4
Name: lno_prescreener
Version: 0.1.2
Summary: A multiple hypothesis testing tool for pre-screening high-dimensional data using the Leave-n-Out approach.
Author-email: Halil Arici <halilarici00@gmail.com>
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: numpy>=1.20.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: scipy>=1.7.0
Requires-Dist: statsmodels>=0.13.0
Requires-Dist: tqdm>=4.60.0
Requires-Dist: joblib>=1.0.0

lno-prescreener

A high-performance, multiple hypothesis testing tool for pre-screening factor selection in high-dimensional data using the Leave-n-Out (LnO) approach.

Designed for researchers working with metabolomic, genomic, or clinical datasets, this library provides a robust, multi-core pipeline to filter out false discoveries using adaptive univariate testing and combinatorial resampling.

FEATURES
* Scientifically Rigorous: Implements an adaptive decision tree (Anderson-Darling, Levene, KS, Mann-Whitney, t-tests) perfectly aligned with established LnO methodology.
* Highly Flexible: Works with any Pandas DataFrame. You can define your own target columns, cohort labels, and index parameters.
* Multi-Core Processing: Utilizes joblib parallel processing to evaluate thousands of features simultaneously, cutting compute times from hours to seconds.
* Missing Data Handling: Automatically purges incomplete features to maintain strict data integrity.
* Defensive Design: Explicit input validation prevents obscure math crashes and provides clear, human-readable errors if your data is misconfigured.

INSTALLATION

You can install lno-prescreener directly from PyPI:
pip install lno-prescreener

QUICK START

Here is a concise example of how to load your data and run the pre-screener pipeline.

from lno_prescreener import LnOPrescreener

# Initialize the pre-screener
screener = LnOPrescreener(
    data_input="sqrt_transformed_data.csv",
    target_variable="Diagnosis",
    case_label="ASD",
    control_label="TD",
    index_col=0  #(int or None) The column number to use as the row labels (default: 0). Set to None if your data does not have an ID column.
)

# Run the multiple hypothesis testing pipeline
results = screener.multiple_hypothesis_testing(
    run_l2o=False, 
    run_l3o=True, 
    fdr_threshold=0.1, 
    p_val_threshold=0.05
)

# Save the full comprehensive results to CSV
results.to_csv("prescreening_results.csv", index=False)


API REFERENCE

Initialization
LnOPrescreener(data_input, target_variable='Diagnosis', case_label='ASD', control_label='TD', index_col=0)
* data_input: (str or DataFrame) Path to your CSV file, or a pre-loaded Pandas DataFrame.
* target_variable: (str) The exact name of the column containing your class labels.
* case_label: (str) The exact string used to identify cases in the target column.
* control_label: (str) The exact string used to identify controls in the target column.
* index_col: (int or None) The column number to use as the row labels (default: 0). Set to None if your data does not have an ID column.

Execution
screener.multiple_hypothesis_testing(run_l2o=False, run_l3o=False, p_val_threshold=0.05, fdr_threshold=0.10)
* run_l2o: (bool) If True, runs the Leave-2-Out permutation tests. Note: Computationally expensive for large N.
* run_l3o: (bool) If True, runs the Leave-3-Out permutation tests. Note: Highly computationally expensive for large N.
* p_val_threshold: (float) The alpha threshold for the baseline and adaptive univariate tests (default: 0.05).
* fdr_threshold: (float) The maximum allowable False Discovery Rate for a feature to be flagged as significant (default: 0.10).

OUTPUT DATAFRAME
The multiple_hypothesis_testing method returns a rich Pandas DataFrame containing:
* The original and shifted p-values.
* The specific statistical test applied by the adaptive decision tree.
* Bonferroni and Benjamini-Hochberg corrected p-values.
* Raw FDR scores and boolean Significant flags for Baseline, L1O, L2O, and L3O.
