From 61838d14d1b5f46a162f8d6a12b7e41bcf0ae949 Mon Sep 17 00:00:00 2001 From: Boris MUZELLEC Date: Tue, 1 Aug 2023 16:53:11 +0200 Subject: [PATCH] fix: support coeff=None for continuous factors in lfc_shrink() --- pydeseq2/ds.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pydeseq2/ds.py b/pydeseq2/ds.py index e3b80ed2..4e772617 100644 --- a/pydeseq2/ds.py +++ b/pydeseq2/ds.py @@ -304,7 +304,14 @@ def lfc_shrink(self, coeff: Optional[str] = None) -> None: (default: ``None``). """ - contrast_level = f"{self.contrast[0]}_{self.contrast[1]}_vs_{self.contrast[2]}" + if self.contrast[1] == self.contrast[2] == "": + # The factor being tested is continuous + contrast_level = self.contrast[0] + else: + # The factor being tested is categorical + contrast_level = ( + f"{self.contrast[0]}_{self.contrast[1]}_vs_{self.contrast[2]}" + ) if coeff is not None: if coeff not in self.LFC.columns: