Skip to content

Commit

Permalink
Reintroduced the Stellwagen nucleic acid model.
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisamarshall committed Jul 15, 2016
1 parent 721a386 commit 4938f76
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 19 deletions.
27 changes: 17 additions & 10 deletions ionize/PolyIon/NucleicAcid.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,31 @@ def __init__(self, name=None,
def mobility(self, pH=None, ionic_strength=None, temperature=None):
pH, ionic_strength, temperature = \
self._resolve_context(pH, ionic_strength, temperature)
# TODO: Introduce manning condensation model
# mu = (3.75 - 1.8 * (self.size**-.6)) * 1e-8
lb = self._solvent.bjerrum(temperature)
k = 1./self._solvent.debye(ionic_strength, temperature)
mu = 6 * pi * self._solvent.viscosity(temperature) * lb / self.friction()
mu -= 2 * self.charge() * log(1 - exp(-k * lb / self.charge()))
mu = (3.75 - 1.8 * (self.size**-.6)) * 1e-8
return mu


def charge(self, pH=None, ionic_strength=None, temperature=None,
moment=1):
pH, ionic_strength, temperature = \
self._resolve_context(pH, ionic_strength, temperature)

return -1 * self.length() / self._solvent.bjerrum(temperature)

return -1. * self.length() / self._solvent.bjerrum(temperature)

def length(self):
return self.size * DNA_LENGTH # TODO: Define
per_bp_length = 3.4e-10 # 3.4 Angstrom in meters
return self.size * per_bp_length

def friction(self, pH=None, ionic_strength=None, temperature=None):
# TODO: Finish the manning model below
def _friction(self, pH=None, ionic_strength=None, temperature=None):
pass

def _manning_mobility(self, pH=None, ionic_strength=None, temperature=None):
pH, ionic_strength, temperature = \
self._resolve_context(pH, ionic_strength, temperature)

lb = self._solvent.bjerrum(temperature)
k = 1./self._solvent.debye(ionic_strength, temperature)
mu = 6 * pi * self._solvent.viscosity(temperature) * lb / self.friction()
mu -= 2 * self.charge() * log(1 - exp(-k * lb / self.charge()))
return mu
2 changes: 1 addition & 1 deletion ionize/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.21.4'
__version__ = '0.22.0'
24 changes: 16 additions & 8 deletions ionize/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,22 @@ def test_moderate(self):
self.assertFalse(sol.moderate(), 'Unbuffered acid evaluated as safe.')
self.assertTrue(sol.titrate('tris', 8).moderate(), 'Tris buffer evaluated as unsafe.')

#class TestNucleicAcid(unittest.TestCase):
#
# def test_mobility(self):
# mu = 0
# for n in [10, 100, 1000, 10000, 100000, None]:
# mup = NucleicAcid(size=n).mobility()
# self.assertGreater(mup, mu, "Mobility didn't increase with size")
# mu = mup
class TestNucleicAcid(unittest.TestCase):

def test_mobility(self):
mu = 0
for n in [10, 100, 1000, 10000, 100000, None]:
mup = NucleicAcid(size=n).mobility()
self.assertGreater(mup, mu, "Mobility didn't increase with size.")
mu = mup

def test_charge(self):
ch = 0
for n in [10, 100, 1000, 10000, 100000, None]:
chp = NucleicAcid(size=n).charge()
self.assertLess(chp, 0, "Mobility is not negative.")
self.assertGreater(abs(chp), abs(ch), "Mobility doesn't increase with size.")
ch = chp


class TestPeptide(unittest.TestCase):
Expand Down

0 comments on commit 4938f76

Please sign in to comment.