Reference API
Documentation for Sainsc.jl
's public interface.
Index
Sainsc.GridCount.AbstractGridCounts
Sainsc.GridCount.GridCounts
Sainsc.GridCount.GridCounts
Sainsc.GridCount.GridCounts
Sainsc.GridCount.GridCounts
Sainsc.GridCount.crop!
Sainsc.GridCount.gridsize
Sainsc.GridCount.mask!
Sainsc.GridCount.totalrna
Sainsc.IO.readGEMfile
Sainsc.IO.readstereoseq
Sainsc.IO.readstereoseqbinned
Sainsc.KDE.assigncelltype
Sainsc.KDE.gaussiankernel
Sainsc.KDE.kde
Sainsc.LocalMax.findlocalmaxima
Sainsc.LocalMax.getlocalmaxima
API
Sainsc.GridCount.AbstractGridCounts
— TypeAbstractGridCounts
A stack of genes each consisting of a 2D count array of the same size.
Sainsc.GridCount.GridCounts
— TypeGridCounts{G,T<:Number} <: AbstractGridCounts
A stack of genes::G
each consisting of a 2D count::T
array of the same size.
Sainsc.GridCount.GridCounts
— MethodGridCounts(df::DataFrame, binsize::Real)
Construct from a DataFrame with columns 'x' (Real
), 'y' (Real
), 'count', and 'geneID' (Pool
) binning the data by binsize
.
Sainsc.GridCount.GridCounts
— MethodGridCounts(df::DataFrame)
Construct from a DataFrame with columns 'x' (Integer
), 'y' (Integer
), 'count', and 'geneID' (Pool
).
Sainsc.GridCount.GridCounts
— MethodGridCounts(counts::Dict)
All values of the dict must be arrays of the same size.
Sainsc.GridCount.crop!
— Methodcrop!(counts, slice)
Crop each gene layer in counts by indexing with slice
.
Sainsc.GridCount.gridsize
— Methodgridsize(counts)
The size of the grid of each layer.
Sainsc.GridCount.mask!
— Methodmask!(counts, mask::AbstractMatrix{Bool})
Remove all counts in each gene layer for which mask
is false
.
Sainsc.GridCount.totalrna
— Methodtotalrna(counts)
Caclulate the totalrna as sum of all genes for each pixel.
Sainsc.IO.readGEMfile
— MethodreadGEMfile(file)
Read file
in GEM format as DataFrames.DataFrame
.
Sainsc.IO.readstereoseq
— Methodreadstereoseq(file)
Read StereoSeq file
as GridCounts
.
Sainsc.IO.readstereoseqbinned
— Methodreadstereoseqbinned(file, binsize::Integer) -> (counts, genes, bins)
Read StereoSeq file
and aggregate into bins.
Sainsc.KDE.assigncelltype
— Methodassigncelltype(counts, signatures, kernel; celltypes=nothing, log=false) -> (celltypes, cosine)
Assign a celltype to each pixel.
The cosine similarity is calculated using signatures
to assign the celltype with the highest similarity to each pixel.
The eltype(kernel)
will be used for calculations and signatures
will be cast to it.
Arguments
signatures::AbstractDataFrame
: celltype signatures (celltypes x genes).celltypes::Vector{AbstractString}=nothing
: optional celltype names.log::Bool
: whether to log-transform the KDE. Useful ifsignatures
are calculated from log-transformed gene expression.
Sainsc.KDE.gaussiankernel
— Methodgaussiankernel(bw::Real, r::Real)
Generate a gaussian kernel with bandwidth bw
and radius r * bw
Sainsc.KDE.kde
— Methodkde(counts, kernel)
Calculate kernel density estimate.
Arguments
kernel
: usually a centeredOffsetArrays.OffsetArray
.
Sainsc.LocalMax.findlocalmaxima
— Methodfindlocalmaxima(img, mindist::Integer; threshold::Real=0)
Find local maxima of the img
.
Sainsc.LocalMax.getlocalmaxima
— Methodgetlocalmaxima(counts, localmax, kernel; genes=nothing) -> (expression, genes, coordinates)
Load KDE with kernel
for coordinates at localmax
.
Arguments
localmax
: vector of locations (indices).genes=nothing
: vector of genes for which to calculate KDE. Ifnothing
all genes are used.