Skip to content

Commit

Permalink
Update analysis.py
Browse files Browse the repository at this point in the history
  • Loading branch information
nargesr committed Apr 22, 2024
1 parent 34ef6ee commit bf30041
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Topyfic/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ def convertDatTraits(data):

def TopicTraitRelationshipHeatmap(self,
metaData,
alternative='two-sided',
annotation=False,
save=True,
show=True,
Expand All @@ -447,6 +448,8 @@ def TopicTraitRelationshipHeatmap(self,
:param metaData: traits you would like to see the relationship with topics (must be column name of cell_participation.obs)
:type metaData: list
:param alternative: Defines the alternative hypothesis for calculating correlation for module-trait relationship. Default is ‘two-sided’. The following options are available: 'two-sided’: the correlation is nonzero, ‘less’: the correlation is negative (less than zero), ‘greater’: the correlation is positive (greater than zero)
:type alternative: str
:param annotation: indicate if you want to add correlation and p_values as a text in each square (default:False)
:type annotation: bool
:param save: indicate if you want to save the plot or not (default: True)
Expand Down Expand Up @@ -474,7 +477,7 @@ def TopicTraitRelationshipHeatmap(self,
~np.isclose(self.cell_participation.to_df()[i],
min_cell_participation, atol=min_cell_participation)]

tmp = stats.spearmanr(tmp[i], datTraits.loc[tmp.index, j], alternative='greater')
tmp = stats.spearmanr(tmp[i], datTraits.loc[tmp.index, j], alternative=alternative)
topicsTraitCor.loc[i, j] = tmp[0]
topicsTraitPvalue.loc[i, j] = tmp[1]

Expand Down

0 comments on commit bf30041

Please sign in to comment.