pub struct AlignmentFeatures {Show 15 fields
pub mapping_quality: u8,
pub is_mapped: bool,
pub is_paired: bool,
pub is_supplementary: bool,
pub is_secondary: bool,
pub is_mate_mapped: Option<bool>,
pub template_length: i32,
pub aligned_length: usize,
pub num_matches: usize,
pub num_insertions: usize,
pub num_deletions: usize,
pub num_soft_clips: usize,
pub num_hard_clips: usize,
pub edit_distance: Option<u32>,
pub tags: HashMap<String, String, RandomState>,
}Expand description
Features extracted from an alignment record for ML analysis
Fields§
§mapping_quality: u8Mapping quality score (0-255, 0=unmapped, 255=highest quality)
is_mapped: boolIs the read mapped to the reference?
is_paired: boolIs this read part of a paired-end sequencing run?
is_supplementary: boolIs this a supplementary alignment?
is_secondary: boolIs this a secondary alignment?
is_mate_mapped: Option<bool>Is the mate read mapped (for paired reads)?
template_length: i32Template length (insert size for paired reads)
aligned_length: usizeNumber of aligned bases (from CIGAR)
num_matches: usizeNumber of matches (M operations in CIGAR)
num_insertions: usizeNumber of insertions (I operations in CIGAR)
num_deletions: usizeNumber of deletions (D operations in CIGAR)
num_soft_clips: usizeNumber of soft clips (S operations in CIGAR)
num_hard_clips: usizeNumber of hard clips (H operations in CIGAR)
edit_distance: Option<u32>Edit distance to reference (from NM tag if present)
Additional SAM tags
Implementations§
Source§impl AlignmentFeatures
impl AlignmentFeatures
Sourcepub fn from_record(record: &impl Record) -> Result<AlignmentFeatures, Error>
pub fn from_record(record: &impl Record) -> Result<AlignmentFeatures, Error>
Extract features from a SAM/BAM record
§Example
use deepbiop_bam::features::AlignmentFeatures;
use noodles::bam;
let features = AlignmentFeatures::from_record(record)?;
println!("Mapping quality: {}", features.mapping_quality);
println!("Is mapped: {}", features.is_mapped);Sourcepub fn indel_rate(&self) -> f32
pub fn indel_rate(&self) -> f32
Calculate indel rate ((insertions + deletions) / aligned_length)
Sourcepub fn is_high_quality(&self, min_quality: u8) -> bool
pub fn is_high_quality(&self, min_quality: u8) -> bool
Check if this is a high-quality alignment (mapping quality >= threshold)
Sourcepub fn is_proper_pair(&self, max_insert_size: i32) -> bool
pub fn is_proper_pair(&self, max_insert_size: i32) -> bool
Check if this is a proper pair (both mates mapped, reasonable insert size)
Trait Implementations§
Source§impl Clone for AlignmentFeatures
impl Clone for AlignmentFeatures
Source§fn clone(&self) -> AlignmentFeatures
fn clone(&self) -> AlignmentFeatures
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Forget for AlignmentFeatures
impl Freeze for AlignmentFeatures
impl Move for AlignmentFeatures
impl RefUnwindSafe for AlignmentFeatures
impl Send for AlignmentFeatures
impl Sync for AlignmentFeatures
impl Unpin for AlignmentFeatures
impl UnsafeUnpin for AlignmentFeatures
impl UnwindSafe for AlignmentFeatures
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more