Created
February 26, 2015 19:10
-
-
Save abalijepalli/0f9ea735f82cf02f19fa to your computer and use it in GitHub Desktop.
Estimate the channel gating duration in a single molecule nanopore experiment analyzed with MOSAIC (https://github.com/usnistgov/mosaic).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Estimate the channel gating duration in a single molecule nanopore experiment. | |
:Created: 02/26/2015 | |
:Author: Arvind Balijepalli <[email protected]> | |
:ChangeLog: | |
.. line-block:: | |
02/26/15 AB Initial version | |
""" | |
import mosaic.abfTrajIO as abf | |
import numpy as np | |
def estimateGatingDuration( trajioobj, gatingcurrentpa, blocksz, totaltime, fshz ): | |
npts = int((fshz)*blocksz) | |
nblk = int(totaltime/blocksz)-1 | |
# Iterate over the blocks of data and check if the channel was in a gated state. | |
# The code below returns the mean ionic current of blocks that are below the gating | |
# threshold (gatingcurrentpa) | |
gEvents = filter( lambda x:x<float(gatingcurrentpa), | |
[ np.mean(trajioobj.popdata(npts)) for i in range(nblk) ]) | |
return len(gEvents)*blocksz | |
abfObj=abf.abfTrajIO(dirname='~/abfSet1',filter='*.abf') | |
print estimateGatingDuration( abfObj, 20., 0.25, 100, abfObj.FsHz ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment