###########Example workflow 3 ###########Renske van Raaphorst - October 2019 ##Workflow: get data from supersegger - plot all separate kymographs - save data ## Packages require(bactMAP) ################################################ ## Data to be filled in per time: ## Working directory #your working directory is the directory where your supersegger data is saved containing #the folders starting with "xy" pathToWD <- "Type/the/path/to/your/files/here" setwd(pathToWD) ## Name of the tiff image stack you want to use (single stack, grey scale) myImage <- "yourImage.TIFF" ## Name of your output files: output_name <- "myOutput" ## magnification converter (when 'myConv' is left out, the number will be automatically asked) myConv = 0.0645 addPixels2um("myObjective", myConv) ################################################ ## Import SuperSegger data #Check the amount of "xy" folders automatically: xys <- list.files(pattern="xy") frames <- length(xys) firstone <- as.numeric(strsplit(xys[order(xys)][1], "xy")[[1]]) superSegData <- extr_SuperSeggerCells(loc= pathToWD, frames=frames, startframe=firstone, mag="myObjective", timelapse=TRUE) ################################################ ## Take data of interest, remove unused data cells <- superSegData$mesh rm(superSegData) #to clear up memory ################################################ ## import TIFF image <- extr_OriginalStack(myImage) ## Connect tiff to cells cells_image <- extr_OriginalCells(image, cells)$rawdata_turned ################################################ ##Make all kymographs allKymos <- bactKymo(cells_image, timeD=TRUE, sizeAV=TRUE, mag="myObjective") ################################################ ##Save PDF cairo_pdf(filename=paste(output_name, "_Kymos.PDF", sep=""), onefile=TRUE, width=6, height=4) allKymos dev.off() save(cells, file=paste(output_name, "_cells.Rda", sep=""))