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
impl Pod5File
sourcepub fn new(filepath: &str) -> Result<Self, Box<dyn Error>>
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),
}sourcepub fn push_run_info(&mut self, run_info: RunInfoData)
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- TheRunInfoDatainstance 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);sourcepub fn write_run_info_to_ipc(&mut self)
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
sourcepub fn push_read(&mut self, read: ReadInfo)
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
pub fn write_signal_to_ipc(&mut self)
sourcepub fn write_reads_to_ipc(&mut self)
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