Skip to main content

FileHeader

Struct FileHeader 

Source
pub struct FileHeader {
    pub ahda_header: [u8; 6],
    pub file_format: u8,
    pub metadata_compression: u8,
    pub fields_present: u16,
    pub n_targets: u32,
    pub n_queries: u32,
    pub bitmap_type: u16,
    pub block_size: u32,
    pub flags_len: u64,
}
Expand description

File header for encoded data

Always the first 32 bytes at the beginning of a .ahda file.

Must always conform to this format.

The FileHeader contains the following data:

  • Bytes identifying the data as a .ahda file.
  • Bytes providing the ahda library version.
  • The metadata compression method used for FileFlags.
  • Fields that must be present in every crate::headers::block::BlockFlags that follows.
  • Number of target sequences in the alignment.
  • Number of query sequences in the alignment. This may be 0 if the number was not known in advance.
  • Type of bitmap stored in the blocks. This may differ for each block if they were not generated with the ahda encode API.
  • Number of records stored in each block. This may be lower for each individual block.
  • The number of bytes containing the FileFlags that follow the header.

Fields§

§ahda_header: [u8; 6]

Ahda header, consists of four ASCII bytes spelling “ahda” and two bytes specifying the version.

First four bytes can be used to check that a binary record is an ahda record. Next two bytes can be used to check which version of ahda was used to generate this file.

§file_format: u8

File format version, indicates (in)compatible versions of the file format.

§metadata_compression: u8

Compression method used for FileFlags, see MetadataCompression.

§fields_present: u16

Fields of crate::headers::block::BlockFlags that must be present for all blocks in this file, see Format for details.

Every block must contain the fields specified here. Blocks may include additional fields.

§n_targets: u32

Number of alignment targets, this must match the length of target_names in FileFlags.

§n_queries: u32

Number of query sequences, this should be greater or equal to the sum of all num_records in BlockFlags.

Can be set to 0 if the number is not known in advance.

§bitmap_type: u16

Bitmap type used to encode blocks in this file, see BitmapType.

The address space of the file bitmap type must be large enough to store data from all blocks in this file. The block bitmap types may differ from the file bitmap type.

§block_size: u32

Block size (number of crate::PseudoAln records) used to encode blocks in this file. Actual number of records per block may be different.

§flags_len: u64

Number of bytes in FileFlags that follow the header bytes.

Implementations§

Source§

impl FileHeader

Source

pub fn promises_query_names(&self) -> bool

Does the header require the encoded data to contain the query names?

Source

pub fn promises_query_ids(&self) -> bool

Does the header require the encoded data to contain the query indexes?

Trait Implementations§

Source§

impl<'__de, __Context> BorrowDecode<'__de, __Context> for FileHeader

Source§

fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given BorrowDecode.
Source§

impl Clone for FileHeader

Source§

fn clone(&self) -> FileHeader

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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
Source§

impl<__Context> Decode<__Context> for FileHeader

Source§

fn decode<__D: Decoder<Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given Decode.
Source§

impl Default for FileHeader

Source§

fn default() -> FileHeader

Initialize a header with default values.

Note: This header is not a valid ahda header for most cases. Update the fields accordingly before using.

You should prefer initializing headers via Encoder::new or BitmapEncoder::new.

Source§

impl Encode for FileHeader

Source§

fn encode<__E: Encoder>(&self, encoder: &mut __E) -> Result<(), EncodeError>

Encode a given type.
Source§

impl PartialEq for FileHeader

Source§

fn eq(&self, other: &FileHeader) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FileHeader

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.