Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
aarmey committed Mar 4, 2024
1 parent 06cf0fa commit 57e7d8c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 27 deletions.
4 changes: 2 additions & 2 deletions lineage/states/StateDistributionGaPhs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import numpy as np

from .stateCommon import basic_censor, StateDistributionClass
from .stateCommon import basic_censor
from .StateDistributionGamma import StateDistribution as GammaSD
from ..CellVar import Time, CellVar


class StateDistribution(StateDistributionClass):
class StateDistribution:
"""For G1 and G2 separated as observations."""

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions lineage/states/StateDistributionGamma.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import scipy.stats as sp
from typing import Union, Literal

from .stateCommon import gamma_estimator, basic_censor, bern_estimator, StateDistributionClass
from .stateCommon import gamma_estimator, basic_censor, bern_estimator
from ..CellVar import Time, CellVar


class StateDistribution(StateDistributionClass):
class StateDistribution:
"""
StateDistribution for cells with gamma distributed times.
"""
Expand Down
21 changes: 0 additions & 21 deletions lineage/states/stateCommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from numba import njit
import numpy.typing as npt
from scipy.optimize import minimize, Bounds, LinearConstraint
from ..CellVar import CellVar
from ctypes import CFUNCTYPE, c_double
from numba.extending import get_cython_function_address

Expand All @@ -16,26 +15,6 @@
warnings.filterwarnings("ignore", message="Values in x were outside bounds")


class StateDistributionClass:
def rvs(self, size: int, rng=None):
raise NotImplementedError("dist not implemented.")

def dist(self, other) -> float:
raise NotImplementedError("dist not implemented.")

def dof(self) -> int:
raise NotImplementedError("dof not implemented.")

def logpdf(self, x: np.ndarray) -> np.ndarray:
raise NotImplementedError("logpdf not implemented.")

def estimator(self, x: np.ndarray, gammas: np.ndarray):
raise NotImplementedError("estimator not implemented.")

def censor_lineage(self, censor_condition: int, full_lineage: list[CellVar], desired_experiment_time=2e12) -> list[CellVar]:
raise NotImplementedError("censor_lineage not implemented.")


def basic_censor(cells: list):
"""
Censors a cell if the cell's parent is censored.
Expand Down
6 changes: 4 additions & 2 deletions lineage/tHMM.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def predict(self) -> list:
return Viterbi(self)

def get_BIC(
self, LL: float, num_cells: int, atonce: bool=False, mcf10a: bool=False
self, LL: float, num_cells: int, atonce: bool = False, mcf10a: bool = False
) -> Tuple[float, float]:
"""
Gets the BIC values. Akaike Information Criterion, used for model selection and deals with the trade off
Expand Down Expand Up @@ -117,7 +117,9 @@ def get_BIC(

return BIC_value, degrees_of_freedom

def log_score(self, X_state_tree_sequence: list, pi=None, T=None, E=None) -> list[float]:
def log_score(
self, X_state_tree_sequence: list, pi=None, T=None, E=None
) -> list[float]:
"""
This function returns the log-likelihood of a possible state assignment
given the estimated model parameters.
Expand Down

0 comments on commit 57e7d8c

Please sign in to comment.