Skip to content

Commit 3de32f1

Browse files
committed
add get_all_mappings method
1 parent 3a8ef59 commit 3de32f1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ms2query/compound_database.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,11 @@ def get_specs_for_comp(self, comp_id: str) -> List[int]:
574574
rows = self._conn.execute("SELECT spec_id FROM spec_to_comp WHERE comp_id = ?", (comp_id,)).fetchall()
575575
return [r[0] for r in rows]
576576

577+
def get_all_mappings(self) -> pd.DataFrame:
578+
"""Return all spec_id <-> comp_id mappings as a DataFrame."""
579+
rows = self._conn.execute("SELECT spec_id, comp_id FROM spec_to_comp").fetchall()
580+
return pd.DataFrame(rows, columns=["spec_id", "comp_id"])
581+
577582

578583
# ==================================================
579584
# Integrations with SpectralDatabase

0 commit comments

Comments
 (0)