Data Fetching

Determine Download Parameter AFM txt-files

# path to AFM files on the server or a local machine, all files in that folder will be read
        setwd("/Users/joergheintz/Documents/06_Projects/FrictionCellMembranes")
        mypath <- "/Users/joergheintz/Documents/06_Projects/FrictionCellMembranes/02_Data"  
# provide number of lines that need to be skipped, header of AFM file
        fileLineOffset <- 12 

# spring constant alpha
        alpha = 2.93

# provide column numbers
        ColumnsOfInterest <- c(1,7,8) # provide columnames tha need to be read in. predefined is x, y-trace, y-retrace
        lowlimit = 513 #read lines from "lowlimit" to "uplimit" from each AFT txt file
        uplimit = 4096 #read lines from "lowlimit" to "uplimit" from  each AFT txt file

# collect and stores data from the raw AFM files 
        myRawData<-Ingestion(alpha = alpha, ColumnsOfInterest = ColumnsOfInterest, fileLineOffset = fileLineOffset,
        mypath = mypath, lowlimit = lowlimit , uplimit = uplimit)

Ingestion and Processing

Data Manipulation for Plotting

# Determining trace or retrace, this file reads the csv file that is generated in the "Ingestion" function
        myfilename<-"CellMembrane_Friction_20170324.csv"
        y_trace__y_retrace<-"y_trace"  # options are y_trace / Y_retrace
      
# Reads from the RawData File a data subset
#. e.g. trace or retrace, and categorical variables from the AFM
        mydata<-PreprocessingIngestedRawData(myfilename = myfilename, y_trace__y_retrace = y_trace__y_retrace)
        
        
# create a cellmembrane color scale
colSet <- "Set1"
myColors <- brewer.pal(5,colSet)
names(myColors) <- levels(mydata$system)
colSc <- scale_colour_manual(name = "system",values = myColors)

        
# Case Definitions
        GelPEMvsFullsytem_2nN_50nN <- as.logical(mydata$system == "GelPEM" | mydata$system == "FullSystem")
        GelPEMvsFullsytem_2nN <- as.logical((mydata$system == "GelPEM" | mydata$system == "FullSystem") & mydata$f_on_samp == "2nN")
        GelPEMvsGelvsFullsytem_2nN <- as.logical((mydata$system == "GelPEM" | mydata$system == "FullSystem" | mydata$system == "Gel") &  mydata$f_on_samp == "2nN")
        GelPEMvsGelvsFullsytem_2nN_50nN <- as.logical((mydata$system == "GelPEM" | mydata$system == "FullSystem" | mydata$system == "Gel"))
        GelPEMvsFullsytem_50nN <- as.logical((mydata$system == "GelPEM" | mydata$system == "FullSystem") & mydata$f_on_samp == "50nN")
        GelvsFullsytem_50nN <- as.logical((mydata$system == "Gel" | mydata$system == "FullSystem") & mydata$f_on_samp == "50nN")
        GelvsFullsytem_2nN <- as.logical((mydata$system == "Gel" | mydata$system == "FullSystem") & mydata$f_on_samp == "2nN")

        #mydata<-mydata[GelPEMvsFullsytem_2nN_50nN, ]
        #mydata<-mydata[GelPEMvsFullsytem_2nN, ]
        #mydata<-mydata[GelPEMvsGelvsFullsytem_2nN, ]
        mydata<-mydata[GelPEMvsGelvsFullsytem_2nN_50nN, ]
        #mydata<-mydata[GelPEMvsFullsytem_50nN, ]
        #mydata<-mydata[GelvsFullsytem_2nN, ]
        #mydata<-mydata[GelvsFullsytem_50nN, ]

Data Processing Pipeline

# Pipeline
## Data PreProcessing, mark sticks and slips
        mydata<-StickSlip(mydata, "half_loop")
## Cluster the sticks and slips, provide data.frame and name for the cluster variable
        mydata<-BuildCluster(mydata, "st_sl")
## calc residuals / take out linear effect of x
        mydata<-InsertResidual(mydata)
## Determine max min slope by dymax/dxmax for each peak
        mydata<-MinMaxSlope(mydata)
## Calculate the segmebts (with x, xend=x+dx, y, yend=y+dy 
        mydata<-Segments(mydata)
## Calculate the segmet for fitted valutes (with x, xend=x+dx, y, yend=y+dy 
        mydata<-SegmentsFit(mydata)

## write and arrange columns
        mydata <- mydata %>% select( ID,half_loop, cluster, mSL, y, dy, dymax, x, dx, dxmax,  reg.slope, reg.intercept,
x.fitted, dx.fitted, y.resid, dy.resid, x.fitted.min, x.fitted.max, y.resid.min, y.resid.max, dx.fitted.max, dy.resid.max, slope.fit, alpha, slope,  st_sl, xmin:ymax, f_on_samp, system, trace_d,  line_rate, length, tip, date)
        write.csv(mydata, file = paste(Sys.Date(), "_StickSlip_Cluster_Slope_Segments_", myfilename), row.names = FALSE )

## Histogram Slopes

SlopeHistogram(mydata = mydata, logscale = FALSE, set_x_marker = 0, bi = 1000, low = -2000000, up = 2000000, pr = 0, w = 3, h = 1, colS = colSet)

## Plot Slopes
PlotSlope_1(mydata, logscale = TRUE, c = 3)

## Plot Slopes
PlotSlope_2(mydata, logscale = FALSE, c = 3)

Plotting

## Plotting
PlotCol_RegLine_Fit(mydata, p =0 )

PlotColFit(mydata, c = 3, p = 0, xfitted = 0)

Peaks & Segments Plots

PlotCol_RegLine(mydata, c=3, p = 0)

PlotBoxSystemForce_AllinOne(mydata)

PlotBoxSystemForce(mydata)

Residuals-Plot

PlotColLm(mydata, c = 2, p = 0)

Variable Description

  1. x in [um], AFM output
  2. u.def in [V$ 110^-6 V$ ], AFM output
  3. st_sl, [1,-1], 1 = stick = positive slope, slip = -1 negative slope
  4. cluster in [integer], one cluster represents one peak, each cluster contains n points that belong to that peak
  5. sl_fac [points/peak], measure points pro peak
  6. alpha [nN/V], calibration constant for calculating the friction force f_friction
  7. f_friction in [nN]
  8. f_on_samp in [nN], normal force applied on sample
    1. 2nN
    2. 10nN
    3. 20nN
  9. x_speed in [um/s], AFM “slider” speed, the speed is calcuated by: lenght[um] x line rate [Hz=1/s] x 2 (half loops)
    1. 1um/s
    2. x mm/s
  10. line rate [1/sec], frequency of the line scanning, AFM scannes several lines (back and forth) over the same length to collect data, and to determine the trace, retrace values.
  11. length [um], the trace or retrace distance
  12. trace_d [1,0], scans in the forward (trace=1, 1-512 Bit) and reverse (retrace=-1, 513-1024 Bit) directions
  13. half_loop[#], number half loops per experiement, one half loop is one complete trace or retrace
  14. x_scan_dist in [um], max scan length of 10um (512 bits) both directions.
  15. substrates [categorical]
    1. bg = 1st control bare gel
    2. gel_PEM = 2nd control is gel-PEM with polymers on surface
    3. LB_on_Si = 3rd control, lipid bilayer on silica
    4. LB_on_gelPEM = fullsystem cell membrane model, lipid bilayer on gel-PEM.
  16. Tip
    1. blunt