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__(
_alphabet: &PyString,
values: &PyDict
) -> PyResult<PyClassInitializer<Self>>
pub fn __init__( _alphabet: &PyString, values: &PyDict ) -> PyResult<PyClassInitializer<Self>>
Create a new count matrix.
pub fn __eq__(&self, object: &PyAny) -> PyResult<bool>
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 = false
const IS_SEQUENCE: bool = false
§type Layout = PyCell<CountMatrix>
type Layout = PyCell<CountMatrix>
§type ThreadChecker = ThreadCheckerStub<CountMatrix>
type ThreadChecker = ThreadCheckerStub<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<'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
§type AsRefTarget = PyCell<CountMatrix>
type AsRefTarget = PyCell<CountMatrix>
source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
source§fn type_object(py: Python<'_>) -> &PyType
fn type_object(py: Python<'_>) -> &PyType
source§fn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
object
is an instance of this type or a subclass of this type.source§fn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
object
is an instance of this type.