@@ -155,7 +155,10 @@ impl From<IonMobilityFrameDescription> for SpectrumDescription {
155
155
}
156
156
}
157
157
158
- /// A trait for providing a uniform delegated access to spectrum metadata
158
+ /// A trait for providing a uniform delegated access to ion mobility frame metadata.
159
+ ///
160
+ /// This is analogous to [`SpectrumLike`] but adapted for working with different underlying
161
+ /// types.
159
162
pub trait IonMobilityFrameLike <
160
163
C : FeatureLike < MZ , IonMobility > ,
161
164
D : FeatureLike < Mass , IonMobility > + KnownCharge ,
@@ -188,7 +191,7 @@ pub trait IonMobilityFrameLike<
188
191
& mut self . description_mut ( ) . ion_mobility_unit
189
192
}
190
193
191
- /// Access the acquisition information for this spectrum .
194
+ /// Access the acquisition information for this frame .
192
195
#[ inline]
193
196
fn acquisition ( & self ) -> & Acquisition {
194
197
& self . description ( ) . acquisition
@@ -205,7 +208,7 @@ pub trait IonMobilityFrameLike<
205
208
}
206
209
}
207
210
208
- /// Iterate over all precursors of the spectrum
211
+ /// Iterate over all precursors of the frame
209
212
fn precursor_iter ( & self ) -> impl Iterator < Item = & Precursor > {
210
213
let desc = self . description ( ) ;
211
214
desc. precursor . iter ( )
@@ -221,12 +224,33 @@ pub trait IonMobilityFrameLike<
221
224
}
222
225
}
223
226
224
- /// Iterate over all precursors of the spectrum mutably
227
+ /// Iterate over all precursors of the frame mutably
225
228
fn precursor_iter_mut ( & mut self ) -> impl Iterator < Item = & mut Precursor > {
226
229
let desc = self . description_mut ( ) ;
227
230
desc. precursor . iter_mut ( )
228
231
}
229
232
233
+ /// Add a precursor to the list of precursors for this frame.
234
+ ///
235
+ /// Precursors beyond the first one correspond to lower exponentiated spectra, e.g. for an MS3 frame
236
+ /// the first precursor is the MS2 product ion that was selected, and the second precursor corresponds
237
+ /// to the original MS1 ion that was chosen for MS2.
238
+ ///
239
+ /// Higher order precursors may be accessed with [`IonMobilityFrameLike::precursor_iter`].
240
+ fn add_precursor ( & mut self , precursor : Precursor ) {
241
+ self . description_mut ( ) . precursor . push ( precursor) ;
242
+ }
243
+
244
+
245
+ /// Remove the precursor entry at `index` in the precursor list.
246
+ ///
247
+ /// Care should be taken if you are attempting to re-order precursors.
248
+ /// It may be simpler to use [`IonMobilityFrameLike::precursor_iter_mut`] to
249
+ /// re-arrange entries.
250
+ fn remove_precursor ( & mut self , index : usize ) -> Precursor {
251
+ self . description_mut ( ) . precursor . remove ( index)
252
+ }
253
+
230
254
/// A shortcut method to retrieve the scan start time of a spectrum
231
255
#[ inline]
232
256
fn start_time ( & self ) -> f64 {
0 commit comments