crystal.crystal contains the main functions to call DMRs and example cluster-modeling functions.
Model clustered, correlated data.
Feature Class that supports count data.
A feature object that can and likely should be used by all programs that call crystal. Takes a chromosome, a position and a list of float values that are the methylation measurements (should be logit transformed).
Attributes
chrom: str | |
position: int | |
values: list | |
spos: str | string position (chr1:12354) |
rho_min | (float) minimum spearman’s R to be considered correlated |
ovalues | (list) other values potentially used by modeling functions |
Return boolean indicating correlation with other.
Model clusters by fitting model at each site and then comparing some metric to the same metric from models fit to simulated data. Uses sequential Monte-carlo to stop once we know the simulated p-value is high (since we are always interested in low p-values).
Same signature as gee_cluster()
An example of a model_fn; any function with a similar signature can be used.
Parameters: | formula : str
cluster : list of Features
covs : pandas.DataFrame
coef: str
cov_struct: object
family: object
|
---|---|
Returns: | result : dict
|
Model clusters with a mixed-model, same signature as gee_cluster()
For each cluster in an iterable, evaluate the chosen model and yield a dictionary of information
Parameters: | clust_iter : iterable
clin_df : pandas.DataFrame
formula : str
coef : str
model_fn : fn
transform: fn
n_cpu : int kwargs: dict
|
---|
Model a cluster of correlated features with the negative binomial
Model clusters with cluster-robust OLS, same signature as gee_cluster()
used when we have a “cluster” with 1 probe.
wrap the user-defined functions to return everything we expect and to call just OLS when there is a single probe.
Model clusters by fitting model at each site and then combining using the z-score method. Same signature as gee_cluster()