Skip to content

Commit 8d9a477

Browse files
committed
bugfix: fix bugs with MCP tools
1 parent b2f219e commit 8d9a477

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/discovera_fastmcp/server.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ async def run_deseq2_gsea_pipe(
672672
kept_cols = [gene_col] + [
673673
s for s in sample_order if s in raw_counts_df.columns
674674
]
675-
raw_counts_df = raw_counts_df[kept_cols]
675+
raw_counts_df = raw_counts_df[kept_cols].copy()
676676
else:
677677
# Naive inference: take token before '_' as group label
678678
records = []
@@ -684,7 +684,7 @@ async def run_deseq2_gsea_pipe(
684684
sample_meta_df = pd.DataFrame.from_records(records)
685685
# Keep all sample columns and preserve their original order
686686
kept_cols = [gene_col] + [c for c in sample_cols]
687-
raw_counts_df = raw_counts_df[kept_cols]
687+
raw_counts_df = raw_counts_df[kept_cols].copy()
688688

689689
# start sending heartbeat
690690
heartbeat_task = start_keepalive(ctx, 5.0)
@@ -944,7 +944,7 @@ async def run_deseq2_ora_pipe(
944944
kept_cols = [gene_col] + [
945945
s for s in sample_order if s in raw_counts_df.columns
946946
]
947-
raw_counts_df = raw_counts_df[kept_cols]
947+
raw_counts_df = raw_counts_df[kept_cols].copy()
948948
else:
949949
# Naive inference: take token before '_' as group label
950950
records = []
@@ -956,7 +956,7 @@ async def run_deseq2_ora_pipe(
956956
sample_meta_df = pd.DataFrame.from_records(records)
957957
# Keep all sample columns and preserve their original order
958958
kept_cols = [gene_col] + [c for c in sample_cols]
959-
raw_counts_df = raw_counts_df[kept_cols]
959+
raw_counts_df = raw_counts_df[kept_cols].copy()
960960

961961
# start sending heartbeat
962962
heartbeat_task = start_keepalive(ctx, 5.0)
@@ -984,11 +984,12 @@ async def run_deseq2_ora_pipe(
984984

985985
# Filter significant genes by padj < FDR threshold (default 0.2)
986986
thr = params.fdr_threshold if params.fdr_threshold is not None else 0.2
987-
sig_df = de_results.copy()
988-
if "padj" not in sig_df.columns:
987+
if "padj" not in de_results.columns:
989988
raise ValueError("DESeq2 results missing 'padj' column")
990-
sig_df = sig_df[sig_df["padj"].notna() & (sig_df["padj"] < float(thr))]
991-
sig_df = sig_df[["GeneID"]].dropna()
989+
sig_df = de_results[
990+
de_results["padj"].notna() & (de_results["padj"] < float(thr))
991+
].copy()
992+
sig_df = sig_df[["GeneID"]].dropna().copy()
992993

993994
if sig_df.empty:
994995
logger.info(

0 commit comments

Comments
 (0)