Skip to content

Commit

Permalink
update save_data method to ensure consistent return
Browse files Browse the repository at this point in the history
  • Loading branch information
CunliangGeng committed Jun 17, 2024
1 parent 9704f64 commit 8f77cba
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/nplinker/nplinker.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,19 +304,14 @@ def save_data(
) -> None:
"""Pickle data to a file.
The data to be pickled is a tuple containing the BGCs, GCFs, Spectra, MolecularFamilies and
StrainCollection objects, i.e. `(bgcs, gcfs, spectra, mfs, strains)`.
If the `links` argument is provided, the LinkGraph object is also included in the tuple, i.e.
`(bgcs, gcfs, spectra, mfs, strains, links)`.
The data to be pickled is a tuple containing the BGCs, GCFs, Spectra, MolecularFamilies,
StrainCollection and links, i.e. `(bgcs, gcfs, spectra, mfs, strains, links)`. If the links
are not provided, `None` will be used.
Args:
file: The path to the pickle file to save the data to.
links: The LinkGraph object to save.
"""
if links is None:
data = (self.bgcs, self.gcfs, self.spectra, self.mfs, self.strains)
else:
data = (self.bgcs, self.gcfs, self.spectra, self.mfs, self.strains, links)
data = (self.bgcs, self.gcfs, self.spectra, self.mfs, self.strains, links)
with open(file, "wb") as f:
pickle.dump(data, f)

0 comments on commit 8f77cba

Please sign in to comment.