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: u8File format version, indicates (in)compatible versions of the file format.
metadata_compression: u8Compression method used for FileFlags, see MetadataCompression.
fields_present: u16Fields 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: u32Number of alignment targets, this must match the length of target_names in FileFlags.
n_queries: u32Number 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: u16Bitmap 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: u32Block size (number of crate::PseudoAln records) used to encode blocks in this file. Actual number of records per block may be different.
flags_len: u64Number of bytes in FileFlags that follow the header bytes.
Implementations§
Source§impl FileHeader
impl FileHeader
Sourcepub fn promises_query_names(&self) -> bool
pub fn promises_query_names(&self) -> bool
Does the header require the encoded data to contain the query names?
Sourcepub fn promises_query_ids(&self) -> bool
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
impl<'__de, __Context> BorrowDecode<'__de, __Context> for FileHeader
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Source§impl Clone for FileHeader
impl Clone for FileHeader
Source§fn clone(&self) -> FileHeader
fn clone(&self) -> FileHeader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FileHeader
impl Debug for FileHeader
Source§impl<__Context> Decode<__Context> for FileHeader
impl<__Context> Decode<__Context> for FileHeader
Source§impl Default for FileHeader
impl Default for FileHeader
Source§fn default() -> FileHeader
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.