Segmentation Tutorial Part 4 - veeninglab/BactMAP GitHub Wiki

Combine all mesh frames using combineDataframes

The combineDataframes function

BactMAP’s combineDataframes() is a function which makes it easy to add information from different experiments and/or microscopy channels together. This works for mesh-dataframes, but it works equally for any other group of datasets where you want to compare specific common variables.

The input of combineDataframes() is as follows:

  • listofdataframes: a list of the dataframes you wish to combine
  • listofconditions: (optional) here you can name each experimental condition (in the same order as the dataframes)
  • listofchannels: (optional) here you can name each microscopy channel (in the same order as the dataframe)

In our case, we don’t have different microscopy channels, so I give a different name to each dataset in the variable listofconditions:

allFrames <- combineDataframes(listofdataframes = list(clemOuf$mesh,
                                                       lanceMic$mesh,
                                                       renMorph$mesh,
                                                       junSeg$mesh,
                                                       junOuf$mesh),
                               listofconditions = list("Clement_Oufti",
                                                       "Lance_MicrobeJ",
                                                       "Renske_Morphometrics",
                                                       "Jun_SuperSegger",
                                                       "Jun_Oufti"))

The output of combineDataframes

Now we have a dataset allFrames, with which we can continue working.

The output contains: * finalframe: this is the combined dataframe. it contains all common variables of the input dataframes, plus an additional column identifying the “condition” we put in. *

If you set the command output="originaldata" in your function, get another dataset back called originaldata. Because some variables are not common between all dataframes and because in some cases it is easier to work with, originaldata is a list containing the original dataframes, including the extra identifier variable “condition” and/or "channel".

I encourage you to use View(), summarytools::dfSummary() and the other functions mentioned in Part 3 of the Tutorial to have a good look at the data.


:arrow_left: Segmentation Tutorial part 3: A Closer Look Segmentation Tutorial part 5: Using ggplot2 to compare Segmentations :arrow_right: