Title: | Functions for Atomic Force Microscope Force-Distance Curves Analysis |
---|---|
Description: | Set of functions for analyzing Atomic Force Microscope (AFM) force-distance curves. It allows to obtain the contact and unbinding points, perform the baseline correction, estimate the Young's modulus, fit up to two exponential decay function to a stress-relaxation / creep experiment, obtain adhesion energies. These operations can be done either over a single F-d curve or over a set of F-d curves in batch mode. |
Authors: | Rafael Benitez <[email protected]>, Vicente Jose Bolos, Jose-Luis Toca-Herrera |
Maintainer: | Rafael Benitez <[email protected]> |
License: | GPL |
Version: | 0.0.1 |
Built: | 2024-12-01 08:00:27 UTC |
Source: | CRAN |
Finds the adhesion and the full detach energies from the retract segment of the AFM F-d curve.
afmAdhesionEnergy(afmdata, width = 1, lagdiff = width, mul, mdj = NULL)
afmAdhesionEnergy(afmdata, width = 1, lagdiff = width, mul, mdj = NULL)
afmdata |
An afmdata or afmexperiment class variables. Baseline correction should have been done already. |
width |
Width of the window for the local regression (in vector position units) |
lagdiff |
Lag for estimating the differences in Delta (or slopes) signal. By default it takes the same value as the window with. |
mul |
Multiplier for the calculating the threshold inthe estimation of jumps and peaks in the Delta signal |
mdj |
Minimum distance between jumps. If none is given then it will be set equal
to |
An afmdata
class variable which will consist on the original
input afmdata
variable plus a new list named AdhEner
with the
following fields:
Points
Array containing the indices of the retract segment where the adhesion
begins, the unbinding event takes place and the adhesion ends.
Energies
Data frame with three columns: E1adh
, E2adh
and
Etotal
, being the first one the energy from the begining of the adhesion until
the unbinding event, then second one the energy from the unbinding event until the full
detachment of the tip, and the third one, the sum of them.
path <- path.package("afmToolkit") data <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path) data <- afmContactPoint(data, width = 20, mul1 = 1, mul2 = 10) data <- afmDetachPoint(data, width = 20, mul1 = 2, mul2 = 30) data <- afmBaselineCorrection(data) data <- afmAdhesionEnergy(data, width = 20, mul = 10) str(data$AdhEner)
path <- path.package("afmToolkit") data <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path) data <- afmContactPoint(data, width = 20, mul1 = 1, mul2 = 10) data <- afmDetachPoint(data, width = 20, mul1 = 2, mul2 = 30) data <- afmBaselineCorrection(data) data <- afmAdhesionEnergy(data, width = 20, mul = 10) str(data$AdhEner)
This function performs the baseline correction to an AFM F-z curve within an
afmdata
structure.
It substracts a best fit line to the cuve: for the approach and contact segments, it fits a line to the approach curve points where for which |z|>ZPointApp and for the retract segment, it fits a line to the retract curve where |z|> ZpointRet.
If no ZPointApp is given and the contact point has been already estimated
(via afmContactPoint()
function), then it is found as
afmBaselineCorrection(afmdata, ZPointApp = NULL, ZPointRet = NULL, fitpause = c("approach","retract","none"), vsTime = FALSE)
afmBaselineCorrection(afmdata, ZPointApp = NULL, ZPointRet = NULL, fitpause = c("approach","retract","none"), vsTime = FALSE)
afmdata |
An |
ZPointApp |
Point in the approach segment of the curve that defines the approach baseline |
ZPointRet |
Point in the retract segment of the curves that defines the retract baseline |
fitpause |
Behaviour for the baseline correction at the pause segment: if "approach" (default), the pause segment is correted using the best line fit done on the approach segment, if "retract" the best line fit of the retract segment is used, if "none", no baseline correction is done on the pause segment. |
vsTime |
Logical. If TRUE then the baseline correction is performed following the Force vs time approach described by S. Moreno-Flores (Moreno Flores (2016)). |
afmdata
An afmdata
structure identical to the one in
the input, but with an additional ForceCorrected
column in the
data
dataframe of the afmdata
structure.
Moreno Flores (2016). Baseline correction of AFM force curves in the force-time representation. Microscopy Research and Technique, 79, (11), pp. 1045-1049.
AFMcurve <- afmReadJPK("force-save-JPK-2h.txt.gz", path = path.package("afmToolkit")) ZPointApp <- 6.43e-6 ZPointRet <- 6.45e-6 AFMcurve <- afmBaselineCorrection(AFMcurve,ZPointApp = ZPointApp,ZPointRet = ZPointRet) plot(AFMcurve) # Without providing ZPointApp AFMcurve <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path.package("afmToolkit")) AFMcurve <- afmContactPoint(AFMcurve,width = 10,mul1 = 1,mul2 = 20, loessSmooth = FALSE) AFMcurve <- afmBaselineCorrection(AFMcurve) plot(AFMcurve)
AFMcurve <- afmReadJPK("force-save-JPK-2h.txt.gz", path = path.package("afmToolkit")) ZPointApp <- 6.43e-6 ZPointRet <- 6.45e-6 AFMcurve <- afmBaselineCorrection(AFMcurve,ZPointApp = ZPointApp,ZPointRet = ZPointRet) plot(AFMcurve) # Without providing ZPointApp AFMcurve <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path.package("afmToolkit")) AFMcurve <- afmContactPoint(AFMcurve,width = 10,mul1 = 1,mul2 = 20, loessSmooth = FALSE) AFMcurve <- afmBaselineCorrection(AFMcurve) plot(AFMcurve)
Find the contact point in for the Force-Distance curve following the local regression and two thresholds methods described in Microscopy Research and Technique 2013 (see reference).
afmContactPoint(afmdata, width = 1, mul1, mul2, lagdiff = width, Delta = TRUE, loessSmooth = FALSE)
afmContactPoint(afmdata, width = 1, mul1, mul2, lagdiff = width, Delta = TRUE, loessSmooth = FALSE)
afmdata |
A Force-Distance curve with the afmdata structure. It should be a list with at least the 'data' field with a data frame of at least 4 columns. |
width |
Width of the window for the local regression (in vector position units) |
mul1 |
First multiplier for the first alarm threshold |
mul2 |
Second multiplier for the second alarm threshold |
lagdiff |
Lag for estimating the differences in Delta (or slopes) signal. By default it takes the same value as the window with. |
Delta |
Logical. If TRUE, then the statistic for determining the contact point is the differences between two consecutive values of the slope of the local regression line. If FALSE then the slope itself is used. |
loessSmooth |
Logical If TRUE, a loess smoothing (via loess.smooth()) is done prior to the determination of the contact point. The span of the smoothing is 0.05 (5 approach segment. |
An afmdata
class variable which will consist on the original input
afmdata
variable plus a new list named CP
with the following fields:
CP
The contact point value.
iCP
The position in the array for the contact point value.
delta
The delta signal.
noise
The noise of the delta signal
Benitez R., Moreno-Flores S., Bolos V. J. and Toca-Herrera J.L. (2013). "A new automatic contact point detection algorithm for AFM force curves". Microscopy research and technique, 76 (8), pp. 870-876.
path <- path.package("afmToolkit") data <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path) width <- 20 mul1 <- 1 mul2 <- 10 data <- afmContactPoint(data, width = width, mul1 = mul1, mul2 = mul2) ## Not run: plot(data, segment = "approach") + geom_vline(xintercept = data$CP$CP, lty = 2) ## End(Not run)
path <- path.package("afmToolkit") data <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path) width <- 20 mul1 <- 1 mul2 <- 10 data <- afmContactPoint(data, width = width, mul1 = mul1, mul2 = mul2) ## Not run: plot(data, segment = "approach") + geom_vline(xintercept = data$CP$CP, lty = 2) ## End(Not run)
This function creates an afmdata
structure, which is as list with at
least one field called data
which is a data frame with a valid AFM data, that is,
at least 3 variables called "Z", "Force", and "Segment".
afmdata(data, dstr = "Z", Fstr = "Force", Segstr = "Segment", tstr = "Time", params = list(SpringConstant = numeric(), curvename = NULL ))
afmdata(data, dstr = "Z", Fstr = "Force", Segstr = "Segment", tstr = "Time", params = list(SpringConstant = numeric(), curvename = NULL ))
data |
A data frame consisting in 3 or 4 columns. A minimum of "Z" (or "distance"), "Force" and "Segment". Optionally a fourth column with "Time" could be added. |
dstr |
Character string with the posible names for the distance variable. |
Fstr |
Character string with the posible names for the force variable. |
Segstr |
Character string with the posible names for the Segment variable. |
tstr |
Character string with the posible names for the time variable. |
params |
A list that may contain parameters describing the F-d curve. At least will
contain the |
An object of class afmdata
#Making some artifical data following a L-J 12-6 potential n <- 1000 z <- seq(from = 9e-3, to = 1e-1, length.out = n ) u0 <- 1e-5 z0 <- 1e-2 Force <- -u0*(12*z0^6/z^7-12*z0^12/z^13) Segment <- rep("approach",n) AFMcurve <- afmdata(data.frame(Z = z, Force = Force, Segment = Segment)) plot(AFMcurve)
#Making some artifical data following a L-J 12-6 potential n <- 1000 z <- seq(from = 9e-3, to = 1e-1, length.out = n ) u0 <- 1e-5 z0 <- 1e-2 Force <- -u0*(12*z0^6/z^7-12*z0^12/z^13) Segment <- rep("approach",n) AFMcurve <- afmdata(data.frame(Z = z, Force = Force, Segment = Segment)) plot(AFMcurve)
Find the detach point (or unbinding point) for the Force-Distance curve following the local regression and two thresholds methods described in Microscopy Research and Technique 2013 (see reference).
The procedure is similar to the one used by the afmContactPoint()
function for
obtaining the contact point.
afmDetachPoint(afmdata,width=1,mul1,mul2, lagdiff = width, Delta=TRUE, loessSmooth = FALSE)
afmDetachPoint(afmdata,width=1,mul1,mul2, lagdiff = width, Delta=TRUE, loessSmooth = FALSE)
afmdata |
A Force-Distance curve with the afmdata structure. It should be a list with at least the 'data' field with a data frame of at least 4 columns. |
width |
Width of the window for the local regression (in vector position units) |
mul1 |
First multiplier for the first alarm threshold |
mul2 |
Second multiplier for the second alarm threshold |
lagdiff |
Lag for estimating the differences in Delta (or slopes) signal. By default it takes the same value as the window with. |
Delta |
Logical. If TRUE, then the statistic for determining the contact point is the differences between two consecutive values of the slope of the local regression line. If FALSE then the slope itself is used. |
loessSmooth |
Logical If TRUE, a loess smoothing (via loess.smooth()) is done prior to the determination of the contact point. The span of the smoothing is 0.05 (5 approach segment. |
An afmdata
class variable which will consist on the original input
afmdata
variable plus a new list named DP
with the following fields:
DP
The detach point value.
iDP
The position in the array for the detach point value.
delta
The delta signal.
noise
The noise of the delta signal
Benitez R., Moreno-Flores S., Bolos V. J. and Toca-Herrera J.L. (2013). "A new automatic contact point detection algorithm for AFM force curves". Microscopy research and technique, 76 (8), pp. 870-876.
data <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path.package("afmToolkit")) width <- 10 mul1 <- 2 mul2 <- 40 data <- afmDetachPoint(data, width = width, mul1 = mul1, mul2 = mul2) ## Not run: plot(data, segment = "retract") + geom_vline(xintercept = data$DP$DP, lty = 2) ## End(Not run)
data <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path.package("afmToolkit")) width <- 10 mul1 <- 2 mul2 <- 40 data <- afmDetachPoint(data, width = width, mul1 = mul1, mul2 = mul2) ## Not run: plot(data, segment = "retract") + geom_vline(xintercept = data$DP$DP, lty = 2) ## End(Not run)
Fits a viscoelastic exponential decay in a Force-Relaxation or Creep experiments as described in Nanotechnology 2010 (see references).
afmExpDecay(afmdata, nexp = 2, tmax = NULL, type = c("CH","CF"), plt = TRUE, ...)
afmExpDecay(afmdata, nexp = 2, tmax = NULL, type = c("CH","CF"), plt = TRUE, ...)
afmdata |
An object of |
nexp |
Number of expontials in the Prony series to be fitted. Currently only one or two exponentials are supported. Default is 2. |
tmax |
Maximum time considered in the relaxation curve. It defaults to |
type |
Type of the experiment. Can be either "CH" (Constant Height) for a
force-relaxation experiment or "CF" (Constant Force) for a creep experiment. Default
is |
plt |
Logical. If TRUE (default) then a plot of the pause segment with the overlay of the fit is shown. |
... |
Options passed to the |
An afmdata
class variable which will consist on the original input
afmdata
variable plus a new list named ExpFit
with the following
fields:
expdecayModel
: A nls object returned from nlsM()
function.
expdecayFit
: The values predicted by the fit, returned from the
predict()
function.
Susana Moreno-Flores, Rafael Benitez, Maria dM Vivanco and Jose Luis Toca-Herrera (2010). "Stress relaxation and creep on living cells with the atomic force microscope: a means to calculate elastic moduli and viscosities of cell components". Nanotechnology, 21 (44), pp. 445101.
data <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path.package("afmToolkit")) width <- 20 mul1 <- 1 mul2 <- 10 data <- afmContactPoint(data, width = width, mul1 = mul1, mul2 = mul2) data <- afmDetachPoint(data, width = width, mul1 = mul1, mul2 = mul2) data <- afmBaselineCorrection(data) data <- afmExpDecay(data, nexp = 2, type = "CH")
data <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path.package("afmToolkit")) width <- 20 mul1 <- 1 mul2 <- 10 data <- afmContactPoint(data, width = width, mul1 = mul1, mul2 = mul2) data <- afmDetachPoint(data, width = width, mul1 = mul1, mul2 = mul2) data <- afmBaselineCorrection(data) data <- afmExpDecay(data, nexp = 2, type = "CH")
This function creates an afmexperiment
structure, which is as list
(or an array) of elements of afmdata
class.
afmexperiment(data, ID=NULL)
afmexperiment(data, ID=NULL)
data |
A variable of |
ID |
Character string with the identifier of the |
An object of class afmexp
.
dataFolder <- paste(path.package("afmToolkit"), "afmexperiment",sep = "/") dataFiles <- list.files(dataFolder, pattern = "force", full.names = FALSE) data <- lapply(dataFiles, afmReadJPK, path = dataFolder) names(data) <- dataFiles data <- afmexperiment(data) plot(data[[1]])
dataFolder <- paste(path.package("afmToolkit"), "afmexperiment",sep = "/") dataFiles <- list.files(dataFolder, pattern = "force", full.names = FALSE) data <- lapply(dataFiles, afmReadJPK, path = dataFolder) names(data) <- dataFiles data <- afmexperiment(data) plot(data[[1]])
Extracts some parameters from an afmexperiment for an easy further analysis.
afmExtract(afmexperiment, params = list("YM", "AE", "ED"), opt.param = NULL)
afmExtract(afmexperiment, params = list("YM", "AE", "ED"), opt.param = NULL)
afmexperiment |
Data of afmexperiment class. |
params |
List of parameters to extract from the data. |
opt.param |
Optional parameter or factor in the params field of the afmdata list to add to the data extraction. |
A data frame with the name of the curve and the corresponding values of the parameters extacted.
## Not run: require(dplyr) # Not really necessary # Load the data data(batchExperiment) # Process the afmexperiment data <- afmContactPoint(batchExperiment, width = 50, mul1 = 1, mul2 = 10) data <- afmDetachPoint(data, width = 50, mul1 = 1, mul2 = 10) data <- afmBaselineCorrection(data) data <- afmZeroPointSlope(data) data <- afmIndentation(data) data <- afmYoungModulus(data, thickness = 2e-7, params = list(alpha = 22)) data <- afmExpDecay(data, plt = FALSE) data <- afmAdhesionEnergy(data, mul = 7) # Extract the values of the parameters obtained in the analysis afmExpParams <- afmExtract(data, opt.param = "type") # Plotting the Young's Modulus afmExpParams[[1]] %>% ggplot(aes(x = type, y = YM)) + geom_boxplot() ylab("Young's Modulus (Pa)") ## End(Not run)
## Not run: require(dplyr) # Not really necessary # Load the data data(batchExperiment) # Process the afmexperiment data <- afmContactPoint(batchExperiment, width = 50, mul1 = 1, mul2 = 10) data <- afmDetachPoint(data, width = 50, mul1 = 1, mul2 = 10) data <- afmBaselineCorrection(data) data <- afmZeroPointSlope(data) data <- afmIndentation(data) data <- afmYoungModulus(data, thickness = 2e-7, params = list(alpha = 22)) data <- afmExpDecay(data, plt = FALSE) data <- afmAdhesionEnergy(data, mul = 7) # Extract the values of the parameters obtained in the analysis afmExpParams <- afmExtract(data, opt.param = "type") # Plotting the Young's Modulus afmExpParams[[1]] %>% ggplot(aes(x = type, y = YM)) + geom_boxplot() ylab("Young's Modulus (Pa)") ## End(Not run)
This function computes the deformation of the sample from the calibrated Force-Distance curve, by substracting Z to the Zero Force Point calculated with afmZeroPointSlope function.
afmIndentation(afmdata)
afmIndentation(afmdata)
afmdata |
An |
Returns a list with one field:
afmdata
: An afmdata class in which a Indentation
column is added
in the data
field.
data <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path.package("afmToolkit")) data <- afmContactPoint(data, width = 20, mul1 = 1, mul2 = 20) data <- afmDetachPoint(data, width = 40, mul1 = 3, mul2 = 40) data <- afmBaselineCorrection(data) data <- afmZeroPointSlope(data, segment = "approach") data <- afmIndentation(data) head(data$data)
data <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path.package("afmToolkit")) data <- afmContactPoint(data, width = 20, mul1 = 1, mul2 = 20) data <- afmDetachPoint(data, width = 40, mul1 = 3, mul2 = 40) data <- afmBaselineCorrection(data) data <- afmZeroPointSlope(data, segment = "approach") data <- afmIndentation(data) head(data$data)
Read an ascii JPK file.
Reads an ascii JPK file with one to three headers.
afmReadJPK(filename, path = "", FColStr = "Vertical", ZColStr = "Height (measured & smoothed)", tColStr = "Segment Time")
afmReadJPK(filename, path = "", FColStr = "Vertical", ZColStr = "Height (measured & smoothed)", tColStr = "Segment Time")
filename |
String with the name of the jpk file. |
path |
Path to the folder where the file is. |
FColStr |
String with a pattern identifying the Force column. |
ZColStr |
String with a pattern identifying the Z column. |
tColStr |
String with a pattern identifying the Time column. |
A list containing a field 'data' which is a data frame
data <- afmReadJPK("force-save-JPK-3h.txt.gz",path = path.package("afmToolkit")) str(data)
data <- afmReadJPK("force-save-JPK-3h.txt.gz",path = path.package("afmToolkit")) str(data)
Read all JPK ascii files in a given folder. It searches for all files containing a
given patter (".txt" by default) and uses the afmReadJPJ
function.
afmReadJPKFolder(folder, pattern = ".txt", ...)
afmReadJPKFolder(folder, pattern = ".txt", ...)
folder |
Name of the folder containing the jpk files. |
pattern |
Pattern that will identify the jok files (".txt" by default). |
... |
Other parameters passed to afmReadJPK function. |
An afmexperiment
class data structure with all F-d curves.
folder <- paste(path.package("afmToolkit"), "afmexperiment",sep = "/") data <- afmReadJPKFolder(folder = folder) str(data)
folder <- paste(path.package("afmToolkit"), "afmexperiment",sep = "/") data <- afmReadJPKFolder(folder = folder) str(data)
Read an ascii Veeco file.
Reads an ascii Veeco file with one or two segments.
afmReadVeeco(filename, path = "")
afmReadVeeco(filename, path = "")
filename |
String with the name of the jpk file. |
path |
Path to the folder where the file is. |
A list containing a field 'data' which is a data frame
data <- afmReadVeeco("veeco_file.txt.gz",path = path.package("afmToolkit")) str(data)
data <- afmReadVeeco("veeco_file.txt.gz",path = path.package("afmToolkit")) str(data)
Read all Veeco ascii files in a given folder. It searches for all files containing a
given patter (".txt" by default) and uses the afmReadVeeco
function.
afmReadVeecoFolder(folder, pattern = ".txt")
afmReadVeecoFolder(folder, pattern = ".txt")
folder |
Name of the folder containing the Veeco files. |
pattern |
Pattern that will identify the Veeco files (".txt" by default). |
An afmexperiment
class data structure with all F-d curves.
folder <- paste(path.package("afmToolkit"), "veecoFolder",sep = "/") data <- afmReadVeecoFolder(folder = folder) str(data)
folder <- paste(path.package("afmToolkit"), "veecoFolder",sep = "/") data <- afmReadVeecoFolder(folder = folder) str(data)
This function computes the Young's Modulus of the sample from the approach curve using Hertz's contact model for a pyramidal tip.
afmYoungModulus(afmdata, thickness = NULL, model = "Hertz", geometry = c("pyramid","paraboloid"), silent = TRUE, params)
afmYoungModulus(afmdata, thickness = NULL, model = "Hertz", geometry = c("pyramid","paraboloid"), silent = TRUE, params)
afmdata |
An |
thickness |
Thickness (in m) of the surface. The Force - Indentation fit will be done for values of the Indentation variable smaller than the thickness. If no value is given, it will be done for all values in the curve for which the Indentation is negative. |
model |
Contact mechanics model to be used. Currently only Hertz's pure elastic model is available. |
geometry |
Geometry of the tip. Currently only pyramidal (default) and paraboloid geometries are implemented. |
silent |
Logical value. If FALSE it prints the fit model summary (via
|
params |
A list containing different parameters of the model: e.g. nu (Poisson's ratio) or alpha (internal angle, in degrees, of the pyramidal tip) or R (tip radius, in the paraboloid geometry) |
An afmdata
class variable which will consist on the original input
afmdata
variable plus a new list named YoungModulus
with the following
fields:
YoungModulus
The Young's modulus value (in Pa).
fitYM
The Force vs Indentation^2 fit as an lm
object.
fitdata
The subset of the data used in the fit.
data <- afmReadJPK("force-save-JPK-2h.txt.gz", path = path.package("afmToolkit")) data <- afmContactPoint(data, width = 20, mul1 = 1, mul2 = 20) data <- afmDetachPoint(data, width = 40, mul1 = 3, mul2 = 40) data <- afmBaselineCorrection(data) data <- afmZeroPointSlope(data, segment = "approach") data <- afmIndentation(data) data <- afmYoungModulus(data, thickness = 1e-8, params = list(alpha = 22), silent = TRUE) print(data$YoungModulus$YoungModulus)
data <- afmReadJPK("force-save-JPK-2h.txt.gz", path = path.package("afmToolkit")) data <- afmContactPoint(data, width = 20, mul1 = 1, mul2 = 20) data <- afmDetachPoint(data, width = 40, mul1 = 3, mul2 = 40) data <- afmBaselineCorrection(data) data <- afmZeroPointSlope(data, segment = "approach") data <- afmIndentation(data) data <- afmYoungModulus(data, thickness = 1e-8, params = list(alpha = 22), silent = TRUE) print(data$YoungModulus$YoungModulus)
This function finds the point of zero force (real contact point) and the slope of the contact part of the Force-Distance curve.
afmZeroPointSlope(afmdata, fstar = 0, segment = c("approach", "retract"))
afmZeroPointSlope(afmdata, fstar = 0, segment = c("approach", "retract"))
afmdata |
An |
fstar |
Value such that fstar * sd is to be considered as zero Force, where sd is the standard deviation of Force at the basline. It takes fstar = 0 as default value, meaning that zero force is actually zero. |
segment |
The segment on which everything is calculated. |
An afmdata
class variable which will consist on the original input
afmdata
variable plus a new list named Slopes
with the following
fields: Z0Point
: Point of zero force. Slope
: Slope of the best fit line
in the contact part of the Force-Distance curve.
data <- afmReadJPK("force-save-JPK-2h.txt.gz", path = path.package("afmToolkit")) data <- afmContactPoint(data, width = 20, mul1 = 1, mul2 = 20) data <- afmDetachPoint(data, width = 40, mul1 = 3, mul2 = 40) data <- afmBaselineCorrection(data) data <- afmZeroPointSlope(data, segment = "approach") ## Not run: plot(data, segment = "approach") + geom_vline(xintercept = data$Slopes$Z0Point, lty = 2) ## End(Not run)
data <- afmReadJPK("force-save-JPK-2h.txt.gz", path = path.package("afmToolkit")) data <- afmContactPoint(data, width = 20, mul1 = 1, mul2 = 20) data <- afmDetachPoint(data, width = 40, mul1 = 3, mul2 = 40) data <- afmBaselineCorrection(data) data <- afmZeroPointSlope(data, segment = "approach") ## Not run: plot(data, segment = "approach") + geom_vline(xintercept = data$Slopes$Z0Point, lty = 2) ## End(Not run)
afmdata
list.This function appends a list to an existing afmdata structure. It is used internally by several afm* functions when attaching the results to the input afmdata variable. This function should not be used directly unless by experienced users.
append.afmdata(afmdata, x, name = NULL)
append.afmdata(afmdata, x, name = NULL)
afmdata |
The afmdata to which the new list is going to be joined. |
x |
A list to be appended. |
name |
The name of new field of the resulting afmdata object. If none is given, it
is the same as |
The new list of class afmdata
An afmexperiment list containing 14 afmdata Force-distance experiments. Each experiment has three segments ("approach", "pause" and "retract") and they are divided in two groups depending on the covering of the sample ("CHI" for Chitosan, and "PAH" for Polyallylamine hydrochloride).
batchExperiment
batchExperiment
An afmexperiment class consisting on a list of 14 afmdata class elements each one having the following fields:
Data frame with the data itself with a variable number of rows (between 4692 and 6142) and 4 variables:
Distance (in meters)
Force (in Newtons)
Time starting at the begining of each segment (in seconds)
Segment of the Force-distance curve (factor: "approach", "pause", "retract")
List with the following fields describing the experiment:
Cantilever spring constant (in N/m)
Name of the original AFM data file from which the data was obtained
Type of sample covering: "CHI" for Chitosan, and "PAH" for Polyallylamine hydrochloride
Checks wether an R object is an afmdata or not.
is.afmdata(x)
is.afmdata(x)
x |
Any R object. |
Returns TRUE
if its argument is an afmdata (that is, has "afmdata"
amongst its classes) and FALSE
otherwise.
Checks wether an R object is an afmexperiment or not.
is.afmexperiment(x)
is.afmexperiment(x)
x |
Any R object. |
Returns TRUE
if its argument is an afmdata (that is, has "afmexperiment"
amongst its classes) and FALSE
otherwise.
Plots an afmdata object.
## S3 method for class 'afmdata' plot(x, y = NULL, vs = "Z", segment = "all", ...)
## S3 method for class 'afmdata' plot(x, y = NULL, vs = "Z", segment = "all", ...)
x |
An object of |
y |
Variable added for compatibility with |
vs |
The variable for the x-axis. May take the values "Time" or "Z". It defaults
to "Z", plotting thus a Force-Distance curve. If |
segment |
The segment of the curve to be plotted. If |
... |
Additional parameters to be pased to the ggplot functions. |
# Loading the data path <- path.package("afmToolkit") data <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path) # Standard plot (out of the box) plot(data) # Computing the contact and detach points data <- afmContactPoint(data, width = 20, mul1 = 1, mul2 = 10) data <- afmDetachPoint(data, width = 40, mul1 = 3, mul2 = 20) # Making the baseline correction data <- afmBaselineCorrection(data) # Plot once the baseline correction is done plot(data) # Plotting only retract segment plot(data, segment = "retract") # Plotting the pause segment: Force vs Time plot(data, segment = "pause", vs = "Time")
# Loading the data path <- path.package("afmToolkit") data <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path) # Standard plot (out of the box) plot(data) # Computing the contact and detach points data <- afmContactPoint(data, width = 20, mul1 = 1, mul2 = 10) data <- afmDetachPoint(data, width = 40, mul1 = 3, mul2 = 20) # Making the baseline correction data <- afmBaselineCorrection(data) # Plot once the baseline correction is done plot(data) # Plotting only retract segment plot(data, segment = "retract") # Plotting the pause segment: Force vs Time plot(data, segment = "pause", vs = "Time")
afmdata
class object.This function sumarizes the main features of an afmdata object and, optionnaly plots all segments available with all parameters estimated.
## S3 method for class 'afmdata' summary(object, plt = TRUE, ...)
## S3 method for class 'afmdata' summary(object, plt = TRUE, ...)
object |
An object of |
plt |
Logical variable. If TRUE plots all available segments with all available data. |
... |
Additional arguments (for compatibility with |
## Not run: path <- path.package("afmToolkit") data <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path) data <- afmContactPoint(data, width = 20, mul1 = 1, mul2 = 10) data <- afmDetachPoint(data, width = 20, mul1 = 2, mul2 = 30) data <- afmBaselineCorrection(data) data <- afmAdhesionEnergy(data, width = 20, mul = 10) data <- afmZeroPointSlope(data, segment = "approach") data <- afmIndentation(data) data <- afmYoungModulus(data, thickness = 1e-7, params = list(alpha = 22), silent = TRUE) data <- afmExpDecay(data, nexp = 2, type = "CH") summary(data) ## End(Not run)
## Not run: path <- path.package("afmToolkit") data <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path) data <- afmContactPoint(data, width = 20, mul1 = 1, mul2 = 10) data <- afmDetachPoint(data, width = 20, mul1 = 2, mul2 = 30) data <- afmBaselineCorrection(data) data <- afmAdhesionEnergy(data, width = 20, mul = 10) data <- afmZeroPointSlope(data, segment = "approach") data <- afmIndentation(data) data <- afmYoungModulus(data, thickness = 1e-7, params = list(alpha = 22), silent = TRUE) data <- afmExpDecay(data, nexp = 2, type = "CH") summary(data) ## End(Not run)
This is an internal function used by the afmContactPoint
and afmDetachPoint
functions.
It computes the slopes of a linear fit to the data in a window of a given radius.
This function should not be used directly unless by experienced users.
windowedFit(X, width)
windowedFit(X, width)
X |
Least squares matrix on the form [1 z Force],
according to input parameters in function |
width |
Width of the window for the local regression (in vector position units) |
OUT
A vector of length nrow(X)-2*width
,
containing with the slopes of the fits.
n <- 100 x <- seq(0,2*pi,length.out = n) y = sin(x)+0.1*rnorm(n) X <- matrix(c(rep(1,n),x,y),nrow = n,ncol = 3) width <- 5 b <- windowedFit(X,width) plot(x[(width+1):(n-width)],b,xlab = "x",ylab = "y",type = "l") lines(x,y,col = "red") legend("bottomleft",c("Slopes","Signal"),col = c(1,2),lty = 1)
n <- 100 x <- seq(0,2*pi,length.out = n) y = sin(x)+0.1*rnorm(n) X <- matrix(c(rep(1,n),x,y),nrow = n,ncol = 3) width <- 5 b <- windowedFit(X,width) plot(x[(width+1):(n-width)],b,xlab = "x",ylab = "y",type = "l") lines(x,y,col = "red") legend("bottomleft",c("Slopes","Signal"),col = c(1,2),lty = 1)