Skip to content

Commit

Permalink
generalize spearman correlation fcm
Browse files Browse the repository at this point in the history
  • Loading branch information
tmchartrand committed Aug 30, 2023
1 parent bdb7651 commit 92d8f69
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions patchseq_utils/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,12 @@ def plot_spearman(data, x, y, smooth=True, hue=None, palette=None,
verticalalignment='top', horizontalalignment='center')
sns.despine()

def run_correlations(data, features, xvar, fdr_method='fdr_bh'):
def run_correlations(data, features, xvar, fdr_method='fdr_bh', filter_dropouts=True):
results = []
for gene in features:
if gene not in data or data[gene].pipe(lambda x: sum(x>1)) < 5:
if gene not in data:
continue
if filter_dropouts and data[gene].pipe(lambda x: sum(x>1)) < 5:
continue
df = data.dropna(subset=[gene, xvar])
r, p = spearmanr(df[gene], df[xvar])
Expand Down

0 comments on commit 92d8f69

Please sign in to comment.