1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use super::{
    LtFmIndex,
    TextType,
    BwtBlockSize,
};

mod build;
mod configure;

/// The safe and concise builder for LtFmIndex
#[derive(Debug, Clone)]
pub struct LtFmIndexBuilder {
    text_type: Option<TextType>,
    bwt_block_size: BwtBlockSize,
    suffix_array_sampling_ratio: u64,
    lookup_table_kmer_size: Option<usize>,
}

use thiserror::Error;
/// Error thats can occur when build LtFmIndex with LtFmIndexBuilder
#[derive(Error, Debug)]
pub enum BuildError {
    /// [TextType] can not be inferred.
    /// This is occurred when the multiple characters must be assigned to wild-card(*).
    /// ex)
    ///  - ACG@@@@ -> Ok
    ///  - ACG@@## -> Error
    ///  - ACGT@@@@ -> Ok
    ///  - ACGT@@## -> Error
    #[error("The type of text can not be inferred ('{0}' and '{1}' cannot coexist).")]
    TextTypeError(char, char),
    /// Unsupported suffix array sampling ratio is inserted. (a value must be >= 1)
    #[error("Suffix array sampling ratio allows a value >= 1")]
    SasrBound,
    /// Unsupported lookup table kmer size is inserted. (a value must be >=2 and <= half the width of pointer)
    #[error("Lookup table kmer size allows a value >= 2 and <= half the width of pointer")]
    LtksBound,
}