Skip to content

Commit 1c703ed

Browse files
committed
bug fix
1 parent 709d610 commit 1c703ed

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

modifinder/classes/Compound.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@ def structure(self, value):
130130
if self._structure is not None:
131131
self._exact_mass = rdMolDescriptors.CalcExactMolWt(self._structure)
132132
self._distances = Chem.rdmolops.GetDistanceMatrix(self._structure)
133-
if self.is_known is None:
134-
self.is_known = self._structure is not None
133+
if self.is_known is None and self._structure is not None:
134+
self.is_known = True
135135

136136
if self.is_known and self._structure is None:
137-
self.is_known = False
137+
self.is_known = None
138138

139139
@property
140140
def spectrum(self):
@@ -232,8 +232,8 @@ def update(self, _structure = None, structure = None, id: str = None, _spectrum:
232232

233233
def _parse_data(self):
234234
""" Parse missing and verify the data of the class"""
235-
if self.is_known is None:
236-
self.is_known = (self.structure is not None)
235+
# if self.is_known is None:
236+
# self.is_known = (self.structure is not None)
237237

238238
# if no id is provided, generate one
239239
if self.id is None:

modifinder/classes/Spectrum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __init__(self, incoming_data=None, normalize_peaks = True, **kwargs):
6464
self.ms_mass_analyzer = None
6565
self.ms_dissociation_method = None
6666
self.spectrum_id = None
67-
self.peak_fragments_map = []
67+
self.peak_fragments_map = {}
6868

6969
if incoming_data is None and len(kwargs) == 0:
7070
return
@@ -174,7 +174,7 @@ def clear(self):
174174
self.ms_mass_analyzer = None
175175
self.ms_dissociation_method = None
176176
self.spectrum_id = None
177-
self.peak_fragments_map = []
177+
self.peak_fragments_map = {}
178178

179179

180180
def copy(self):

modifinder/engines/annotation/MAGMaAnnotationEngine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def annotate(self, network: nx.DiGraph, annotate_all: bool = False, **kwargs):
4141
for node in network.nodes:
4242
compound = network.nodes[node]["compound"]
4343
if compound is not None and compound.is_known:
44-
if annotate_all or compound.spectrum.peak_fragments_map is None:
44+
if annotate_all or (compound.spectrum.peak_fragments_map is None or len(compound.spectrum.peak_fragments_map) == 0):
4545
self.annotate_single(compound, modify_compound=True, **kwargs)
4646

4747
# refine by helpers

0 commit comments

Comments
 (0)