Skip to main content

PileupPosition

Struct PileupPosition 

Source
pub struct PileupPosition {
Show 21 fields pub ref_seq: String, pub pos: u32, pub ref_base: Option<char>, pub depth: u32, pub a: u32, pub c: u32, pub g: u32, pub t: u32, pub n: u32, pub r: u32, pub y: u32, pub s: u32, pub w: u32, pub k: u32, pub m: u32, pub ins: u32, pub del: u32, pub ref_skip: u32, pub fail: u32, pub count_of_mate_resolutions: u32, pub near_max_depth: bool,
}
Expand description

Hold all information about a position.

Fields§

§ref_seq: String

Reference sequence name.

§pos: u32

1-based position in the sequence.

§ref_base: Option<char>

The reference base at this position.

§depth: u32

Total depth at this position.

§a: u32

Number of A bases at this position.

§c: u32

Number of C bases at this position.

§g: u32

Number of G bases at this position.

§t: u32

Number of T bases at this position.

§n: u32

Number of N bases at this position. Any unrecognized base will be counted as an N.

§r: u32

Number of bases that could be A or G

§y: u32

Number of bases that could be C or T

§s: u32

Number of bases that could be G or C

§w: u32

Number of bases that could be A or T

§k: u32

Number of bases that could be G or T

§m: u32

Number of bases that could be A or C

§ins: u32

Number of insertions that start to the right of this position. Does not count toward depth.

§del: u32

Number of deletions at this position.

§ref_skip: u32

Number of refskips at this position. Does not count toward depth.

§fail: u32

Number of reads failing filters at this position.

§count_of_mate_resolutions: u32

Number of times a mate resolution was needed.

§near_max_depth: bool

Depth is within 1% of max_depth

Implementations§

Source§

impl PileupPosition

Source

pub fn from_pileup<F: ReadFilter>( pileup: Pileup, header: &HeaderView, read_filter: &F, base_filter: Option<u8>, ) -> Self

Convert a pileup into a Position.

This will walk over each of the alignments and count the number each nucleotide it finds. It will also count the number of Ins/Dels/Skips that are at each position.

§Arguments
  • pileup - a pileup at a genomic position
  • header - a headerview for the bam file being read, to get the sequence name
  • read_filter - a function to filter out reads, returning false will cause a read to be filtered
  • base_filter - an optional base quality score. If Some(number) if the base quality is not >= that number the base is treated as an N
Source

pub fn from_pileup_mate_aware<F: ReadFilter>( pileup: Pileup, header: &HeaderView, read_filter: &F, base_filter: Option<u8>, mate_fix_strat: MateResolutionStrategy, ) -> Self

Convert a pileup into a Position.

This will walk over each of the alignments and count the number each nucleotide it finds. It will also count the number of Ins/Dels/Skips that are at each position.

Additionally, this method is mate aware. Before processing a position it will scan the alignments for mates. If a mate is found, it will try to take use the mate that has the highest MAPQ, breaking ties by choosing the first in pair that passes filters. In the event of both failing filters or not being first in pair, the first read encountered is kept.

§Arguments
  • pileup - a pileup at a genomic position
  • header - a headerview for the bam file being read, to get the sequence name
  • read_filter - a function to filter out reads, returning false will cause a read to be filtered
  • base_filter - an optional base quality score. If Some(number) if the base quality is not >= that number the base is treated as an N
Source

pub fn compact_refseq(header: &HeaderView, tid: u32) -> SmartString<LazyCompact>

Convert a tid to a SmartString<LazyCompact>.

Trait Implementations§

Source§

impl Debug for PileupPosition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PileupPosition

Source§

fn default() -> PileupPosition

Returns the “default value” for a type. Read more
Source§

impl Position for PileupPosition

Source§

fn new(ref_seq: String, pos: u32) -> Self

Create a new position for the given ref_seq name.

Source§

impl Serialize for PileupPosition

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V