Struct mzdata::io::mzml::MzMLWriterType

source ·
pub struct MzMLWriterType<W: Write, C: CentroidLike + Default + BuildArrayMapFrom + 'static = CentroidPeak, D: DeconvolutedCentroidLike + Default + BuildArrayMapFrom + 'static = DeconvolutedPeak> {
Show 18 fields pub offset: usize, pub spectrum_count: u64, pub spectrum_counter: u64, pub chromatogram_count: u64, pub chromatogram_counter: u64, pub data_array_compression: BinaryCompressionType, pub file_description: FileDescription, pub softwares: Vec<Software>, pub data_processings: Vec<DataProcessing>, pub instrument_configurations: HashMap<u32, InstrumentConfiguration>, pub state: MzMLWriterState, pub write_index: bool, pub spectrum_offset_index: OffsetIndex, pub chromatogram_offset_index: OffsetIndex, pub tic_collector: ChromatogramCollector, pub bic_collector: ChromatogramCollector, pub wrote_summaries: bool, pub run: MassSpectrometryRun, /* private fields */
}
Expand description

An indexed mzML writer that writes MultiLayerSpectrum.

Does not buffer spectra in-memory, writing them out immediately but summary chromatogram information is accumulated.

Fields§

§offset: usize

The current offset from the stream start

§spectrum_count: u64

The total number of spectra this mzML document will contain. This value will appear in the spectrumList element’s count attribute

§spectrum_counter: u64

The number of spectrum elements written so far.

§chromatogram_count: u64

The total number of chromatograms this mzML document will contain. This value will appear in the chromatogramList element’s count attribute

§chromatogram_counter: u64

The number of chromatograms written so far

§data_array_compression: BinaryCompressionType

The compression type to use when generating binary data arrays.

§file_description: FileDescription

The file-level metadata describing the provenance of the original data

§softwares: Vec<Software>

The list of software components that were used to process the data into its current state

§data_processings: Vec<DataProcessing>

The types of data transformations applied to (parts of) the data

§instrument_configurations: HashMap<u32, InstrumentConfiguration>

The different instrument configurations that were in use during the data acquisition.

§state: MzMLWriterState§write_index: bool§spectrum_offset_index: OffsetIndex§chromatogram_offset_index: OffsetIndex§tic_collector: ChromatogramCollector§bic_collector: ChromatogramCollector§wrote_summaries: bool§run: MassSpectrometryRun

Implementations§

source§

impl<W: Write, C, D> MzMLWriterType<W, C, D>

source

pub const fn get_indent_size() -> u64

source

pub fn new_with_index_and_compression( file: W, write_index: bool, data_array_compression: BinaryCompressionType ) -> MzMLWriterType<W, C, D>

source

pub fn new_with_index(file: W, write_index: bool) -> MzMLWriterType<W, C, D>

source

pub fn new(file: W) -> MzMLWriterType<W, C, D>

Wrap a new std::io::Write-able type, constructing a new MzMLWriterType

source

pub fn stream_position(&mut self) -> Result<u64>

Imitate the io::Seek method using an internal byte counter

source

pub fn start_spectrum_list(&mut self) -> Result<(), MzMLWriterError>

source

pub fn write_summary_chromatograms(&mut self) -> Result<(), MzMLWriterError>

source

pub fn start_chromatogram_list(&mut self) -> Result<(), MzMLWriterError>

source

pub fn close(&mut self) -> Result<(), MzMLWriterError>

Close the wrapping <indexedmzML> document, which will trigger writing out the offset indices and file checksum at the tail of the document.

source

pub fn write_scan_list( &mut self, acq: &Acquisition ) -> Result<(), MzMLWriterError>

source

pub fn write_isolation_window( &mut self, iw: &IsolationWindow ) -> Result<(), MzMLWriterError>

source

pub fn write_selected_ions( &mut self, precursor: &Precursor ) -> Result<(), MzMLWriterError>

