API Reference

Setting Parameters

To set parameters, use a DecodeParams object

SeqFISHSyndromeDecoding.DecodeParamsType
DecodeParams()

Constructor for DecodeParams object that sets default values for every parameter. Cost function parameters must be set by the user. If they are not, the decoding functions will throw an error.

source

Required parameters

Users are required to set the some parameters for decoding using the following methods:

SeqFISHSyndromeDecoding.set_n_allowed_dropsFunction
set_n_allowed_drops(prms :: DecodeParams, d :: Integer)

Arguments

  • prms: DecodeParams Object
  • r: The number of allowed drops in a barcode. Only 0 and 1 are currently supported. The parity check matrix must have redundancy to support correcting for one drop, otherwise errors will occur.
source

Parameters with default values

The rest of the parameters are given a default value by the DecodeParams Constructor, but may be set using the following methods:

SeqFISHSyndromeDecoding.set_zeros_probedFunction
set_zeros_probed(prms :: DecodeParams, zp :: Bool)

Arguments

  • prms: DecodeParams Object
  • zp: Whether or not zeros in codewords are probed in the experiment. Drops are not supported when false.
source
SeqFISHSyndromeDecoding.set_erasure_penaltyFunction
set_erasure_penalty(prms :: DecodeParams, ep :: Real)

The penalty that each dot dropped from a barcode adds to the cost function of the corrected barcode is ep. For example a barcode with one drop adds 1*ep to the cost of the barcode.

Arguments

  • prms: DecodeParams Object
  • ep: penalty for decoding a barcode with a dropped dot
source
SeqFISHSyndromeDecoding.set_skip_threshFunction
set_skip_thresh(prms :: DecodeParams, st :: Integer)

Arguments

  • prms: DecodeParams Object
  • st: conflicting networks of barcode candidates containing more barcode candidates than this threshold will be discarded.
source
SeqFISHSyndromeDecoding.set_skip_density_threshFunction
set_skip_density_thresh(prms :: DecodeParams, sdt :: Real)

Arguments:

  • prms: DecodeParams Object
  • sdt: conflicting networks of barcode candidates that have a higher ratio of candidate barcodes to area of their bounding box in pixels than this threshold will be discarded.
source

Running Decoding

SeqFISHSyndromeDecoding.get_codepathsFunction
get_codepaths(pnts :: DataFrame, cb_df :: DataFrame, H :: Matrix, params :: DecodeParams)

Arguments

  • pnts: DataFrame of seqFISH psfs. Must include columns:

    • x : x spatial coordinate of psfs
    • y : y spatial coordinate of psfs
    • z : z spatial coordinate of psfs
    • s : the sigma width parameter of the psfs
    • w : the weight (or brightness) of the psfs

    Additionally, there the data frame must either have columns

    • block : the barcoding block in which the psf was found
    • pseudocolor : the pseudocolor of the barcoding block in which the psf was found

    or the block and pseudocolor can be computed from the hybridization

    • hyb : the hybridization in which the dot was found

    where block = ceil(hyb / q), pseudocolor = (hyb - (block - 1) * q) % q, and q is the number of pseudocolors.

  • cb : The codebook.

  • H : The parity check Matrix

  • params : DecodeParams object holding the parameters for decoding

Computes codepaths with syndrome decoding, removes codepaths that exceed the cost of not decoding their component dots, and and returns DataFrame of candidate codepaths.

source
get_codepaths(pnts :: DataFrame, cb :: Matrix, H :: Matrix, params :: DecodeParams)

Computes codepaths with syndrome decoding, removes codepaths that exceed the cost of not decoding their component dots, and returns DataFrame of candidate codepaths.

Arguments

  • pnts: DataFrame of seqFISH psfs. Must include columns:
    • x : x spatial coordinate of psfs
    • y : y spatial coordinate of psfs
    • z : z spatial coordinate of psfs
    • s : the sigma width parameter of the psfs
    • w : the weight (or brightness) of the psfs
  • cb : The codebook.
  • H : The parity check Matrix
  • params : DecodeParams object holding the parameters for decoding
source
SeqFISHSyndromeDecoding.choose_optimal_codepathsFunction
choose_optimal_codepaths(pnts :: DataFrame, cb_df :: DataFrame, H :: Matrix, params :: DecodeParams, cpath_df :: DataFrame, optimzer, ret_discarded :: Bool=false)

Arguments

  • pnts: DataFrame of seqFISH psfs. Must include columns:
    • x : x spatial coordinate of psfs
    • y : y spatial coordinate of psfs
    • z : z spatial coordinate of psfs
    • s : the sigma width parameter of the psfs
    • w : the weight (or brightness) of the psfs
    Additionally, there the data frame must either have columns
    • block : the barcoding block in which the psf was found
    • pseudocolor : the pseudocolor of the barcoding block in which the psf was found
    or the block and pseudocolor can be computed from the hybridization
    • hyb : the hybridization in which the dot was found
    where block = ceil(hyb / q), pseudocolor = (hyb - (block - 1) * q) % q, and q is the number of pseudocolors.
  • cb : The codebook.
  • H : The parity check Matrix
  • params : DecodeParams object holding the parameters for decoding
  • cpath_df : A DataFrame output from the get_codepaths function, defined above.
  • optimizer : solver for integer linear programming optimizations. A list of supported solvers is available here
  • ret_discarded : if true, return data frame of candidate codepaths that were discarded for being in too large/too dense of a conflict network

Returns

  • DataFrame of decoded barcodes
  • If ret_discarded == True, returns second DataFrame of the codepaths discarded to density filters

Choose best codepaths from previouly found candidates that may have been found with less strict parameters. Reevaluates the costs for each candidate and trims according to the passed parameters.

source
SeqFISHSyndromeDecoding.decode_syndromes!Function
decode_syndromes!(
    pnts :: DataFrame,
    cb,
    H :: Matrix,
    params :: DecodeParams
    optimizer = GLPK.Optimizer
)

Arguments

  • pnts: DataFrame of seqFISH psfs. Must include columns:

    • x : x spatial coordinate of psfs
    • y : y spatial coordinate of psfs
    • z : z spatial coordinate of psfs
    • s : the sigma width parameter of the psfs
    • w : the weight (or brightness) of the psfs

    Additionally, there the data frame must either have columns

    • block : the barcoding block in which the psf was found
    • pseudocolor : the pseudocolor of the barcoding block in which the psf was found

    or the block and pseudocolor can be computed from the hybridization

    • hyb : the hybridization in which the dot was found

    where block = ceil(hyb / q), pseudocolor = (hyb - (block - 1) * q) % q, and q is the number of pseudocolors.

  • cb : The codebook.

  • H : The parity check Matrix

  • params : DecodeParams object holding the parameters for decoding

  • optimizer : solver for integer linear programming optimizations. Uses the open source GLPK optimizer by default, but allows faster commercial optimizers to be used if necessary.

A list of supported solvers is available here

Takes a DataFrame of aligned points with hyb, x, y, z, w, and s columns; codebook matix; parity check matrix (H); and DecodeParams stucture with decoding parameters set. Adds columns to input pnts matrix indicating the encoding block, syndrome component value, and decoding result indicated as the row of the codebook matrix matched to. Split up points into weakly connected components, then finds possible codeword messages and runs simulated annealing to assign them. The pnts dataframe should have hybridization, x, y, and z columns

source