starcall.dotdetection
index
/home/nicho/starcall-docs/starcall/dotdetection.py

 
Modules
       
numpy
matplotlib.pyplot
skimage
tifffile
starcall.utils

 
Functions
       
call_dots(values)
detect_dots(image, min_sigma=1, max_sigma=2, num_sigma=7, return_sigmas=False, channels=None, copy=True)
Takes a raw sequencing image set and identifies and extracts all sequencing reads
from the image, filtering out cell background and debris. This is done by calling
dot_filter to filter out any background in the image, then calling highlight_dots
to create a single grayscale image, which is then passed to skimage.feature.blob_log.
The values at these positions in the filtered image are extracted, and returned along
with the positions.
 
Args:
    image (ndarray of shape (n_cycles, n_channels, width, height)): The input image
    min_sigma, max_sigma, num_sigma (float): Parameters passed to skimage.feature.blob_log
    return_sigmas (bool, default False): Whether to return the sigma values returned from skimage.feature.blob_log
    channels (tuple of str): The names of the sequencing channels in the image.
        Defaults to ('G', 'T', 'A', 'C'), but if your sequencing channels are in a different
        order make sure to specify it here.
    copy (bool default True): Whether the image should be copied or modified in place.
 
Returns:
    reads (DataFrame): The reads detected in the image, each with a position and read values.
        The columns in the table are:
            'position_x', 'position_y': the x and y position of the read colony
            'values_cycle{cycle}_{chan}': the values from the filtered sequencing images,
                for each cycle and channel. The names of the channels are specified
                in the parameter 'channels'
    if return_sigmas is specified:
    sigmas (ndarray of shape (n_dots,)): The estimated sigma of all dots detected in the image
detect_dots_debug(image, min_sigma=1, max_sigma=2, num_sigma=7, sigma_cutoff=1, return_sigmas=False, threshold_rel=None, median_index=None)
detect_dots_old(image, min_sigma=1, max_sigma=2, num_sigma=7, sigma_cutoff=1, return_sigmas=False, threshold_rel=None, median_index=None, copy=True)
dot_filter(image, major_axis=4, minor_axis=0.5, copy=True)
Filter that removes any background in the sequencing images,
leaving only the dots from sequencing colonies. This is done using
top hat filter, subtracting the morphological opening of the image from
itself. This leaves only features smaller than the footprint, whose size
is specified by the parameters major_axis and minor_axis. To further
amplify only features that are circular, a series of filters are applied
with ellipses at different angles.
 
Args:
    major_axis (float): the major axis of the ellipse used as a footprint
    minor_axis (float): the minor axis of the ellipse used as a footprint
    copy (bool default True): Whether the input image should be copied or modified in place
dot_filter2(image, small_radius=2, large_radius=4, copy=True)
dot_filter2_old(image, kernel_size=10)
dot_filter_new(image, large_sigma=4, copy=True)
Filter that removes any background in the sequencing images,
leaving only the dots from sequencing colonies. Done using a difference
of gaussian filter, specified by the parameter large_sigma.
 
Args:
    image (np.ndarray of shape (num_cycles, num_channels, width, height)
    large_sigma (float): the gaussian sigma that should be subtracted from the sequencing
        images.
    copy (bool default True): Whether the input image should be copied or modified in place
dot_filter_old(image, large_sigma=4, copy=True)
gaussian_kernel(radius, sigma)
highlight_dots(image, gaussian_blur=None)
Combine an image containing multiple sequencing cycles into a single
grayscale image, containing only the dots from sequencing colonies.
To filter for sequencing dots, we subtract the second maximal channel, then
take the standard deviation across cycles and sum along channels. This
means only features that are bright in a single channel and changing frequently
are conserved in the final image.
 
Args:
    image (ndarray of shape (num_cycles, num_channels, width, height)): Input image to filter
    gaussian_blur (float, optional): if specified a gaussian blur is applied before combining