Calculates the signature model with AutoGeneS. This function can be used in case that the signature should be examined. The final signature is stored as a pickle file.

build_model_autogenes(
  single_cell_object,
  cell_type_annotations,
  bulk_gene_expression = NULL,
  ngen = 5000,
  mode = c("fixed", "standard"),
  nfeatures = 500,
  weights = list(-1, 1),
  objectives = list("correlation", "distance"),
  seed = 0,
  population_size = 100,
  offspring_size = 100,
  crossover_pb = 0.7,
  mutation_pb = 0.3,
  mutate_flip_pb = 0.001,
  crossover_thres = 1000,
  ind_standard_pb = 0.1,
  plot_weights = NULL,
  plot_objectives = c(0, 1),
  index = NULL,
  close_to = NULL,
  plot = FALSE,
  output_dir = tempdir(),
  verbose = FALSE
)

Arguments

single_cell_object

A matrix with the single-cell data. Rows are genes, columns are samples. Row and column names need to be set.

cell_type_annotations

A vector of the cell type annotations. Has to be in the same order as the samples in single_cell_object.

bulk_gene_expression

OPTIONAL: A matrix of bulk data. Rows are genes, columns are samples. Row and column names need to be set. If the bulk data is supplied, the single cell object loses all gene rows not contained in the bulk data as not to create solution sets with them.

ngen

Number of generations. The higher, the longer it takes.

mode

In standard mode, the number of genes of a selection is allowed to vary arbitrarily. In fixed mode, the number of selected genes is fixed (using nfeatures).

nfeatures

Number of genes to be selected in fixed mode.

weights

Weights applied to the objectives. For the optimization, only the sign is relevant: 1 means to maximize the respective objective, -1 to minimize it and 0 means to ignore it. The weight supplied here will be the default weight for selection. There must be as many weights as there are objectives.

objectives

The objectives to maximize or minimize. Must have the same length as weights. The default objectives (correlation, distance) can be referred to using strings. For custom objectives, a function has to be passed.

seed

Seed for random number generators.

population_size

Size of every generation (mu parameter).

offspring_size

Number of individuals created in every generation (lambda parameter).

crossover_pb

Crossover probability.

mutation_pb

Mutation probability.

mutate_flip_pb

Mutation flipping probability (fixed mode).

crossover_thres

Crossover threshold (standard mode).

ind_standard_pb

Probability used to generate initial population in standard mode.

plot_weights

Plotting: Weights with which to weight the objective values. For example, (-1,2) will minimize the first objective and maximize the the second (with higher weight).

plot_objectives

Plotting: The objectives to be plotted. Contains indices of objectives. The first index refers to the objective that is plotted on the x-axis. For example, (2,1) will plot the third objective on the x-axis and the second on the y-axis.

index

Plotting: If one int is passed, return pareto[index] If two ints are passed, the first is an objective (0 for the first). The second is the nth element if the solutions have been sorted by the objective in ascending order. For example, (0,1) will return the solution that has the second-lowest value in the first objective. (1,-1) will return the solution with the highest value in the second objective.

close_to

Plotting: Select the solution whose objective value is closest to a certain value. Assumes (objective,value). For example, (0,100) will select the solution whose value for the first objective is closest to 100.

plot

Whether to produce a plot at all. This just hands over the reticulate plot and has some visualization problems. To get a normal plot, use the pickle file, open it in python and use the plot method there.

output_dir

path to directory where the picke output file will be saved. Default is tempdir().

verbose

Whether to produce an output on the console.

Value

The path to the pickle file needed for the deconvolution with AutoGeneS.