Skip to content

Commit

Permalink
removing statsmodels
Browse files Browse the repository at this point in the history
  • Loading branch information
yasharw committed Feb 22, 2023
1 parent 5ed01ac commit bcf555d
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 9 deletions.
Binary file removed data/Homo_sapiens.GRCh38.95.gtf.gz
Binary file not shown.
Binary file removed data/Mus_musculus.GRCm38.95.gtf.gz
Binary file not shown.
Binary file removed data/secondary_intx_regulon.pkl
Binary file not shown.
10 changes: 1 addition & 9 deletions priori/priori.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import functools
import pandas as pd
import numpy as np
import statsmodels.api as sm
from tqdm import tqdm
from sklearn.utils.validation import check_array
import priori.regulon.regulon_enrichment as regulon_enrichment
Expand Down Expand Up @@ -76,7 +75,6 @@ def __init__(self, expr, regulon=None, regulon_size=15,

self.correlations = None
self.p_values = None
self.adjusted_p_values = None

def __str__(self):
return """------\nn-features: {}\nn-samples: {}\nscaler: {}\nscaled:\
Expand Down Expand Up @@ -259,15 +257,10 @@ def assign_weights(self):

# Calculate spearman correlation
r, p = regulon_utils.spearmanr(self.expr)

# # FDR-adjust p-values using the Benjamini-Hochberg method
bool, p_adj, sidak, bonf = sm.stats.multipletests(p.flatten(), method = "fdr_bh")
p_adj = p_adj.reshape(p.shape)

# Create data frames
r_frame = pd.DataFrame(r, columns=self.expr.columns, index=self.expr.columns)
p_frame = pd.DataFrame(p, columns=self.expr.columns, index=self.expr.columns)
p_adj_frame = pd.DataFrame(p_adj, columns=self.expr.columns, index=self.expr.columns)

# Calculate F regression to correct for collinearity
F_statistics = {regulator: regulon_utils.f_regression(
Expand All @@ -280,13 +273,12 @@ def assign_weights(self):
pruned_regulon,
F_statistics,
r_frame,
p_adj_frame)
p_frame)
for regulator in F_statistics])

self.regulon_weights = weights[~np.isinf(weights.MoA)]
self.correlations = r_frame
self.p_values = p_frame
self.adjusted_p_values = p_adj_frame

def calculate_enrichment(self):
"""
Expand Down

0 comments on commit bcf555d

Please sign in to comment.