Localization part 2 - veeninglab/BactMAP GitHub Wiki

Data Import

All import functions in BactMAP start with extr_. They take the information from the output files from segmentation or localization analysis or directly from TIFF images and return so-called DataFrames (2-dimensional data tables) with a fixed structure. The structure of these DataFrames depends on the input; check the section "Data Structure" in the Side Bar for different output formats. Check the section on Data Import for more information on specific import functions.

In this section, we'll import all the data from the tutorial dataset into our R environment. Follow the full tutorial below or skip through to one or more of the sections below:

  1. Import of segmentation output of:
  1. Import of spots detected using iSBatch
  2. Import of TIFF image stacks

Import of segmentation output

Bacillus subtilis: objectJ

Phase Mitotracker Far RedOriC-RFP

Background

Above you see a cutout of the original tiff stack that was used to segment the Bacillus subtilis cells. These cells carry tetR-mCherry, oriC::tetO, which localizes at the origin of replication when induced with xylose, and are stained with Mitotracker Far Red, which (poorly) stains the cell membrane.

I used ObjectJ with the ChainTracer Macro to segment the cells based on the membrane stain. As output, I used the settings saved in the .ojj-file in the dataset you downloaded. For the full documentation of this dataset, check the dataset documentation.

Import

Use extr_ObjectJ() to import ObjectJ output in your environment. Check the function documentation for more information on the in- and output of this function.

Our ObjectJ file is bsubtilis_box.txt. In extr_ObjectJ(), I put the location of that file as the first argument, and as a second argument I put the magnification converter specific for our microscope to calculate from pixels to micron. To see how to set up your own magnification converter, click here.

mesh_Bacillus <- extr_ObjectJ("bacillus_subtilis/bsubtilis_box.txt", mag="100x_FRAP")

Streptococcus pneumoniae: morphometrics

Phase oriC-GFP

Background

S. pneumoniae carries parB(p)-GFP, oriC::parS(p), which also localizes at the origin of replication (when induced with Zinc). The cells are segmented using morphometrics.

Import

To import the morphometric cell countours MK387_phase_18-Apr-2019_CONTOURS.mat, run the command below. As for extr_ObjectJ(), extr_Morphometrics() takes the location of the morphometrics output file as the first argument, and the magnification converter "mag" as a second.

A message in your console will probably appear, asking you to install the package R.matlab, which is necessary for opening Matlab files. Press 'y' to install, and continue.

mesh_Pneumo <- extr_Morphometrics("s_pneumo/MK387_phase_18-Apr-2019_CONTOURS.mat", mag="100x_FRAP")

Staphylococcus aureus: SuperSegger

Phase ParB-GFP

Background

S. aureus with parB-GFP. ParB binds the origin of replication. The cells are segmented using SuperSegger.

SuperSegger saves the cell masks in multiple files: one file per cell, grouped by visited spot in the microscope in folders starting with "xy". For this reason, extr_SuperSeggerCells()'s first argument is not the location of one file, but of the folder containing the SuperSegger output folder(s) starting with "xy". In our case, that folder is called "s_aureus". The second argument, "frames", asks how many folders starting with "xy" should be extracted, and finally, the magnification converter "mag" is the third argument.

The S. aureus pictures were taken on a microscope of which the magnification converter is not saved in BactMAP. 1 pixel corresponds to 0.06 micron in these images. I use the function addPixels2um() to add this conversion to BactMAP:

addPixels2um("Staph", 0.06)

Now I can use this in my extr_ function:

mesh_Staph <- extr_SuperSeggerCells("s_aureus", frames=7, mag="Staph")

Import of detected spots

Next to the cell meshes, we also need the coordinates of the fluorescent spots. I used the PeakFitter of ISBatch to detect the spots in all three image sets. When extracting spot localizations using extr_ISBatch(), no other arguments than the location of the csv file containing the spot data is needed.

spots_Bacillus <- extr_ISBatch("bacillus_subtilis/RRB01_peakfitter_RFP.csv")

spots_Pneumo <- extr_ISBatch("s_pneumo/peakfitter_GFP.csv")

spots_Staph <- extr_ISBatch("s_aureus/peakfitter_GFP.txt")

Import of TIFF image stack

In the next section, we’ll use the tiff image stack of the channel with the origin bound to a fluorescent protein (mCherry in the case of B. subtilis, GFP for S. aureus and S. pneumoniae) to see whether the detection of spots & cell segmentation worked out well. For this, we’ll import the .tiff stacks.

extr_OriginalStack() works on single-channel, grey-scale image stacks. Check the documentation for more information.

For extr_OriginalStack() to work, you will be asked to install the packages tiff and raster.

stack_Bacillus <- extr_OriginalStack("bacillus_subtilis/bacillus_RFP.tif")

stack_Pneumo <- extr_OriginalStack("s_pneumo/MK387_GFP.tif")

stack_Staph <- extr_OriginalStack("s_aureus/Stack_parB_GFP.tif")

⬅️ Localization part 1: Before Getting Started ▪️ ◾ ◼️ ◾ ▪️ Localization part 3: Checking Segmentation ➡️
⚠️ **GitHub.com Fallback** ⚠️