===================== CellBaum User's Guide ===================== A practical guide to CellBaum for those who want to live track cells but know absolutely nothing about computers. .. note:: You can use CellBaum either on your computer or the MIT Supercloud. Local Usage =========== Getting started --------------- 1. Make sure you have `CellProfiler `__, `Fiji `__, and Conda installed on your computer. Conda is needed for some of the dependency installation. We recommend `Miniconda `__; do not let it install Python into your PATH. 2. Using the Fiji plugin manager, install MIST, a Fiji stitching plugin. 3. Clone the `CellBaum `__ repo, either e.g. with VSCode or via a terminal (remember, the ``$`` just marks the terminal ready for input, you don't type it): .. code-block:: console $ git clone https://github.com/GallowayLabMIT/CellBaum.git 4. Start a new branch for your own work. 5. Follow the instructions in the ``README.md`` file. This involves running ``conda env create --prefix ./cenv --file env.yml``. There are suggestions in the README on making this faster. 6. Download all the timelapse images to your computer so they can be accessed quickly. This can be done by right clicking on the folder and selecting "Always keep on this device". After you are done analyzing the images you can remove them from your computer by right clicking on the folder and selecting "Free up space". 7. Complete the ``cellbaum_config.yml`` file for your specific experiment. This can be done using VS Code. See more detailed instructions below. 8. Open up a terminal in the CellBaum folder. You may open the terminal using VS Code. 9. Activate the virtual environment: .. code-block:: console $ conda activate ./cenv 10. To do a dry-run the CellBaum pipline, type the following in the terminal. This is to double check that everything is configured correctly: .. code-block:: console $ snakemake --dry-run 11. To run CellBaum, type the following into the terminal. To assign a set number of cores on your computer, add the ``-j#`` flag after snakemake. For example, to use 7 cores on your computer to run CellBaum, you could run: .. code-block:: console $ snakemake --j7 12. Let CellBaum run. This may take many hours. The typical order of jobs is: 1. folder merging (if needed, e.g. you stopped and re-started the timelapse) 2. grayscaling 3. find focus (if z-stacking was used) 4. stitching (if stitching was used) 5. run Cell Profiler pipeline to collect cell data and locations (nuclei_masking.cppipe) 6. btracking (for more information on Bayesian Tracking see `GitHub `_ and their `User's Guide `_) 7. Add cell data to HDF tracks file .. tip:: If you want to stop CellBaum from running, hit ctrl+C while in the terminal and CellBaum will stop running after it finishes all the jobs it is currently running. If you are too impatient to wait for CellBaum to finish running or it is stuck on the btracking step, you can kill the terminal. However, if you kill the terminal, you will need to unlock it before you can run again: .. code-block:: console $ snakemake --unlock You may also need to use the rerun-incomplete flag after unlocking if you stopped CellBaum partway through a job such as grayscaling: .. code-block:: console $ snakemake -j7 --rerun-incomplete CellBaum Config File -------------------- If you have not completed a config file previously, copy the ``cellbaum_config.yml.template`` file and remove ".template" from the file name. This will be your config file. If you have a previous config file, you may simply edit that one. Complete the config file with the following information: * directories * Put the path on your computer to each item. * data_dir = Keyence data folder * cp_dir = CellProfiler app * fiji_dir = Fiji app * pipe_dir = pipeline for CellBaum (in CellBaum repository) * output_dir = where you want to save all output files * log_dir = where to save logs, usually this can be in an output_dir/Logs folder * cell_config = btrack config file, under the models folder in CellBaum repository * See examples below:: data_dir: C:\Users\ChemeGrad2020\Massachusetts Institute of Technology\GallowayLab-Timelapse - Brittany\2022.12.16_Hb9-Activation\ cp_dir: C:\Program Files\CellProfiler fiji_dir: C:\Users\ChemeGrad2020\Documents\Fiji.app pipe_dir: C:\Users\ChemeGrad2020\Documents\GitHub\CellBaum\cp_files output_dir: C:\Users\ChemeGrad2020\Documents\CellBaum_Analysis\2022.12.16_Hb9-Activation log_dir: C:\Users\ChemeGrad2020\Documents\CellBaum_Analysis\2022.12.16_Hb9-Activation\Logs cell_config: C:\Users\ChemeGrad2020\Documents\GitHub\CellBaum\models\cell_config.json * folder_merging_needed * false if all your images are in a single folder from the Keyence * true if you need to merge two or more folders, for example you re-started the timelapse on the Keyence. * If true, you must include list under folders_to_merge * gray_channels * list of channels you want to grayscale and which grayscale method to use. * 'max' uses the RGB channel in which the maximum pixel value occurs * 'avg' uses the average of all three RGB channels * using a list of 3 ratios lets you choose the weight of each RGB channel * For example:: gray_channels: CH2: max CH3: max CH4: avg Overlay: avg * focus_finding_needed * True if you used z-stacking during your timelapse. * If true, you also need to include focus_channels. * image_regex * A regular expression that extracts data from image names such as time, well, stitching position, z-stack, and channel. You can check if your regular expression fits your file names using https://regex101.com/. For example, your regular expression could be:: image_regex: (?P.*)_(?P