diff --git a/ms2query/create_new_library/library_files_creator.py b/ms2query/create_new_library/library_files_creator.py index 48ac8c2e..336f99f1 100644 --- a/ms2query/create_new_library/library_files_creator.py +++ b/ms2query/create_new_library/library_files_creator.py @@ -107,13 +107,13 @@ def add_compound_classes(self, """ if compound_classes is True: compound_classes = select_compound_classes(self.list_of_spectra) - elif compound_classes is not None: - if not isinstance(compound_classes, pd.DataFrame): - raise ValueError("Expected a dataframe or True or None for compound classes") + elif compound_classes is not None and isinstance(compound_classes, pd.DataFrame): if not compound_classes.index.name == "inchikey": raise ValueError("Expected a pandas dataframe with inchikey as index name") elif compound_classes is False or compound_classes is None: compound_classes = None + else: + raise ValueError("Expected a dataframe or True or None for compound classes") return compound_classes def create_sqlite_file(self):