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>(
values: Bound<'py, PyDict>,
protein: bool,
) -> PyResult<PyClassInitializer<Self>>
pub fn __init__<'py>( values: Bound<'py, PyDict>, protein: bool, ) -> 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<Bound<'py, PyAny>>
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<'py> IntoPyObject<'py> for CountMatrix
impl<'py> IntoPyObject<'py> for CountMatrix
Source§type Target = CountMatrix
type Target = CountMatrix
Source§type Output = Bound<'py, <CountMatrix as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <CountMatrix as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClass for CountMatrix
impl PyClass for CountMatrix
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
Source§type ThreadChecker = SendablePyClass<CountMatrix>
type ThreadChecker = SendablePyClass<CountMatrix>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§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(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
Source§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
PyTypeInfo::type_object
PyTypeInfo::type_object
.Source§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type or a subclass of this type.Source§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
PyTypeInfo::is_type_of
PyTypeInfo::is_type_of
.Source§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type.Source§fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
PyTypeInfo::is_exact_type_of
PyTypeInfo::is_exact_type_of
.impl DerefToPyAny for CountMatrix
impl HasCustomRichCmp 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§impl<T> FromPyObject<'_> for T
impl<T> FromPyObject<'_> for T
Source§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
Source§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self
into an owned Python object, dropping type information.