Skip to content

sriramlab/FastKAST

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

icon

Fast Model-X Kernel-based Set Testing Toolkits

PyPI Package

This project integrates both FastKAST and QuadKAST to enhance software flexibility and usability.

If the users intend to use a data format similar to ours, we further provide detailed instructions on each specific method pipeline in the sub-branches.

Table of Contents

  1. Installation
  2. Basic usage
  3. Data Availability

Installation

  1. You need python >= 3.60 in order to run the code (anaconda3 recommended)
  2. pip install fast-kernel-set-test or install from source

You can either follow the standard pipeline FastKAST_annot.py and QuadKAST_annot.py, or import the neccessary function to build based on your own I/O.

Basic usage

Hypothesis Testing

The hypothesis testing functions offer flexible usage without extra data format or processing dependencies.

  • Single trait analysis
### Given covariates c: (NxM), input Z: (NxD), and output y: (Nx1)
from FastKAST.Compute.est import getfullComponentPerm
results = getfullComponentPerm(c,Z,y,Perm=10)
## results: {'pval': [obs_pval, perm_pval1, ..., perm_pval10]}     
  • Multi-traits analysis
## Given covariates c: (NxM), input Z: (NxD), and output y: (NxK)
from FastKAST.Compute.est import getfullComponentMulti
results = getfullComponentMulti(c,Z,y)
## results: {'pval': [obs_pval1, obs_pval2, ..., obs_pvalK]}     

FastKAST function

FastKAST by default adapts the rbf kernel testing.

from FastKAST.methods.fastkast import FastKASTComponent
## Construct object
fastkast_component = FastKASTComponent(X, Z, y, MapFunc='rbf', D=50)
## Execution
results = fastkast_component.run()

QuadKAST function

QuadKAST by default adapts the quadratic only kernel testing (e.g., in the absence of additive component).

from FastKAST.methods.fastkast import FastKASTComponent
## Construct object
fastkast_component = FastKASTComponent(X, Z, y, MapFunc='quadOnly') ## D is unused under explicit kernel construction
## Execution
results = fastkast_component.run()

SKAT function

SKAT by default adapts the linear kernel testing.

from FastKAST.methods.fastkast import FastKASTComponent
## Construct object
fastkast_component = FastKASTComponent(X, Z, y, MapFunc='linear') 
## Execution
results = fastkast_component.run()

Customized kernel

The users are allowed to construct customized kernel based on their own need. The customized kernel is supposed to take the input data and transform to another matrix in the mapped dimension.

### Test customized kernel
    def mapping(Z):
        mapping_func = PolynomialCountSketch(n_components=50)
        Z = mapping_func.fit_transform(Z)
        return Z
## Construct object
fastkast_component = FastKASTComponent(X, Z, y, mapping=mapping)
## Execution
results = fastkast_component.run()

Data availability

The detailed statistics used to generate the main table and the Venn diagram of the paper are provided in the Data folder

✅ Efficient multi-traits analysis (Sep 30, 2024)

✅ Refactor the function into class (Dec 28, 2024)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •