Skip to content

Genealogy Part 2

Renske van Raaphorst edited this page Oct 18, 2019 · 2 revisions

Import your own data

If you are using the example data, you can skip this section and immediately go on to the next chapter of the tutorial.

Import your own data from SuperSegger

If you used SuperSegger to analyze your timelapse movie, make sure you save your Clist. BactMAP takes the clist.data out of the matlab file and converts it to a set of dataframes and network data:

#load your matlab "clist" from your directory
mySupSegFile <- file.choose()

#extract your supersegger data.
myTreeData <- extr_SuperSeggerClist(mySupSegFile)

Check the output of myTreeData here by running the following command:

summary(myTreeData)

The output of extr_SuperSeggerClist() is a list of dataframes and networks:

  • cellList: this is a copy of the clist, unmodified by BactMAP

  • network: this is the cell genealogy information saved as a igraph network.

  • generation_lists: this is the phylogenetic tree (or phylogenetic trees) saved as a phylo object. The ggtree package and other network packages recognize the data as a phylogenetic tree.

  • generation_dataframes: this is the dataframe (or multiple, if there are multiple trees) containing the phylogenetic information plus some extra fields which are characteristics of each cell. If you -for instance - measured mean fluorescence while running your SuperSegger analysis, this will be saved here.

In this tutorial, we will use the generation_lists, network and generation_dataframes. Now, let’s take the three datasets out of the list and name them, so it’s a bit easier to work with. To access members of a list, use the $-operator.

myTreeDF <- myTreeData$generation_dataframes
myTreePhylo <- myTreeData$generation_lists
myTreeNetwork <- myTreeData$network

If you like, you can save & close myTreeData:

#save
save(myTreeData, file="myTreeData.Rda")
#close
rm(myTreeData)

2.3 Import your own data from Oufti

You can also use data from Oufti to generate trees. After cell segmentation in Oufti, make sure you save your output either as a .mat or a .csv file. After that, import your data using extr_Oufti as shown below. Specify that you want to get genealogy information by setting the argument phylo=TRUE:

#load your matlab or csv oufti output from your directory
myOuftiFile <- file.choose()

#extract your oufti data
myTreeData <- extr_Oufti(myOuftifile, phylo=TRUE)

You can check the output of myTreeData by using the following command:

summary(myTreeData)

You see that a lot of different datasets are included in the extr_Oufti output list. How many depends on the type of analysis you did. Check all the optional outputs here.

For this tutorial, we are interested in the dataset timelapsedata, which in turn is a list of different datasets. Out of these datasets, we will use generation_lists, network and generation_dataframes:

  • network: this is the cell genealogy information saved as a igraph network.

  • generation_lists: this is the phylogenetic tree (or phylogenetic trees) saved as a phylo object. The ggtree package and other network packages recognize the data as a phylogenetic tree.

  • generation_dataframes: this is the dataframe (or multiple, if there are multiple trees) containing the phylogenetic information plus some extra fields which are characteristics of each cell. If you -for instance - measured mean fluorescence (Signal0-2 in the case of Oufti), it will be saved here.

Now, let’s take the three datasets out of the list and name them, so it’s a bit easier to work with. To access members of a list, use the $-operator:

myTreeDF <- myTreeData$timelapsedata$generation_dataframes
myTreePhylo <- myTreeData$timelapsedata$generation_lists
myTreeNetwork <- myTreeData$timelapsedata$network

Close & Save your data

If you like, you can save & close myTreeData:

#save
save(myTreeData, file="myTreeData.Rda")
#close
rm(myTreeData)

⬅️ Genealogy Part 1: Before Getting Started Genealogy Part 3: Data Structure ➡️
Clone this wiki locally