Skip to main content

FileHeader

Struct FileHeader 

Source
pub struct FileHeader { /* private fields */ }
Expand description

Parsed Jellyfish file header.

Contains all metadata from the JSON header of a Jellyfish output file. The header includes k-mer parameters, hash table configuration, and provenance information.

§Examples

use std::fs::File;
use std::io::BufReader;
use jellyfish_reader::FileHeader;

let file = File::open("output.jf").unwrap();
let mut reader = BufReader::new(file);
let header = FileHeader::read(&mut reader).unwrap();

println!("k = {}", header.k().unwrap());
println!("format: {}", header.format());

Implementations§

Source§

impl FileHeader

Source

pub fn read<R: Read>(reader: &mut R) -> Result<Self>

Read and parse a Jellyfish file header from the given reader.

This reads the 9-digit length prefix, then the JSON header content. After this call, the reader is positioned at the start of the data section.

Source

pub fn offset(&self) -> usize

Byte offset from the start of the file to the data section.

Source

pub fn format(&self) -> &str

The file format string (e.g., “binary/sorted”, “text/sorted”).

Source

pub fn is_binary(&self) -> bool

Whether this is a binary/sorted format file.

Source

pub fn is_text(&self) -> bool

Whether this is a text/sorted format file.

Source

pub fn size(&self) -> Option<u64>

Hash table size (number of slots).

Source

pub fn key_len(&self) -> Option<u64>

K-mer length in bits (= 2 * k). Divide by 2 to get k.

Source

pub fn k(&self) -> Option<usize>

K-mer length (number of bases).

Source

pub fn val_len(&self) -> Option<u64>

Counter value length in bytes.

Source

pub fn counter_len(&self) -> Option<u64>

Counter length in the data section (may differ from val_len).

Source

pub fn max_reprobe(&self) -> Option<u64>

Maximum reprobing distance.

Source

pub fn canonical(&self) -> bool

Whether canonical k-mers were used.

Source

pub fn nb_hashes(&self) -> Option<u64>

Number of hash functions (for bloom counter format).

Source

pub fn fpr(&self) -> Option<f64>

False positive rate (for bloom counter format).

Source

pub fn hostname(&self) -> Option<&str>

The hostname of the machine that created this file.

Source

pub fn pwd(&self) -> Option<&str>

The working directory when the file was created.

Source

pub fn time(&self) -> Option<&str>

The timestamp when the file was created.

Source

pub fn exe_path(&self) -> Option<&str>

The path to the jellyfish executable that created this file.

Source

pub fn cmdline(&self) -> Option<Vec<&str>>

The command line arguments used to create this file.

Source

pub fn matrix(&self, index: usize) -> Result<RectangularBinaryMatrix>

Parse the hash matrix at the given index from the header.

Source

pub fn reprobes(&self) -> Option<Vec<u64>>

Get the reprobes array from the header.

Source

pub fn raw_json(&self) -> &Value

Access the raw JSON header value.

Source

pub fn key_bytes(&self) -> Option<usize>

Compute key length in bytes for binary format.

Source

pub fn data_val_len(&self) -> Option<usize>

Compute the counter length in bytes for the data section.

Trait Implementations§

Source§

impl Clone for FileHeader

Source§

fn clone(&self) -> FileHeader

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileHeader

Source§

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

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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

Source§

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.