Skip to content

Commit 2da61bf

Browse files
committed
refactoring
1 parent 10b6163 commit 2da61bf

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

ms2query/ms2query_database.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ def create_from_spectra(
6161
) -> Dict[str, int]:
6262
"""Ingest spectra -> (optionally) create spec↔comp links & upsert compounds.
6363
64+
Parameters
65+
----------
66+
spectra: List[matchms.Spectrum]
67+
List of matchms Spectrum objects to be inserted into the database.
68+
map_compounds: bool, default=True
69+
Whether to map spectra to compounds based on metadata InChIKeys.
70+
create_missing_compounds: bool, default=True
71+
Whether to create compound entries for spectra that do not have a matching compound yet.
72+
6473
Returns counts: {"n_inserted_spectra": int, "n_mapped": int, "n_new_compounds": int}
6574
"""
6675
spec_ids = self.ref_sdb.add_spectra(spectra)
@@ -76,16 +85,6 @@ def create_from_spectra(
7685
mapping_table="spec_to_comp",
7786
create_missing_compounds=create_missing_compounds,
7887
)
79-
# ONLY PLACEHOLDER --> LATER: ADD COMPOUNDS FROM LIST/FILE
80-
_, _ = map_from_spectraldb_metadata(
81-
spectral_db_sqlite_path=self.sqlite_path,
82-
mapping_sqlite_path=self.sqlite_path,
83-
compounds_sqlite_path=self.sqlite_path,
84-
spectra_table=self.ref_spectra_table,
85-
compound_table=self.non_annotated_compound_table,
86-
mapping_table="spec_to_comp_all",
87-
create_missing_compounds=create_missing_compounds,
88-
)
8988
return {
9089
"n_inserted_spectra": len(spec_ids),
9190
"n_mapped": int(n_mapped),

0 commit comments

Comments
 (0)