PaPaPred

Struct PaPaPred 

Source
pub struct PaPaPred { /* private fields */ }
Expand description

A pattern partition prediction lookup table

Use the new method to read in a sequence-context point mutation probabilities file. This file has the following format:

A->C ANAANVY 9.624201240304532e-06
A->C BNAANVY 7.1908831554369445e-06
A->C KNAANVR 5.345747358414394e-06
A->C MNAANVR 7.589541872637903e-06
A->C NAAAVTN 7.0416965447897126e-06
[and so on]

Each column is separated by a single space. The first column is the point mutation. The second column is the sequence context where the mutation takes place (UIPAC notation) The third column is the point mutation rate with this context

The reverse complement is handled automatically. All sequence must be different (even when you expand the UIPAC code)

Implementations§

Source§

impl PaPaPred

Source

pub fn new<P: AsRef<Path>>( path: P, min_kmer_size: Option<usize>, ) -> Result<PaPaPred, Error>

Create a PaPaPred instance.

The input file must consist of 3 space-separated columns:

  1. The substitution in the form X->Y where X, Y in {ACGT}
  2. The pattern in UIPAC notation.
  3. The probability for the substitution with that pattern

You provide the path to the sequence-context point mutation probabilities file. If you want to ensure that the patters have a minimum size, you can provide a value for min_kmer_size which will pad all patterns with Ns at the end. The minimum kmer size has to be an odd number because there has to be a single mutated base in the center of the sequence.

Source

pub fn rates(&self, seq: &str) -> Result<SubstitutionRates, Error>

Query the mutation rates for a sequence context

The middle position of the seq is assumed to be mutating.

Source

pub fn kmer_size(&self) -> usize

Source

pub fn radius(&self) -> usize

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, 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.