source

pub fn write_activation( &mut self, precursor: &Precursor ) -> Result<(), MzMLWriterError>

source

pub fn write_precursor( &mut self, precursor: &Precursor ) -> Result<(), MzMLWriterError>

source

pub fn write_binary_data_array_pre_encoded( &mut self, array: &DataArray, default_array_len: usize, encoded_array: &[u8] ) -> Result<(), MzMLWriterError>

source

pub fn write_binary_data_array( &mut self, array: &DataArray, default_array_len: usize ) -> Result<(), MzMLWriterError>

source

pub fn write_binary_data_arrays( &mut self, arrays: &BinaryArrayMap, default_array_len: usize ) -> Result<(), MzMLWriterError>

source

pub fn start_spectrum<S: SpectrumLike<C, D> + 'static>( &mut self, spectrum: &S, outer: &mut BytesStart<'_> ) -> Result<usize, MzMLWriterError>

source

pub fn write_spectrum_descriptors<S: SpectrumLike<C, D> + 'static>( &mut self, spectrum: &S ) -> Result<(), MzMLWriterError>

source

pub fn write_spectrum<S: SpectrumLike<C, D> + 'static>( &mut self, spectrum: &S ) -> Result<(), MzMLWriterError>

Write a spectrum out to the mzML file, encoding the highest procressing degree peak data present.

§Side-Effects

If the writer has not already started writing the spectra, this will cause all the metadata to be written out and the <spectrumList> element will be opened, preventing no new metadata from being written to this stream. Furthermore, this writes the spectrum count out, so the value may no longer be changed.

source

