Skip to content

Commit 170537f

Browse files
committed
cleaning, fixing, linting
1 parent 657990d commit 170537f

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

ms2query/database/ann_vector_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ def save_index(self, path_prefix: str) -> None:
727727
if self._index is None:
728728
raise RuntimeError("Index not built.")
729729

730-
# Also save data so that loadIndex(..., load_data=True) works
730+
# Also save data so that load_index(..., load_data=True) works
731731
self._index.saveIndex(f"{path_prefix}.nmslib", save_data=True)
732732
np.save(f"{path_prefix}.ids.npy", self._comp_ids)
733733

ms2query/database/compound_database.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,15 @@ def compute_fingerprints(
467467
Does NOT write to the database.
468468
Provide exactly one of (smiles, inchis).
469469
470+
Parameters
471+
----------
472+
smiles : Optional[List[str]], optional
473+
List of SMILES strings, by default None
474+
inchis : Optional[List[str]], optional
475+
List of InChI strings, by default None
476+
progress_bar : bool, optional
477+
Whether to show a progress bar, by default False
478+
470479
Returns the same shapes/types as compute_morgan_fingerprints:
471480
- dense: np.ndarray of shape (N, nbits)
472481
- sparse/binary: List[np.ndarray[uint32]]

ms2query/ms2query_library.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,25 +185,29 @@ def query_spectra_by_spectra(
185185

186186
def query_compounds_by_compounds(
187187
self,
188-
compounds: Sequence[str],
189188
*,
189+
smiles: Optional[List[str]] = None,
190+
inchis: Optional[List[str]] = None,
190191
k_compounds: int = 10,
191192
) -> List[List[Dict[str, Any]]]:
192193
"""
193194
Query the fingerprint index with compounds, return top-k compounds per compound.
194195
195196
Parameters
196197
----------
197-
compounds : Sequence[str]
198-
Query compounds (expects list of SMILES strings).
198+
smiles : Optional[List[str]], optional
199+
List of SMILES strings, by default None
200+
inchis : Optional[List[str]], optional
201+
List of InChI strings, by default None
199202
k_compounds : int
200203
Number of top compounds to return per query compound.
201204
"""
202205
self._ensure_fingerprint_index()
203206

204207
# Compute fingerprints (sparse representation)
205208
fps = self.db.all_cdb.compute_fingerprints(
206-
compounds,
209+
smiles=smiles,
210+
inchis=inchis,
207211
)
208212

209213
# Batched fingerprint ANN query

0 commit comments

Comments
 (0)