Struct podders::Pod5File

source ·
pub struct Pod5File { /* private fields */ }
Expand description

Represents a Pod5 file, encapsulating all necessary components and metadata for handling Pod5 data.

Implementations§

source§

impl Pod5File

source

pub fn new(filepath: &str) -> Result<Self, Box<dyn Error>>

Creates a new Pod5File instance, initializing it for tracking embedded files.

This function generates a new Pod5 file at the specified filepath. It initializes the file with a signature, section marker, and file identifier, and sets up the metadata for the embedded reads, run information, and signal tables.

Arguments
  • filepath - The path where the new Pod5 file will be created.
Returns

A Result<Pod5File, Box<dyn Error>>, which is the new Pod5File instance on success, or an error if the file creation or initialization fails.

Example
let pod5_file = Pod5File::new("path/to/file.pod5");
match pod5_file {
    Ok(file) => println!("Pod5 file created successfully."),
    Err(e) => println!("Error creating Pod5 file: {}", e),
}
source

pub fn push_run_info(&mut self, run_info: RunInfoData)

Adds a new RunInfoData instance to the Pod5 file.

This method appends the provided RunInfoData to the internal run information buffer of the Pod5File struct. It is used to accumulate run information before writing it to the file.

Arguments
  • run_info - The RunInfoData instance to be added to the Pod5 file.
Example
let mut pod5_file = Pod5File::new("my_file.pod5")?;
let run_info = RunInfoData { /* fields */ };
pod5_file.push_run_info(run_info);
source

pub fn write_run_info_to_ipc(&mut self)

Dump all created Run info RecordBatches (tables) into the file, and set the offset and length correctly on the Embedded file args

source

pub fn push_read(&mut self, read: ReadInfo)

Push reads to internal buffer, ready to be written out By a call to write_reads_to_ipc

source

pub fn write_signal_to_ipc(&mut self)

source

pub fn write_reads_to_ipc(&mut self)

Write the reads and signal in the internal buffer into the file. DO NOT CALL MORE THAN ONCE YOU WILL MESS THINGS UP

Write the footer and finish the file. Again please ONLY CALL ONCE PER FILE

Auto Trait Implementations§

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, 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.