Skip to content

Diagnostics

Diagnostics specific to a method are found in the method tab.

Viewer

The Viewer is the flagship diagnostic for viewing results. It is a fast, three-dimensional view of gene reads found during call spots and OMP. The application is powered by napari.

Opening

A Viewer can be displayed once coppafisher has run through at least call spots. From the python terminal:

from coppafisher import Notebook, Viewer

nb = Notebook("/path/to/notebook")
Viewer(nb)

or from the command line

python -m coppafisher -v /path/to/notebook

where a napari window will be opened.

You can specify the colour and symbols of genes using a .csv file, then the Viewer can be opened by

from coppafisher import Notebook, Viewer

nb = Notebook("/path/to/notebook")
Viewer(nb, gene_marker_filepath="/path/to/custom/gene_marker_file.csv")

or from the terminal

python -m coppafisher -v /path/to/notebook --gene_marker /path/to/gene_marker.csv

see here for the default gene marker file. The gene marker file supports all napari symbols that are shown under the symbol parameter in their documentation.

The default background image is a low resolution dapi image over all tiles produced during stitch. You can specify custom images and their colour mappings in python

from coppafisher import Notebook, Viewer

nb = Notebook("/path/to/notebook")
Viewer(nb, background_images=["/path/to/custom/background_image.npy", "dapi_detailed"], background_image_colours=["Reds", "gray"])

You can specify the background_images to be ["dapi_detailed"] or ["anchor_detailed"] for 16-bit precision background images.

The colourmaps can be any vispy or matplotlib colourmap.

If the background image(s) are custom files, they must be of shape (im_y x im_x) or (im_z x im_y x im_x). They can be a .npy file, a compressed .npz file with image at key "arr_0", or a .tif file (based on the tifffile package). For further customisation, see the Viewer docstring.

Multiple Background Images

With multiple background images, you will not see a background contrast slider anymore. This is intentional. To change the settings of each background image, click on Window -> Layer List and Window -> Layer Controls. From these windows, you have full control over the background images by selecting one. You can change their blending modes and opacities individually.

Specify no background images by setting background_images=[] and background_image_colours=[].

Close the Viewer and all subplots by pressing Ctrl + C in the terminal.

Description

By default, the greyscale signal in the background is the DAPI, where whiter regions indicate cells. Each gene is given a shape and colour, shown in the gene legend.

For help with Viewer hotkeys and gene selection, press h. This includes further diagnostic subplots in the Viewer. Some require a selected spot. Select a spot by pressing 3 and clicking on a spot. Then press 4 to continue panning.

The "Background Contrast" slider will affect the colour scale of the background image. "Marker Size" will change the size of gene spots. "Z Thickness" allows for multiple z planes to be displayed at once. The "Score Thresholds" allows the user to change the minimum and maximum spot scores to display. The "Intensity Thresholds" affects the minimum and maximum allowed spot intensity to display. By default, the intensity threshold is set to 0.15. The "Method" is the chosen method of gene calling. "Probability" is the Von-Mises probability method and "Anchor" is the anchor method (see call spots), and "OMP" is the Orthogonal Matching Pursuit method (see OMP).

Max Intensity Projection Toggle

It is a known issue that toggling the Max Intensity Projection off displays the wrong z plane in the Viewer since it always shows the first z plane. To fix this, just jiggle the z position using the bottom slider and it will correctly update.

Image title

RegistrationViewer

Opening

from coppafisher import RegistrationViewer, Notebook

nb = Notebook("/path/to/notebook")
RegistrationViewer(nb, "/path/to/config.ini" t=t)

t is a tile index you want to view registration results for. If t is set to None (default), then the lowest tile index is displayed.

PDF Diagnostics

During a pipeline run, multiple .pdf files are created for different sections. These are located in the output directory. If you want the PDFs to be created again, delete the old ones first, then run coppafisher again.

View tile indexing

To visualise how coppafisher has labelled your inputted tiles, use the code below

from coppafisher.plot import view_tile_indexing_grid

view_tile_indexing_grid("/path/to/config.ini")

If you use ND2 files, visualise the tile indices using

from coppafisher.plot import plot_coords_nd2_coppafish

plot_coords_nd2_coppafish("/path/to/nd2_file.nd2", channel=27, reverse=False)

where you can choose the channel index and reverse tile positions if required.

Viewing images

Extracted images

Extracted images are identical to raw images, these are viewed by

from coppafisher import Notebook, plot

nb = Notebook("/path/to/notebook")
plot.view_extracted_images(nb, "/path/to/config.ini", tiles, rounds, channels)

where tiles, rounds, and channels are lists of integers specifying which images to view. Set these to None if you wish to view all of the them from the sequencing images.

Filtered images

Images after the filter stage are viewed by

from coppafisher import Notebook, plot

nb = Notebook("/path/to/notebook")
plot.view_filtered_images(nb, tiles, rounds, channels, apply_colour_norm_factor=False, share_contrast_limits=True)

where tiles, rounds, and channels are lists of integers specifying which images to view. Set these to None if you wish to view all of the them from the sequencing images. The boolean parameters can be changed if needed. You can also view the anchor round/channel. See nb.basic_info.anchor_round and nb.basic_info.anchor_channel for the indices.

Intensity images

You can view the computed intensities once call spots is complete. Do this by

from coppafisher import Notebook, plot

nb = Notebook("/path/to/notebook")
plot.view_intensity_images(nb, tiles, z_planes=None)

tiles is a list of integers for each tile index to view. If set to None, the first tile is shown. When z_planes is None, the first 20 z planes are shown, you can choose to show more z planes by setting z_planes to any number > 20. The anchor images are also displayed for reference.