Christina Theodoris commited on
Commit
df297bc
·
1 Parent(s): 39b4444

update function for N_Detections for mixture_model without anchor_token

Browse files
geneformer/in_silico_perturber_stats.py CHANGED
@@ -640,10 +640,16 @@ def isp_stats_mixture_model(cos_sims_df, dict_list, combos, anchor_token):
640
  cos_sims_full_df = pd.concat([cos_sims_full_df, cos_sims_df_i])
641
 
642
  # quantify number of detections of each gene
643
- cos_sims_full_df["N_Detections"] = [
644
- n_detections(i, dict_list, "gene", anchor_token)
645
- for i in cos_sims_full_df["Gene"]
646
- ]
 
 
 
 
 
 
647
 
648
  if combos == 0:
649
  cos_sims_full_df = cos_sims_full_df.sort_values(
 
640
  cos_sims_full_df = pd.concat([cos_sims_full_df, cos_sims_df_i])
641
 
642
  # quantify number of detections of each gene
643
+ if anchor_token is None:
644
+ cos_sims_full_df["N_Detections"] = [
645
+ n_detections(i, dict_list, "cell", anchor_token)
646
+ for i in cos_sims_full_df["Gene"]
647
+ ]
648
+ else:
649
+ cos_sims_full_df["N_Detections"] = [
650
+ n_detections(i, dict_list, "gene", anchor_token)
651
+ for i in cos_sims_full_df["Gene"]
652
+ ]
653
 
654
  if combos == 0:
655
  cos_sims_full_df = cos_sims_full_df.sort_values(