Skip to content

Commit

Permalink
import binding model
Browse files Browse the repository at this point in the history
  • Loading branch information
armaan-abraham committed Jun 4, 2024
1 parent b9eee24 commit 3db9b0c
Show file tree
Hide file tree
Showing 5 changed files with 353 additions and 227 deletions.
53 changes: 0 additions & 53 deletions bicytok/BindingMod.py

This file was deleted.

13 changes: 10 additions & 3 deletions bicytok/MBmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"""

import numpy as np

from .BindingMod import polyc
from valentbind import polyc


def getKxStar():
Expand All @@ -14,6 +13,7 @@ def getKxStar():
def cytBindingModel(
recCount: np.ndarray, recXaffs: np.ndarray, dose: float, vals: np.ndarray
):
# Armaan: update this docstring, particularly the Return section
"""Runs binding model for a given mutein, valency, dose, and cell type
Args:
recCount: total count of signaling and targeting receptors
Expand All @@ -26,6 +26,13 @@ def cytBindingModel(
Kx = getKxStar()
ligandConc = dose / (vals[0][0] * 1e9)

output = polyc(ligandConc, Kx, recCount, vals, recXaffs)[0]
output = polyc(
ligandConc,
Kx,
recCount,
vals,
np.array([1]),
recXaffs,
)[1][0, 0]

return output
22 changes: 11 additions & 11 deletions bicytok/test/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import numpy as np
import pandas as pd

from bicytok.MBmodel import cytBindingModel
from bicytok.selectivityFuncs import (
calcReceptorAbundances,
optimizeSelectivityAffs,
get_affs,
optimizeSelectivityAffs,
)
from bicytok.MBmodel import cytBindingModel


def test_optimize_design():
Expand All @@ -35,30 +35,30 @@ def test_optimize_design():


def test_binding_model():
assert (
assert np.isclose(
cytBindingModel(
recCount=np.array([4000.0, 3400.0]),
recXaffs=get_affs(np.array([8.0, 8.0])),
dose=0.1,
vals=np.array([[1, 1]]),
)
== 4.070165414304938e-5
),
4.070165414304938e-5,
)
assert (
assert np.isclose(
cytBindingModel(
recCount=np.array([6000.0, 2100.0]),
recXaffs=get_affs(np.array([7.6, 8.2])),
dose=1.0,
vals=np.array([[4, 4]]),
)
== 0.0009870173680610606
),
0.0009870173680610606,
)
assert (
assert np.isclose(
cytBindingModel(
recCount=np.array([4000.0, 3400.0, 5700.0, 33800.0]),
recXaffs=get_affs(np.array([8.9, 7.0, 8.0, 8.0])),
dose=0.1,
vals=np.array([[1, 4, 4, 4]]),
)
== 0.017104443169046135
),
0.017104443169046135,
)
Loading

0 comments on commit 3db9b0c

Please sign in to comment.