pub fn start_chromatogram( &mut self, chromatogram: &Chromatogram, outer: &mut BytesStart<'_> ) -> Result<usize, MzMLWriterError>

source

pub fn write_chromatogram( &mut self, chromatogram: &Chromatogram ) -> Result<(), MzMLWriterError>

source

pub fn spectrum_count(&self) -> &u64

Get a reference to the mzML writer’s spectrum count.

source

pub fn set_spectrum_count(&mut self, spectrum_count: u64)

Set the mzML writer’s spectrum count.

source

pub fn spectrum_count_mut(&mut self) -> &mut u64

Get a mutable reference to the mzML writer’s spectrum count to modify in-place.

source

pub fn get_mut(&mut self) -> Result<&mut W>

source

pub fn write_event(&mut self, event: Event<'_>) -> Result<(), MzMLWriterError>

source

pub fn write_param<P: ParamLike>( &mut self, param: &P ) -> Result<(), MzMLWriterError>

source

pub fn write_param_list<'a, P: ParamLike + 'a, T: Iterator<Item = &'a P>>( &mut self, params: T ) -> Result<(), MzMLWriterError>

source

pub fn get_ms_cv(&self) -> &ControlledVocabulary

Trait Implementations§

source§

impl<W: Debug + Write, C: Debug + CentroidLike + Default + BuildArrayMapFrom + 'static, D: Debug + DeconvolutedCentroidLike + Default + BuildArrayMapFrom + 'static> Debug for MzMLWriterType<W, C, D>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<W: Write, C: CentroidLike + Default + BuildArrayMapFrom, D: DeconvolutedCentroidLike + Default + BuildArrayMapFrom> Drop for MzMLWriterType<W, C, D>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<W: Write, C: CentroidLike + Default + BuildArrayMapFrom, D: DeconvolutedCentroidLike + Default + BuildArrayMapFrom> MSDataFileMetadata for MzMLWriterType<W, C, D>

source§

fn data_processings(&self) -> &Vec<DataProcessing>

The series of DataProcessing workflows applied to spectra in this data file.
source§

fn instrument_configurations(&self) -> &HashMap<u32, InstrumentConfiguration>

A mapping over different InstrumentConfiguration modes that spectra were acquired under.
source§

fn file_description(&self) -> &FileDescription

A description of the contents and the sources for this mass spectrometry data file.
source§

fn softwares(&self) -> &Vec<Software>

The series of Software applied to the data file to apply different DataProcessing methods.
source§

fn data_processings_mut(&mut self) -> &mut Vec<DataProcessing>

Mutably access the DataProcessing list for this data file
source§

fn instrument_configurations_mut( &mut self ) -> &mut HashMap<u32, InstrumentConfiguration>

Mutably access the InstrumentConfiguration mapping for this data file
source§

fn file_description_mut(&mut self) -> &mut FileDescription

Mutably access the FileDescription description of the contents and the sources for this mass spectrometry data file.
source§

fn softwares_mut(&mut self) -> &mut Vec<Software>

Mutably access the list of Software of this data file.
source§

fn copy_metadata_from(&mut self, source: &impl MSDataFileMetadata)

Copy the metadata from another MSDataFileMetadata implementation into this one.
source§

fn run_description(&self) -> Option<&MassSpectrometryRun>

Access the MassSpectrometryRun metadata record if it is available
source§

fn run_description_mut(&mut self) -> Option<&mut MassSpectrometryRun>

Mutably access the MassSpectrometryRun metadata record if it is available
source§

fn spectrum_count_hint(&self) -> Option<u64>

A hint about how many spectra are in this data file
source§

fn source_file_name(&self) -> Option<&str>

Get the name of the primary source file, if available
source§

impl<W: Write, C: CentroidLike + Default + BuildArrayMapFrom, D: DeconvolutedCentroidLike + Default + BuildArrayMapFrom> SpectrumWriter<C, D> for MzMLWriterType<W, C, D>

source§

fn write<S: SpectrumLike<C, D> + 'static>( &mut self, spectrum: &S ) -> Result<usize>

Write out a single spectrum
source§

fn flush(&mut self) -> Result<()>

source§

fn close(&mut self) -> Result<()>

Completes the data file format, preventing new data from being able incorporate additional data. Does not formally close the underlying writing stream.
source§

fn write_owned<S: SpectrumLike<C, D> + 'static>( &mut self, spectrum: S ) -> Result<usize>

Write out a single owned spectrum. Read more
source§

fn write_all<'b, S: SpectrumLike<C, D> + 'static, T: Iterator<Item = &'b S>>( &mut self, iterator: T ) -> Result<usize>

Consume an Iterator over Spectrum references
source§

fn write_group<S: SpectrumLike<C, D> + 'static, G: SpectrumGrouping<C, D, S> + 'static>( &mut self, group: &G ) -> Result<usize>

Write a SpectrumGroup out in order
source§

fn write_group_owned<S: SpectrumLike<C, D> + 'static, G: SpectrumGrouping<C, D, S> + 'static>( &mut self, group: G ) -> Result<usize>

Write an owned SpectrumGroup out in order Read more
source§

fn write_all_groups<'b, S: SpectrumLike<C, D> + 'static, G: SpectrumGrouping<C, D, S> + 'static, T: Iterator<Item = &'b G>>( &mut self, iterator: T ) -> Result<usize>

Consume an Iterator over SpectrumGroup references

Auto Trait Implementations§

§

impl<W, C, D> Freeze for MzMLWriterType<W, C, D>
where W: Freeze,

§

impl<W, C, D> RefUnwindSafe for MzMLWriterType<W, C, D>

§

impl<W, C, D> Send for MzMLWriterType<W, C, D>
where C: Send, D: Send, W: Send,

§

impl<W, C, D> Sync for MzMLWriterType<W, C, D>
where C: Sync, D: Sync, W: Sync,

§

impl<W, C, D> Unpin for MzMLWriterType<W, C, D>
where C: Unpin, D: Unpin, W: Unpin,

§

impl<W, C, D> UnwindSafe for MzMLWriterType<W, C, D>
where C: UnwindSafe, D: UnwindSafe, W: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.