Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if annotation is not None:
self._annotation = np.asarray(annotation).reshape(-1)
if len(self.mz) != len(self.annotation):
raise ValueError('The mass-to-charge and annotation arrays '
'should have equal length')
else:
self._annotation = self.annotation[order]
else:
self._annotation = None
self.retention_time = retention_time
if peptide is not None:
self.peptide = peptide.upper()
for aa in self.peptide:
if aa not in mass.std_aa_mass:
raise ValueError(f'Unknown amino acid: {aa}')
else:
self.peptide = None
if peptide is not None and modifications is not None:
for mod_pos in modifications.keys():
if mod_pos not in ('N-term', 'C-term'):
if not isinstance(mod_pos, int):
raise ValueError(f'Unknown modification position: '
f'{mod_pos}')
elif mod_pos < 0 or mod_pos > len(peptide):
raise ValueError(f'Modification position exceeds '
f'peptide bounds: {mod_pos}')
else:
modifications = None
self.modifications = modifications
self.is_decoy = is_decoy