Title: | Single Channel Bursts Analysis |
---|---|
Description: | Provides tools to import and export from several existing pieces of ion-channel analysis software such as 'TAC', 'QUB', 'SCAN', and 'Clampfit', implements procedures such as dwell-time correction and defining bursts with a critical time, and provides tools for analysis of bursts, such as tools for sorting and plotting. |
Authors: | Blair Drummomd [aut], Mathieu Dextraze [ctb] |
Maintainer: | Blair Drummond <[email protected]> |
License: | LGPL-2.1 |
Version: | 1.6 |
Built: | 2024-12-02 06:48:05 UTC |
Source: | CRAN |
Check if segment contains subconductive states
bursts.check_subconductance(bursts)
bursts.check_subconductance(bursts)
bursts |
The list of all bursts |
True if it contains an conductance other than 0 or 1, False otherwise.
infile <- system.file("extdata", "example4.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") bursts.check_subconductance(bursts)
infile <- system.file("extdata", "example4.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") bursts.check_subconductance(bursts)
Return a list of all the (sub)conductance states.
bursts.conductance_states(bursts)
bursts.conductance_states(bursts)
bursts |
The list of all bursts |
a list of all the (sub)conductance states.
infile <- system.file("extdata", "example4.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") bursts.conductance_states(bursts)
infile <- system.file("extdata", "example4.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") bursts.conductance_states(bursts)
Copy a list of bursts (by value)
bursts.copy(bursts)
bursts.copy(bursts)
bursts |
bursts to copy |
A copy of the bursts.
Split segment at long pauses, dividing the segment into multiple -shorter- segments (which are the bursts), Along with the interburst closings, which are referred to as "gaps". (Default time units are seconds)
bursts.defined_by_tcrit(segments, t_crit, units = "s")
bursts.defined_by_tcrit(segments, t_crit, units = "s")
segments |
A segment or multiple segments with $states and $dwells. NOTE: separate segments will remain split, regardless of why they were originally divided. |
t_crit |
Critical time at which to divide bursts (in seconds by default) |
units |
what unit the critical time is in ('s','ms','us', or 'ns') |
bursts. Which is a list of segments starting and ending in 1 states (open dwell)
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") head(bursts[[1]])
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") head(bursts[[1]])
Extract vector of gaps from the bursts. This is done using the start_time attribute, which is mostly hidden in the data. (The gaps at the ends may have length 0)
bursts.get_gaps(bursts)
bursts.get_gaps(bursts)
bursts |
The list of segments |
A vector of N+1 gaps for N bursts times
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") gaps <- bursts.get_gaps(bursts) head(gaps)
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") gaps <- bursts.get_gaps(bursts) head(gaps)
The user specifies a deadtime in microseconds. The function applies segment.impose_deadtime to each segment in the burst. (See segment.impose_deadtime for details.)
bursts.impose_deadtime(bursts, deadtime)
bursts.impose_deadtime(bursts, deadtime)
bursts |
a burst containing segments of dwells and states. |
deadtime |
the briefest possible event in microseconds. |
A modified copy of the original burst
infile <- system.file("extdata", "example4.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") bursts_d <- bursts.impose_deadtime(bursts, deadtime=0.01)
infile <- system.file("extdata", "example4.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") bursts_d <- bursts.impose_deadtime(bursts, deadtime=0.01)
Transform the conductance states according to a user-defined function of conductance level.
bursts.modify_conductance(bursts, fun)
bursts.modify_conductance(bursts, fun)
bursts |
the list of segments |
fun |
a function on conductance levels |
A modified copy of the original bursts
infile <- system.file("extdata", "example4.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") ### Collapse into three subconductance states fun <- function(amp) { if (amp < 0.3) return(0) else if (amp >= 0.3 && amp < 0.6) return(0.5) else return(1) } bursts_d <- bursts.modify_conductance(bursts, fun)
infile <- system.file("extdata", "example4.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") ### Collapse into three subconductance states fun <- function(amp) { if (amp < 0.3) return(0) else if (amp >= 0.3 && amp < 0.6) return(0.5) else return(1) } bursts_d <- bursts.modify_conductance(bursts, fun)
Return pcloseds of every burst.
bursts.pcloseds(bursts)
bursts.pcloseds(bursts)
bursts |
The list of all bursts |
The pclosed values
infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") pcloseds <- bursts.popens(bursts) hist(pcloseds)
infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") pcloseds <- bursts.popens(bursts) hist(pcloseds)
Return popens of every burst.
bursts.popens(bursts)
bursts.popens(bursts)
bursts |
The list of all bursts |
The popen values
infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") popens <- bursts.popens(bursts) hist(popens)
infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") popens <- bursts.popens(bursts) hist(popens)
From a list of segments, return the concatenated segment containing all bursts. Inverse of functions like bursts.defined_by_tcrit
bursts.recombine(bursts)
bursts.recombine(bursts)
bursts |
The list of all bursts |
The segment containing all bursts.
infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") # This is a single segment! record <- bursts.recombine(bursts) # Which means you can do stuff like this open_dwells <- segment.open_dwells(bursts.recombine(bursts))
infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") # This is a single segment! record <- bursts.recombine(bursts) # Which means you can do stuff like this open_dwells <- segment.open_dwells(bursts.recombine(bursts))
Remove the first and last burst from the list.
bursts.remove_first_and_last(bursts)
bursts.remove_first_and_last(bursts)
bursts |
The list of all bursts |
A shorter list of bursts
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") # If there seem to be bad bursts at the ends bursts <- bursts.remove_first_and_last(bursts)
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") # If there seem to be bad bursts at the ends bursts <- bursts.remove_first_and_last(bursts)
From a list of bursts, extract those that interest you by passing a selecting function.
bursts.select(bursts, func, one_file = FALSE)
bursts.select(bursts, func, one_file = FALSE)
bursts |
The list of all bursts |
func |
A function of a segment that returns either TRUE or FALSE |
one_file |
TRUE or FALSE: Return a single file to write to disk, or a list of bursts. The one_file will return a file with all unselected bursts zeroed out. |
A shorter list of bursts OR if one_file is passed one segment with zeros where the other bursts might have been originally. Defaults to FALSE.
high_popen <- function (seg) { segment.popen(seg) > 0.7 } infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") subset <- bursts.select(bursts, high_popen) # To export to one .dwt file subset_f <- bursts.select(bursts, high_popen, one_file=TRUE)
high_popen <- function (seg) { segment.popen(seg) > 0.7 } infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") subset <- bursts.select(bursts, high_popen) # To export to one .dwt file subset_f <- bursts.select(bursts, high_popen, one_file=TRUE)
Order a list of bursts by some function. For instance, popen.
bursts.sort(bursts, func, reverse = FALSE)
bursts.sort(bursts, func, reverse = FALSE)
bursts |
The list of all bursts |
func |
A function of a segment that returns a numeric value |
reverse |
By default, return in ascending order. Use reverse=TRUE to change that. |
A list sorted by func. By default in ascending order (unless reversed)
infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") # A sorted list of bursts. sorted <- bursts.sort(bursts, segment.popen) # You can also write your own functions. If you want P(Open) =~ P(Closed) variance_fun <- function (seg) { # Any function that maps a segment to a number works. return( segment.popen(seg) * segment.pclosed(seg) ) } weird_sort <- bursts.sort(bursts, variance_fun)
infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") # A sorted list of bursts. sorted <- bursts.sort(bursts, segment.popen) # You can also write your own functions. If you want P(Open) =~ P(Closed) variance_fun <- function (seg) { # Any function that maps a segment to a number works. return( segment.popen(seg) * segment.pclosed(seg) ) } weird_sort <- bursts.sort(bursts, variance_fun)
Given a list of segments separated by an unknown amount of time, one may want to space the segments by some amount of time, so that they can be plotted. This function takes a separating factor, and splits up the segments by either that factor (in seconds), or that many multiples of the largest observed dwell.
bursts.space_out(segments, sep_factor = 1000)
bursts.space_out(segments, sep_factor = 1000)
segments |
The segments to space out |
sep_factor |
the factor by which to separate the segments. Either the factor in seconds, or a multiple of the longest observed dwell. |
The segments again, but with modified meta-data.
infile <- system.file("extdata", "example_multiple_segments.dwt", package = "scbursts") dwells <- dwt.read(infile) # Still a list, but the meta-data is fixed spaced_records <- bursts.space_out(dwells, sep_factor=1000) # Combine them, and they'll be nicely spaced out. single_record <- bursts.recombine(spaced_records) # You can now plot that single_record using one of the plot functions.
infile <- system.file("extdata", "example_multiple_segments.dwt", package = "scbursts") dwells <- dwt.read(infile) # Still a list, but the meta-data is fixed spaced_records <- bursts.space_out(dwells, sep_factor=1000) # Combine them, and they'll be nicely spaced out. single_record <- bursts.recombine(spaced_records) # You can now plot that single_record using one of the plot functions.
YOU PROBABLY WON'T EVER HAVE TO CALL THIS DIRECTLY. Attach the meta-data to each segment saying when it began. It interleaves the durations of the bursts and gaps, and assigns the sum of those durations up to a point as the starting time.
bursts.start_times_update(bursts, gaps)
bursts.start_times_update(bursts, gaps)
bursts |
List of segments |
gaps |
vector of gap times. |
A list of segments, one per burst, with updated start_times
The user specifies the desired level ('open' or 'closed'). The function applies segment.subconductance_as to each segment in the burst. (See segment.subconductance_as for details.)
bursts.subconductance_as(bursts, level)
bursts.subconductance_as(bursts, level)
bursts |
the list of segments |
level |
either 'open' or 'closed' |
A modified copy of the original burst
infile <- system.file("extdata", "example4.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") bursts_d <- bursts.subconductance_as(bursts, "open")
infile <- system.file("extdata", "example4.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") bursts_d <- bursts.subconductance_as(bursts, "open")
Read a .xlsx file output from clampfit. Result is a list of "segments", which is a dataframe extra data. See "segment" for more details. Converts millisecond dwells to seconds.
clampfit.read(filename, separating_factor = 1000, header = FALSE)
clampfit.read(filename, separating_factor = 1000, header = FALSE)
filename |
Filename to read from |
separating_factor |
In lieu of a known time between segments, seperate with a multple of the longest dwell. |
header |
Does the file include a header? |
A list of bursts (possibly a singleton)
infile <- system.file("extdata", "example1_clampfit.xlsx", package = "scbursts") dwells <- clampfit.read(infile) head(dwells)
infile <- system.file("extdata", "example1_clampfit.xlsx", package = "scbursts") dwells <- clampfit.read(infile) head(dwells)
Histogram of Conductance States
cplot.conductance_hist(bursts, ...)
cplot.conductance_hist(bursts, ...)
bursts |
List of multiple segments |
... |
other arguments passed to histogram |
infile <- system.file("extdata", "example4.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") cplot.conductance_hist(bursts, main="example4.dwt conductance state histogram")
infile <- system.file("extdata", "example4.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") cplot.conductance_hist(bursts, main="example4.dwt conductance state histogram")
Add log-root axes to histogram plot
cplot.log_root_axes(points)
cplot.log_root_axes(points)
points |
The data to plot |
infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") open_dwells <- segment.open_dwells(bursts.recombine(bursts)) hist(log10(open_dwells), axes=FALSE, breaks=30) cplot.log_root_axes(open_dwells)
infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") open_dwells <- segment.open_dwells(bursts.recombine(bursts)) hist(log10(open_dwells), axes=FALSE, breaks=30) cplot.log_root_axes(open_dwells)
Plot Time Series (ts) of P(Closed).
cplot.pclosed_ts(bursts, main = "P(Closed) Time Series", ...)
cplot.pclosed_ts(bursts, main = "P(Closed) Time Series", ...)
bursts |
List of multiple segments |
main |
The title of the plot. |
... |
Options to pass to plot |
infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") cplot.pclosed_ts(bursts, main="P(Closed) Time Series, 2018-09-20")
infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") cplot.pclosed_ts(bursts, main="P(Closed) Time Series, 2018-09-20")
Plot Time Series (ts) of P(Open).
cplot.popen_ts(bursts, main = "P(Open) Time Series", ...)
cplot.popen_ts(bursts, main = "P(Open) Time Series", ...)
bursts |
List of multiple segments |
main |
The title of the plot. |
... |
Options to pass to plot |
infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") cplot.popen_ts(bursts, "P(Open) Time Series, 2018-09-20")
infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(infile) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms") cplot.popen_ts(bursts, "P(Open) Time Series, 2018-09-20")
Read a .dwt file. Result is a list of "segments", which is a dataframe extra data. See "segment" for more details. Converts millisecond dwells to seconds.
dwt.read(filename, separating_factor = 1000)
dwt.read(filename, separating_factor = 1000)
filename |
Filename to read from |
separating_factor |
In lieu of a known time between segments, seperate with a multple of the longest dwell. |
A list of bursts (possibly a singleton)
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) dwt.write(dwells, file=file.path(tempdir(), "dwells.dwt")) # Quit R, come back the next day ## Not run: dwells <- dwt.read("dwells.dwt") ## End(Not run)
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) dwt.write(dwells, file=file.path(tempdir(), "dwells.dwt")) # Quit R, come back the next day ## Not run: dwells <- dwt.read("dwells.dwt") ## End(Not run)
Write a dwt file to disk. Writes DOS line endings. Dwells are in milliseconds
dwt.write(segments, file = "", seg = 1, append = FALSE)
dwt.write(segments, file = "", seg = 1, append = FALSE)
segments |
A segment or multiple segments with $dwells and $states |
file |
Filename to write to |
seg |
Segment number to write in .dwt header. |
append |
Add ot the end of a file or overwrite? (defaults to false) |
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) dwt.write(dwells, file=file.path(tempdir(), "dwells.dwt"))
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) dwt.write(dwells, file=file.path(tempdir(), "dwells.dwt"))
Extract header from evt file.
evt.extract_header(filename)
evt.extract_header(filename)
filename |
The filename |
A string containing the header
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") # Get Dwells transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") # Get Header header <- evt.extract_header(infile) evt.write(dwells_c, header=header, file=file.path(tempdir(), "fixed_example1_tac.evt"))
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") # Get Dwells transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") # Get Header header <- evt.extract_header(infile) evt.write(dwells_c, header=header, file=file.path(tempdir(), "fixed_example1_tac.evt"))
Converts dwell durations to absolute transition times.
evt.from_dwells(segments)
evt.from_dwells(segments)
segments |
A segment or multiple segemtns |
A dataframe or multiple dataframes of states and transition times
dwells_file <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(dwells_file) transitions <- evt.from_dwells(dwells)
dwells_file <- system.file("extdata", "example1_qub.dwt", package = "scbursts") dwells <- dwt.read(dwells_file) transitions <- evt.from_dwells(dwells)
Read a .evt file to a table. Times are in seconds
evt.read(filename)
evt.read(filename)
filename |
The filename |
A list of tables with columns "states" and "times". Each table corresponds to a contiguous segment from a recording.
# import some of the data included with the package infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") transitions <- evt.read(infile) head(transitions[[1]])
# import some of the data included with the package infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") transitions <- evt.read(infile) head(transitions[[1]])
Calculate pulse lengths. Converts transition times to dwell durations.
evt.to_dwells(tables)
evt.to_dwells(tables)
tables |
Either a single table or a list of tables with columns "states" and "times" |
A segment or a list of segments with one less row, where each row represents pulse in state 0 (closed dwell) of duration 0.51231, instead of the time at which the state transitioned.
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) head(dwells[[1]])
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) head(dwells[[1]])
Write bursts to a .evt file.
evt.write(segments, filename = "", header = NULL)
evt.write(segments, filename = "", header = NULL)
segments |
A segment or list of segments to write to filename |
filename |
The filename |
header |
The header information for the evt file, if available |
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") # Get Dwells transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") # Get Header header <- evt.extract_header(infile) evt.write(dwells_c, header=header, file=file.path(tempdir(), "fixed_example1_tac.evt"))
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") # Get Dwells transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us") # Get Header header <- evt.extract_header(infile) evt.write(dwells_c, header=header, file=file.path(tempdir(), "fixed_example1_tac.evt"))
Extract header from hst file.
hst.extract_header(filename)
hst.extract_header(filename)
filename |
The filename |
A string containing the header
# import some of the data included with the package infile <- system.file("extdata", "example1_hst.hst", package = "scbursts") open_table <- hst.read(infile, extract="open") closed_table <- hst.read(infile, extract="closed") header <- hst.extract_header(infile) # Make adjustments to the histogram, if you wish hst.write(open_table, closed_table, file=file.path(tempdir(), "output_hist.hst"), header=header)
# import some of the data included with the package infile <- system.file("extdata", "example1_hst.hst", package = "scbursts") open_table <- hst.read(infile, extract="open") closed_table <- hst.read(infile, extract="closed") header <- hst.extract_header(infile) # Make adjustments to the histogram, if you wish hst.write(open_table, closed_table, file=file.path(tempdir(), "output_hist.hst"), header=header)
Read a MIL ".hst" file to a table. By default these files are in log10(Milliseconds)-sqrt(Freq), but unless "raw" is set to TRUE, this function returns a table containing Seconds-Freq
hst.read(filename, extract = "open", raw = FALSE)
hst.read(filename, extract = "open", raw = FALSE)
filename |
The filename |
extract |
Extract either "open" or "closed" histogram |
raw |
Data is given as log10(milliseconds)-Sqrt(Freq). Setting raw=FALSE yields output as Seconds-Frequency |
A tables with columns "bin", "freq" and "fit".
# import some of the data included with the package infile <- system.file("extdata", "example1_hst.hst", package = "scbursts") open_hst <- hst.read(infile, extract="open") closed_hst <- hst.read(infile, extract="closed") head(open_hst) head(closed_hst)
# import some of the data included with the package infile <- system.file("extdata", "example1_hst.hst", package = "scbursts") open_hst <- hst.read(infile, extract="open") closed_hst <- hst.read(infile, extract="closed") head(open_hst) head(closed_hst)
Write bursts to a log10(ms)-sqrt(Frequency) .hst file from open and closed tables.
hst.write(open_hist, closed_hist, file = "", header = NULL, fromraw = FALSE)
hst.write(open_hist, closed_hist, file = "", header = NULL, fromraw = FALSE)
open_hist |
The table (bin,freq,fit) for open times |
closed_hist |
The table (bin,freq,fit) for closed times |
file |
The filename |
header |
The header info |
fromraw |
Unless FALSE, assume we need to write a log10(milliseconds)-sqrt(Frequency) plot |
infile <- system.file("extdata", "example1_hst.hst", package = "scbursts") open = hst.read(infile, extract="open") closed = hst.read(infile, extract="closed") header = hst.extract_header(infile) ### Do stuff hst.write(open, closed, file=file.path(tempdir(), "new_histogram.hst"), header=header)
infile <- system.file("extdata", "example1_hst.hst", package = "scbursts") open = hst.read(infile, extract="open") closed = hst.read(infile, extract="closed") header = hst.extract_header(infile) ### Do stuff hst.write(open, closed, file=file.path(tempdir(), "new_histogram.hst"), header=header)
Undo the effect of the gaussian filter. See section 4.1.1 of Colquhoun and Sigworth, "Fitting and Analysis of Single-Channel segments". NOTE: This is potentially problematic, in that this unfiltering lengthens every dwell. A less naive algorithm would take into account the infulence of the surroundings, as they impact the effects of the filter.
risetime.correct_gaussian(Tr, segments, units = "s")
risetime.correct_gaussian(Tr, segments, units = "s")
Tr |
Rise time of the filter in (us) |
segments |
A segment or multiple segments with $states and $dwells to correct. |
units |
What unit the risetime is input in (defaults to seconds) |
A Segment or multiple segments with corrected risetimes.
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us")
infile <- system.file("extdata", "example1_tac.evt", package = "scbursts") transitions <- evt.read(infile) dwells <- evt.to_dwells(transitions) dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us")
Data is in seconds.
scan.read(filename, separating_factor = 1000)
scan.read(filename, separating_factor = 1000)
filename |
the file name to read from. |
separating_factor |
In lieu of a known time between segments, seperate with a multple of the longest dwell. |
A list of recording segments from the scan file
infile <- system.file("extdata", "example1_scan.txt", package = "scbursts") record <- scan.read(infile) head(record)
infile <- system.file("extdata", "example1_scan.txt", package = "scbursts") record <- scan.read(infile) head(record)
Check if segment contains subconductive states
segment.check_subconductance(segment)
segment.check_subconductance(segment)
segment |
The dwells and states table |
True if it contains an conductance other than 0 or 1, False otherwise.
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.check_subconductance(my_burst)
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.check_subconductance(my_burst)
Extract closed dwells.
segment.closed_dwells(segment)
segment.closed_dwells(segment)
segment |
the segment object |
the closed dwells
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") closed_dwells <- segment.closed_dwells(my_burst) head(closed_dwells)
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") closed_dwells <- segment.closed_dwells(my_burst) head(closed_dwells)
Return a list of all the (sub)conductance states.
segment.conductance_states(segment)
segment.conductance_states(segment)
segment |
The dwells and states table |
a list of all the (sub)conductance states.
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.conductance_states(my_burst)
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.conductance_states(my_burst)
Segments may contain consecutive dwells with the same conductance level. consecutives_to_dwells sums together all consecutive dwells with the same conductance level. The result is a segment containing dwells that alternate in conductance level (i.e. 1,0,1,0,1,...)
segment.consecutives_to_dwells(segment)
segment.consecutives_to_dwells(segment)
segment |
The dwells and states table |
A modified copy of the original segment
This is a low-level function, mostly for use internally by other functions. There aren't many reasons to use this.
segment.copy(segment)
segment.copy(segment)
segment |
The segment to copy |
A duplicate identical content.
Extract number of closed dwells. In the case of subconductive states, a dwell is only closed if the conductance is exactly zero.
segment.count_closed(segment)
segment.count_closed(segment)
segment |
the segment object |
number of closed dwells
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.count_closed(my_burst)
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.count_closed(my_burst)
Extract number of dwells in segment.
segment.count_dwells(segment)
segment.count_dwells(segment)
segment |
the segment object |
number of dwells
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.count_dwells(my_burst)
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.count_dwells(my_burst)
Extract number of open dwells. In the case of subconductive states, count the number of non-zero states.
segment.count_open(segment)
segment.count_open(segment)
segment |
the segment object |
number of open dwells
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.count_open(my_burst)
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.count_open(my_burst)
This is a low-level function, mostly for use internally by other functions. There aren't many reasons to use this. Create object containing table data and metadata. The object can be used as a dataframe, and the metadata can be accessed with the functions: segment.seg, segment.start_time, segment.filename
segment.create(states, dwells, seg = 1, start_time = 0, name = "burst", ignore_errors = FALSE)
segment.create(states, dwells, seg = 1, start_time = 0, name = "burst", ignore_errors = FALSE)
states |
a vector of states |
dwells |
a vector of dwell durations (same length as states) |
seg |
The segment number. Defaults to 1 |
start_time |
When the dwells began. Defaults to 0 |
name |
Suffix-less version of the original filename. 60uM.dwt -> '60uM' |
ignore_errors |
Do not report faulty segments (not many reasons to do this) |
The segment object: A dataframe with extra metadata.
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=0, name="example_segment") segment.name(my_burst)
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=0, name="example_segment") segment.name(my_burst)
Get duration of a segment.
segment.duration(segment)
segment.duration(segment)
segment |
the segment object |
the duration
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.duration(my_burst)
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.duration(my_burst)
Extract dwells in conductance range. lower <= x <= upper
segment.dwells_by_conductance(segment, level)
segment.dwells_by_conductance(segment, level)
segment |
the segment object |
level |
The conductance to extract |
the dwells in a given range
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") half_open <- segment.dwells_by_conductance(my_burst, 0.5) head(half_open)
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") half_open <- segment.dwells_by_conductance(my_burst, 0.5) head(half_open)
Extract dwells in conductance range. lower <= x <= upper
segment.dwells_by_conductance_range(segment, lower = 0, upper = Inf)
segment.dwells_by_conductance_range(segment, lower = 0, upper = Inf)
segment |
the segment object |
lower |
lower bound on conductance (defaults to 0) |
upper |
upper bound on conductance (defaults to infinity) |
the dwells in a given range
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") half_open <- segment.dwells_by_conductance_range(my_burst, lower=0.2, upper=0.7) head(half_open)
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") half_open <- segment.dwells_by_conductance_range(my_burst, lower=0.2, upper=0.7) head(half_open)
The user specifies a deadtime in microseconds. The function effectively undoes the work of the event detection algorithm by reverting the conductance level (of the brief dwell) back to the previous conductance level in the time sequence. The function then returns a collapsed segment containing alternating dwells.
segment.impose_deadtime(segment, deadtime)
segment.impose_deadtime(segment, deadtime)
segment |
the segment containing dwells and states. |
deadtime |
the briefest possible event in microseconds. |
A modified copy of the original segment
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") my_burst_d <- segment.impose_deadtime(my_burst, deadtime=0.3)
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") my_burst_d <- segment.impose_deadtime(my_burst, deadtime=0.3)
Transform the conductance states according to a user-defined function of conductance level.
segment.modify_conductance(segment, fun)
segment.modify_conductance(segment, fun)
segment |
the segment containing dwells and states. |
fun |
a function on conductance levels (states) |
A modified copy of the original segment
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") ### Collapse into three subconductance states fun <- function(amp) { if (amp < 0.3) return(0) else if (amp >= 0.3 && amp < 0.6) return(0.5) else return(1) } my_burst_d <- segment.modify_conductance(my_burst, fun)
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") ### Collapse into three subconductance states fun <- function(amp) { if (amp < 0.3) return(0) else if (amp >= 0.3 && amp < 0.6) return(0.5) else return(1) } my_burst_d <- segment.modify_conductance(my_burst, fun)
Extract name from segment.
segment.name(segment)
segment.name(segment)
segment |
the segment object |
Segment name (string)
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.name(my_burst)
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.name(my_burst)
Extract open dwells. (Any conductance greater than zero)
segment.open_dwells(segment)
segment.open_dwells(segment)
segment |
the segment object |
the open dwells
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") open_dwells <- segment.open_dwells(my_burst) head(open_dwells)
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") open_dwells <- segment.open_dwells(my_burst) head(open_dwells)
Calculate empirical P(Closed) of a segment. NOTE: Assuming that burst starts and ends with 1
segment.pclosed(segment)
segment.pclosed(segment)
segment |
The dwells and states table |
The ratio of closed time to total time
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") # P(Closed) of this burst segment.pclosed(my_burst)
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") # P(Closed) of this burst segment.pclosed(my_burst)
Calculate empirical P(Lower <= Conductance <= Upper) of a segment.
segment.pconductance(segment, level)
segment.pconductance(segment, level)
segment |
the segment object |
level |
conductance level |
The probability of being in this conductance state
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.pconductance(my_burst, 0.5)
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.pconductance(my_burst, 0.5)
Calculate empirical P(Lower <= Conductance <= Upper) of a segment.
segment.pconductance_range(segment, lower = 0, upper = Inf)
segment.pconductance_range(segment, lower = 0, upper = Inf)
segment |
the segment object |
lower |
lower bound on conductance (defaults to 0) |
upper |
upper bound on conductance (defaults to infinity) |
The probability of being in these conductance states
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.pconductance_range(my_burst, lower=0.5, upper=0.5)
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.pconductance_range(my_burst, lower=0.5, upper=0.5)
Calculate empirical P(Open) of a segment. NOTE: Assuming that burst starts and ends with 1
segment.popen(segment)
segment.popen(segment)
segment |
The dwells and states table |
The ratio of open time to total time
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") # P(Open) of this burst segment.popen(my_burst)
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") # P(Open) of this burst segment.popen(my_burst)
Extract segment number from segment.
segment.seg(segment)
segment.seg(segment)
segment |
the segment object |
Segment number (integer)
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=0, name="example_segment") segment.seg(my_burst)
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=0, name="example_segment") segment.seg(my_burst)
Extract start_time from segment.
segment.start_time(segment)
segment.start_time(segment)
segment |
the segment object |
Segment start_time (float)
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.start_time(my_burst)
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.start_time(my_burst)
The user specifies the desired level ('open' or 'closed'). The function will modify any subconductance level (that is not 0 or 1) to be the desired level 1 for 'open' or 0 for 'closed'. The function then reutrns a collapsed segment containing alternating dwells. (See segment.consecutives_to_dwells for details about the collapsed segment.)
segment.subconductance_as(segment, level)
segment.subconductance_as(segment, level)
segment |
the segment containing dwells and states. |
level |
either 'open' or 'closed' |
A modified copy of the original segment
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") my_burst_d <- segment.subconductance_as(my_burst, "open")
# It's more likely that you created states or dwells with some function states <- c(0, 0.2, 0, 1, 0, 0.5, 0, 0.7, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") my_burst_d <- segment.subconductance_as(my_burst, "open")
Segments should have a very specific shape, but recordings can produce errors that make non-sensical segments. In particular, ones contain multiple consecutive states of equal conductance, or end in closings. This function detects whether a segment satisfies the constraint that the segment conductances are not the same from one dwell to the next, and begin and end with a closing.
segment.verify(segment)
segment.verify(segment)
segment |
The dwells and states table |
True if a valid segment, False otherwise
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.verify(my_burst) # Now, a bad burst with two adjacent open dwells states <- c(0, 1, 0, 1, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.1, 0.6, 1.1, 0.8, 1.1) # This will issue a warning faulty_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="faulty_segment") # This will differentiate good and faulty bursts segment.verify(faulty_burst) # If you have a list of bursts, you can select the good ones with # vbursts <- bursts.select(bursts, segment.verify)
# It's more likely that you created states or dwells with some function states <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.0, 1.1, 0.6, 1.1, 0.8, 1.1) my_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="example_segment") segment.verify(my_burst) # Now, a bad burst with two adjacent open dwells states <- c(0, 1, 0, 1, 1, 0, 1, 0, 1) dwells <- c(0.1, 1.1, 0.5, 0.2, 1.1, 0.6, 1.1, 0.8, 1.1) # This will issue a warning faulty_burst <- segment.create(states, dwells, seg=1, start_time=3.14159, name="faulty_segment") # This will differentiate good and faulty bursts segment.verify(faulty_burst) # If you have a list of bursts, you can select the good ones with # vbursts <- bursts.select(bursts, segment.verify)
Remove suffix and path from filename.
util.basename(filename)
util.basename(filename)
filename |
string to extract basename from |
Name with suffix and path removed
util.basename("bursts/60uM-2017-08-18-16-32/60uM-712.dwt")
util.basename("bursts/60uM-2017-08-18-16-32/60uM-712.dwt")