@@ -666,13 +666,11 @@ def process_controversial_clusters(
666666 # Previously had consensus indicators check here, now using metrics extraction
667667
668668 # Extract consensus proportion and entropy values for the current round
669- cp_value , h_value = extract_consensus_metrics_from_discussion (response )
669+ cp_value , h_value = _extract_metrics_from_text (response )[: 2 ]
670670
671671 # If unable to extract from discussion, try to extract from consensus check response
672672 if cp_value is None or h_value is None :
673- cp_value , h_value = extract_consensus_metrics_from_discussion (
674- consensus_response
675- )
673+ cp_value , h_value = _extract_metrics_from_text (consensus_response )[:2 ]
676674
677675 # If still unable to extract, use default values
678676 if cp_value is None :
@@ -710,7 +708,7 @@ def process_controversial_clusters(
710708 )
711709
712710 # Extract CP and H from the discussion if available
713- cp_value , h_value = extract_consensus_metrics_from_discussion (response )
711+ cp_value , h_value = _extract_metrics_from_text (response )[: 2 ]
714712 if cp_value is not None and h_value is not None :
715713 updated_consensus_proportion [cluster_id ] = cp_value
716714 updated_entropy [cluster_id ] = h_value
@@ -788,7 +786,7 @@ def process_controversial_clusters(
788786 # if available
789787 if rounds_history :
790788 last_round = rounds_history [- 1 ]
791- cp_value , h_value = extract_consensus_metrics_from_discussion (last_round )
789+ cp_value , h_value = _extract_metrics_from_text (last_round )[: 2 ]
792790 if cp_value is not None and h_value is not None :
793791 updated_consensus_proportion [cluster_id ] = cp_value
794792 updated_entropy [cluster_id ] = h_value
@@ -806,7 +804,7 @@ def process_controversial_clusters(
806804 # Extract metrics from the last round if available
807805 if cluster_id not in updated_consensus_proportion and rounds_history :
808806 last_round = rounds_history [- 1 ]
809- cp_value , h_value = extract_consensus_metrics_from_discussion (last_round )
807+ cp_value , h_value = _extract_metrics_from_text (last_round )[: 2 ]
810808 if cp_value is not None and h_value is not None :
811809 updated_consensus_proportion [cluster_id ] = cp_value
812810 updated_entropy [cluster_id ] = h_value
@@ -835,22 +833,6 @@ def process_controversial_clusters(
835833 return results , discussion_history , updated_consensus_proportion , updated_entropy
836834
837835
838- def extract_consensus_metrics_from_discussion (
839- discussion : str ,
840- ) -> tuple [Optional [float ], Optional [float ]]:
841- """Extract consensus proportion (CP) and entropy (H) values from discussion text.
842-
843- Args:
844- discussion: Text of the model discussion
845-
846- Returns:
847- tuple[Optional[float], Optional[float]]: Extracted CP and H values, or None if not found
848-
849- """
850- cp , h , _ = _extract_metrics_from_text (discussion )
851- return cp , h
852-
853-
854836def extract_cell_type_from_discussion (discussion : str ) -> Optional [str ]:
855837 """Extract the final cell type determination from a discussion.
856838
@@ -1001,7 +983,6 @@ def interactive_consensus_annotation(
1001983 raise ValueError (error_msg )
1002984
1003985 # Filter marker_genes to only include specified clusters
1004- original_marker_genes = marker_genes .copy ()
1005986 marker_genes = {cluster_id : marker_genes [cluster_id ] for cluster_id in valid_clusters }
1006987
1007988 # Log the filtering
0 commit comments