Functions

Input

GigaSOM.readFlowsetMethod
readFlowset(filenames)

Create a dictionary with filenames as keys and daFrame as values

Arguments:

  • filenames: Array of type string
source

Process

GigaSOM.cleanNames!Method
cleanNames!(mydata)

Replaces problematic characters in column names. Checks if the column name contains a '-' and transforms it to and '_' and it checks if the name starts with a number.

Arguments:

  • mydata: dict fcsRaw or array of string
source
GigaSOM.createDaFrameMethod
createDaFrame(fcsRaw, md, panel)

Creates a daFrame of type struct. Read in the fcs raw, add sample id, subset the columns and transform

Arguments:

  • fcsRaw: raw FCS data
  • md: Metadata table
  • panel: Panel table with a column for Lineage Markers and one for Functional Markers
  • method: transformation method, default arcsinh, optional
  • cofactor: Cofactor for transformation, default 5, optional
  • reduce: Selected only columns which are defined by lineage and functional, optional, default: true. If false the check for any none columns to be removed (none columns can appear after concatenating FCS files as well as parameter like: time, event length)
  • sort: Sort columns by name to make sure the order when concatinating the dataframes, optional, default: true
source
GigaSOM.getMarkersMethod
getMarkers(panel)

Returns the lineageMarkers and functionalMarkers on a given panel

Arguments:

  • panel: Panel table with a column for Lineage Markers and one for Functional Markers
source
GigaSOM.getMetaDataMethod
getMetaData(f)

Collect the meta data information in a more user friendly format.

Arguments:

  • f: input structure with .params and .data fields
source
GigaSOM.sortReduceMethod
sortReduce(df, cc, reduce, sort)

Sorts the columns and/or reduces them to sleected markers

Arguments:

  • df: FCS dataframe
  • cc: Columns to reduce to
  • reduce: Boolean
  • sort: Boolean
source
GigaSOM.transformDataMethod
transformData(flowframe, method, cofactor)

Tansforms FCS data. Currently only asinh

Arguments:

  • flowframe: Flowframe containing daFrame per sample
  • method: transformation method
  • cofactor: Cofactor for transformation
source

Core

GigaSOM.expRadiusFunction
expRadius(steepness::Float64)

Return a function to be used as a radiusFun of trainGigaSOM, which causes exponencial decay with the selected steepness.

Use: trainGigaSOM(..., radiusFun = expRadius(0.5))

Arguments

  • steepness: Steepness of exponential descent. Good values range from -100.0 (almost linear) to 100.0 (really quick decay).
source
GigaSOM.initGigaSOMFunction
    initGigaSOM(train, xdim, ydim = xdim;  norm = :none, toroidal = false)

Initialises a SOM.

Arguments:

  • train: training data
  • xdim, ydim: geometry of the SOM If DataFrame, the column names will be used as attribute names. Codebook vectors will be sampled from the training data.
  • norm: optional normalisation; one of :minmax, :zscore or :none
  • toroidal: optional flag; if true, the SOM is toroidal.
source
GigaSOM.linearRadiusMethod
linearRadius(initRadius::Float64, iteration::Int64, decay::String, epochs::Int64)

Return a neighbourhood radius. Use as the radiusFun parameter for trainGigaSOM.

Arguments

  • initRadius: Initial Radius
  • finalRadius: Final Radius
  • iteration: Training iteration
  • epochs: Total number of epochs
source
GigaSOM.mapToGigaSOMMethod
mapToGigaSOM(som::Som, data)

Return a DataFrame with X-, Y-indices and index of winner neuron for every row in data.

Arguments

  • som: a trained SOM
  • data: Array or DataFrame with training data.
  • knnTreeFun: Constructor of the KNN-tree (e.g. from NearestNeighbors package)
  • metric: Passed as metric argument to the KNN-tree constructor

Data must have the same number of dimensions as the training dataset and will be normalised with the same parameters.

source
GigaSOM.trainGigaSOMMethod
trainGigaSOM(som::Som, train::DataFrame, kernelFun = gaussianKernel,
                    r = 0.0, epochs = 10)

