create_centroids {GSgalgoR} | R Documentation

## Create Centroids

### Description

This functions create the signature centroids estimated from the GalgoR output and the expression matrix of the training sets.

### Usage

    create_centroids (output, solution_names, trainset,
    distancetype = "pearson")

### Arguments

`output` | @param output An object of class `galgo.Obj`
`solution_names` | A `character` vector with the names of the solutions for which the centroids are to be calculated
`trainset` | a `matrix` or `data.frame`. Must be an expression matrix with features in rows and samples in columns
`distancetype` | a `character` that can be either `'pearson'`, `'uncentered'`, `'spearman'` or `'euclidean'`

### Value

Returns a list with the centroid matrix for each of the solutions in `solution_names`, where each column represents the prototypic centroid of a subtype and each row the constituents features of the solution signature

### Examples

    # load example dataset
    library(breastCancerTRANSBIG)
    data(transbig)
    Train <- transbig
    rm(transbig)

    expression <- Biobase::exprs(Train)
    clinical <- Biobase::pData(Train)
    OS <- survival::Surv(time = clinical$t.rfs, event = clinical$e.rfs)

    # We will use a reduced dataset for the example
    expression <- expression[sample(1:nrow(expression), 100), ]

    # Now we scale the expression matrix
    expression <- t(scale(t(expression)))

    # Run galgo
    output <- GSgalgoR::galgo(generations = 5, population = 15,
    prob_matrix = expression, OS = OS)
    outputDF <- to_dataframe(output)
    outputList <- to_list(output)

    RESULTS <- non_dominated_summary(
        output = output, OS = OS,
        prob_matrix = expression,
        distancetype = "pearson"
    )
    CentroidsList <- create_centroids(output, RESULTS$solution,
    trainset = expression)

[Package GSgalgoR version 1.4.0 Index]