Skip to content

Commit

Permalink
Plot spectra without peptide annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
bittremieux committed Oct 10, 2022
1 parent 5095b01 commit 437acb7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spectrum_utils/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def _annotate_ion(
ion_type = annotation.ion_type[0] if annotation is not None else None
color = colors.get(ion_type if color_ions else None)
zorder = zorders.get(ion_type)
if annot_fmt is not None:
if annot_fmt is not None and annotation is not None:
y = intensity + 0.02 * (intensity > 0)
kws = annot_kws.copy()
kws.update(dict(color=color, zorder=zorder))
Expand Down Expand Up @@ -116,7 +116,7 @@ def annotate_ion_type(
and annotation.isotope == 0
and annotation.charge == 1
):
return annotation.ion_type
return str(annotation.ion_type)
else:
return ""

Expand Down Expand Up @@ -216,7 +216,7 @@ def spectrum(
mz,
peak_intensity,
# Use the first annotation in case there are multiple options.
annotation[0],
annotation[0] if annotation is not None else None,
color_ions,
annot_fmt,
annotation_kws,
Expand Down

0 comments on commit 437acb7

Please sign in to comment.