Arguments:

  • som: object of type Som with an initialised som
  • train: training data
  • kernel::function: optional distance kernel; one of (bubbleKernel, gaussianKernel) default is gaussianKernel
  • rStart: optional training radius. If r is not specified, it defaults to (xdim+ydim)/3
  • rFinal: target radius at the last epoch, defaults to 0.1
  • knnTreeFun: Constructor of the KNN-tree (e.g. from NearestNeighbors package)
  • metric: Passed as metric argument to the KNN-tree constructor
  • radiusFun: Function that generates radius decay, e.g. linearRadius or expRadius(10.0)
  • epochs: number of SOM training iterations (default 10)

Training data must be convertable to Array{Float34,2} with convert(). Training samples are row-wise; one sample per row. An alternative kernel function can be provided to modify the distance-dependent training. The function must fit to the signature fun(x, r) where x is an arbitrary distance and r is a parameter controlling the function and the return value is between 0.0 and 1.0.

source
GigaSOM.doEpochMethod
doEpoch(x::Array{Float64}, codes::Array{Float64}, tree)

vectors and the adjustment in radius after each epoch.

Arguments:

  • x: training Data
  • codes: Codebook
  • tree: knn-compatible tree built upon the codes
source
GigaSOM.scaleEpochTimeMethod
scaleEpochTime(iteration::Int64, epochs::Int64)

Convert iteration ID and epoch number to relative time in training.

source

Structs

GigaSOM.daFrameType
daFrame

Structure to hold FCS files.

Fields:

  • fcstable::Dict: Key: Filename, Value: FCS data table
  • md::DataFrame: Metadata containing the filenames, and experiment conditions
  • panel::DataFrame: defines which markers to use (lineage, functional)
source
GigaSOM.SomType
Som

Structure to hold all data of a trained SOM.

Fields:

  • codes::Array{Float64,2}: 2D-array of codebook vectors. One vector per row
  • colNames::Array{String,1}: names of the attribute with which the SOM is trained
  • normParams::DataFrame: normalisation parameters for each column of training data. Column headers corresponds with colNames.
  • norm::Symbol: normalisation type; one of :none, :minmax, :zscore
  • xdim::Int: number of neurons in x-direction
  • ydim::Int: number of neurons in y-direction
  • numCodes::Int: total number of neurons
  • grid::Array{Float64,2}: 2D-array of coordinates of neurons on the map (2 columns (x,y)] for rectangular and hexagonal maps 3 columns (x,y,z) for spherical maps)
  • indices::DataFrame: X-, Y-indices of the neurons
  • topol::Symbol: topology of the SOM; one of :rectangular, :hexagonal, :spherical
  • toroidal::Bool: if true, the SOM is toroidal (has no edges)
  • population::Array{Int,1}: 1D-array of numbers of training samples mapped to each neuron.
source

Satellites

GigaSOM.checkDirMethod
checkDir()

Checks if the pwd() is the /test directory, and if not it changes to it.

source
GigaSOM.convertTrainingDataMethod
convertTrainingData(data)::Array{Float64,2}

Converts the training data to an Array of type Float64.

Arguments:

  • data: Data to be converted
source
GigaSOM.distMatrixMethod
distMatrix(grid::Array, toroidal::Bool)::Array{Float64, 2}

Return the distance matrix for a non-toroidal or toroidal SOM.

Arguments

  • grid: coordinates of all neurons as generated by one of the grid-functions

with x-coordinates in 1st column and y-coordinates in 2nd column.

  • toroidal: true for a toroidal SOM.
source
GigaSOM.gaussianKernelMethod
gaussianKernel(x, r::Float64)

Return Gaussian(x) for μ=0.0 and σ = r/3. (a value of σ = r/3 makes the training results comparable between different kernels for same values of r).

Arguments

source
GigaSOM.gridRectangularMethod
gridRectangular(xdim, ydim)

Create coordinates of all neurons on a rectangular SOM.

The return-value is an array of size (Number-of-neurons, 2) with x- and y- coordinates of the neurons in the first and second column respectively. The distance between neighbours is 1.0. The point of origin is bottom-left. The first neuron sits at (0,0).

Arguments

  • xdim: number of neurons in x-direction
  • ydim: number of neurons in y-direction
source
GigaSOM.normTrainDataMethod
normTrainData(train::Array{Float64, 2}, norm::Symbol)

Normalise every column of training data.

Arguments

  • train: DataFrame with training Data
  • norm: type of normalisation; one of minmax, zscore, none
source

Visualisation