Struct lightmotif_py::CountMatrix
source · pub struct CountMatrix { /* private fields */ }
Expand description
A matrix storing the count of a motif letters at each position.
Implementations§
source§impl CountMatrix
impl CountMatrix
sourcepub fn __init__<'py>(
alphabet: Bound<'py, PyString>,
values: Bound<'py, PyDict>,
) -> PyResult<PyClassInitializer<Self>>
pub fn __init__<'py>( alphabet: Bound<'py, PyString>, values: Bound<'py, PyDict>, ) -> PyResult<PyClassInitializer<Self>>
Create a new count matrix.
pub fn __eq__<'py>(&self, object: Bound<'py, PyAny>) -> PyResult<bool>
pub fn __len__(&self) -> usize
pub fn __getitem__<'py>( slf: PyRef<'py, Self>, index: isize, ) -> PyResult<PyObject>
sourcepub fn normalize(&self, pseudocount: Option<PyObject>) -> PyResult<WeightMatrix>
pub fn normalize(&self, pseudocount: Option<PyObject>) -> PyResult<WeightMatrix>
Normalize this count matrix to obtain a position weight matrix.
This method converts the count matrix to a weight matrix. Each row
from the matrix is normalized so that they sum to 1.0
. Each element
is then divided by a uniform background probability to obtain
odds-ratio at every position of the motif. Pseudocounts can be given
to prevent zero elements, which may translate into -∞ scores in the
final position-specific scoring matrix.
Arguments:
pseudocount (float
, dict
or None
): The pseudocounts to apply
before normalizing the count matrix. If a float
is given,
then a similar pseudocount is applied to every column of the
matrix (excluding the default symbol). Otherwise, a dict
may be given to map each symbol of the alphabet to a distinct
pseudocount. If None
given, no pseudocount is used.
Trait Implementations§
source§impl Clone for CountMatrix
impl Clone for CountMatrix
source§fn clone(&self) -> CountMatrix
fn clone(&self) -> CountMatrix
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CountMatrix
impl Debug for CountMatrix
source§impl From<CountMatrix<Dna>> for CountMatrix
impl From<CountMatrix<Dna>> for CountMatrix
source§fn from(data: CountMatrix<Dna>) -> Self
fn from(data: CountMatrix<Dna>) -> Self
source§impl PyClassImpl for CountMatrix
impl PyClassImpl for CountMatrix
source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
source§const IS_SEQUENCE: bool = true
const IS_SEQUENCE: bool = true
§type ThreadChecker = SendablePyClass<CountMatrix>
type ThreadChecker = SendablePyClass<CountMatrix>
§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
source§impl PyClassNewTextSignature<CountMatrix> for PyClassImplCollector<CountMatrix>
impl PyClassNewTextSignature<CountMatrix> for PyClassImplCollector<CountMatrix>
fn new_text_signature(self) -> Option<&'static str>
source§impl PyClass__eq__SlotFragment<CountMatrix> for PyClassImplCollector<CountMatrix>
impl PyClass__eq__SlotFragment<CountMatrix> for PyClassImplCollector<CountMatrix>
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a CountMatrix
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a CountMatrix
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut CountMatrix
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut CountMatrix
source§impl PyMethods<CountMatrix> for PyClassImplCollector<CountMatrix>
impl PyMethods<CountMatrix> for PyClassImplCollector<CountMatrix>
fn py_methods(self) -> &'static PyClassItems
source§impl PyTypeInfo for CountMatrix
impl PyTypeInfo for CountMatrix
source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
source§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
impl DerefToPyAny for CountMatrix
Auto Trait Implementations§
impl Freeze for CountMatrix
impl RefUnwindSafe for CountMatrix
impl Send for CountMatrix
impl Sync for CountMatrix
impl Unpin for CountMatrix
impl UnwindSafe for CountMatrix
Blanket Implementations§
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)