LINKER_runPhase1: Phase I : module generation

View source: R/linker_runphaseone.R

LINKER_runPhase1R Documentation

Phase I : module generation

Description

Run first phase of the linker method where K modules of similarly expressed target genes and relate them to a linear combination of very few regulators, according to the selected model. LINKER_init() evaluate kmeans on a train set to generate a initial set of clusters containing drivers and target genes. LINKER_ReassignGenesToClusters() reassigning genes based on closed match to new regulatory programs. This functions are run inside the LINKER_run function, so it is not recommended to run it on its own. LINKER_corrClust() go through two steps within a loop, learning regulatory program of modules and reassigning genes. LINKER_extract_modules() extracts all the modules, genes and relevant information. LINKER_EvaluateTestSet() fits the selected model with the test data. LINKER_LearnRegulatoryPrograms() learns the regulatory program of the modules.

Usage

LINKER_runPhase1(
  lognorm_est_counts,
  target_filtered_idx,
  regulator_filtered_idx,
  nassay = 1,
  regulator = "regulator",
  NrModules,
  Lambda = 5,
  alpha = 1 - 1e-06,
  pmax = 10,
  train_size = 0.8,
  mode = "VBSR",
  used_method = "MEAN",
  corrClustNrIter = 100,
  Nr_bootstraps = 1,
  FDR = 0.05,
  only_train = FALSE
)

LINKER_init(
  MA_matrix_Var,
  RegulatorData,
  NrModules,
  corrClustNrIter = 21,
  Parameters,
  FDR
)

LINKER_ReassignGenesToClusters(Data, RegulatorData, Beta, Clusters)

LINKER_corrClust(LINKERinit)

LINKER_extract_modules(results)

LINKER_EvaluateTestSet(
  LINKERresults,
  MA_Data_TestSet,
  RegulatorData_TestSet,
  used_method = "MEAN"
)

LINKER_LearnRegulatoryPrograms(
  Data,
  Clusters,
  RegulatorData,
  Lambda,
  alpha,
  pmax,
  mode,
  used_method = "MEAN",
  FDR
)

Arguments

lognorm_est_counts

Matrix of log-normalized estimated counts of the gene expression data (Nr Genes x Nr samples)

target_filtered_idx

Index array of the target genes on the lognorm_est_counts matrix if SummarizedExperiment object is not provided.

regulator_filtered_idx

Index array of the regulatory genes on the lognorm_est_counts matrix if SummarizedExperiment object is not provided.

nassay

if SummarizedExperiment object is passed as input to lognorm_est_counts, name of the assay containing the desired matrix. Default: 1 (first item in assay's list).

regulator

if SummarizedExperiment object is passed as input to lognorm_est_counts, name of the rowData() variable to build target_filtered_idx and regulator_filtered_idx. This variable must be one for driver genes and zero for target genes. Default: 'regulator'

NrModules

Number of modules that are a priori to be found (note that the final number of modules discovered may differ from this value). By default, 100 modules.

Lambda

Lambda variable for Lasso models.

alpha

Alpha variable for Lasso models.

pmax

Maximum numbers of regulators that we want.

train_size

Fraction of samples selected for the train samples. Default: 0.8.

mode

Chosen method(s) to link module eigengenes to regulators. The available options are 'VBSR', 'LASSOmin', 'LASSO1se', 'LASSOparam' and 'LM'. Default set to 'VBSR'

used_method

Method selected for use. Default set to MEAN.

corrClustNrIter

Number of iteration for the phase I part of the method.

Nr_bootstraps

Number of bootstrap of Phase I. By default, 1.

FDR

The False Discovery Rate correction used for the modules and graphs GRN uncovering. By default, 0.05.

only_train

whether to use only training samples within LINKER run. Default: FALSE

MA_matrix_Var

Matrix of log-normalized estimated counts of the gene expression data, centered and scaled, containing only the train samples.

RegulatorData

Expression matrix containing only the regulators of the train samples.

Parameters

List of parameters containig lambda, pmax, alpha, mode and used method.

Data

Matrix of log-normalized estimated counts of the gene expression data, centered and scaled, containing only the train samples.

Beta

Coefficient on which the decision of reassigning genes is based.

Clusters

Clusters generated from the linkerinit function.

LINKERinit

Initialization object obtained from LINKER_init().

results

Matrix of log-normalized estimated counts of the gene expression data (Nr Genes x Nr samples).

LINKERresults

List containing the number of clusters, regulatoryprogram, name of regulators and all genes and module membership.

MA_Data_TestSet

Matrix of log-normalized estimated counts of the gene expression data, centered and scaled, containing only the test samples.

RegulatorData_TestSet

Expression matrix containing only the regulators of the test samples.

Value

list object containing the modules generated with the selected parameters and the stats associated to them.

Examples


   ## This example is very similar to the `LINKER_run()` function.
   ## Again, we are going to load the expression matrix dataset
   lognorm_est_counts_p <- paste0(system.file('extdata', package='TraRe'),
                                 '/expression_rewiring_example.txt')
   lognorm_est_counts <- as.matrix(read.delim(lognorm_est_counts_p,
                                         header=TRUE,row.names=1))
                                         
   ## Load gene info, its an array of regulators' names.
   gene_info_p <- paste0(system.file('extdata',package='TraRe'),
                                '/geneinfo_rewiring_example.txt')
   gene_info <- read.delim(gene_info_p,header=TRUE)
   regulators <- gene_info[gene_info[,'regulator'] == 1,'uniq_isos']
  
   regulator_filtered_idx <- which(rownames(lognorm_est_counts)%in%regulators)
   target_filtered_idx <- which(!rownames(lognorm_est_counts)%in%regulators)

   ## We recommend to use the default values of the function.
   ## For the sake of time, we will select faster (and worse) ones.

   linkerphase1 <- TraRe::LINKER_runPhase1(lognorm_est_counts,
                                    target_filtered_idx=target_filtered_idx,
                                    regulator_filtered_idx=regulator_filtered_idx, 
                                    NrModules=10,mode='LASSOmin',used_method = "MEAN",
                                    corrClustNrIter=10,Nr_bootstraps=1)
 #  saveRDS(linkerphase1,paste0(system.file('extdata',package='TraRe'), 
 #  '/linker_phase_one.example.rds'))


ubioinformat/TraRe documentation built on March 10, 2024, 1:11 a.m.