use smallvec::SmallVec;
pub const MAX_INLINE_BARCODES: usize = 4;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum GeoTagType {
Barcode,
NumberedBarcode(u8),
SampleBarcode,
Umi,
Read,
Fixed,
Discard,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum DistanceKind {
Hamming,
Levenshtein,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MatchTolerance {
pub kind: DistanceKind,
pub max_dist: u8,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum GeoLen {
Fixed(u32),
Range(u32, u32),
Unbounded,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct GeoPart {
pub tag: GeoTagType,
pub len: GeoLen,
pub sequence: Option<Vec<u8>>,
pub tolerance: Option<MatchTolerance>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ReadGeom {
pub parts: Vec<GeoPart>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FragmentGeom {
pub read1: ReadGeom,
pub read2: ReadGeom,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum GeometryComplexity {
FixedOffsets,
InferableVariable,
BoundaryResolved,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum BoundaryConstraint {
ReadStart,
ReadEnd,
Anchor(AnchorConstraint),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AnchorConstraint {
pub sequence: Vec<u8>,
pub tolerance: Option<MatchTolerance>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct InferableRegion {
pub left_boundary: BoundaryConstraint,
pub right_boundary: BoundaryConstraint,
pub parts: Vec<GeoPart>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BoundaryResolvedReadGeom {
pub segments: Vec<BoundaryResolvedSegment>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum BoundaryResolvedSegment {
Region(InferableRegion),
OpenEnded {
tag: GeoTagType,
left_boundary: BoundaryConstraint,
right_boundary: BoundaryConstraint,
},
}
#[derive(Debug, Clone)]
pub struct BarcodeInfo {
pub num_levels: usize,
pub roles: SmallVec<[BarcodeRole; MAX_INLINE_BARCODES]>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BarcodeRole {
Sample,
Cell,
Generic(u8),
}
pub const VAR_LEN_PADDING: &[&[u8]] = &[
b"", b"A", b"AC", b"AAG", b"AAAT", ];
pub const MAX_RANGE_WIDTH: u32 = 4;