preparerewiring: Prepare rewiring data for running the method.

View source: R/rewiring_preparerewiring.R

preparerewiringR Documentation

Prepare rewiring data for running the method.

Description

Prepare neccessary files for running runrewiring()

Usage

preparerewiring(
  name = "defaultname",
  linker_output = NULL,
  TraReObj = NULL,
  final_signif_thresh = 0.001,
  orig_test_perms = 100,
  retest_thresh = 0.08,
  retest_perms = 1000,
  low_var_genes_th = 0.25,
  outdir = tempdir(),
  nrcores = 3,
  last_cluster = FALSE
)

Arguments

name

Desired name of the folder which is generated. The chosen threshold will be paste() to the folder's name.

linker_output

linker output file.

TraReObj

TrareObj generated during preprocessing step.

final_signif_thresh

Significance threshold for the rewiring method. The lower the threshold, the restrictive the method.

orig_test_perms

Initial permutations for first test (default: 100) .

retest_thresh

Threshold if a second test is performed (default: 0.08) .

retest_perms

Permutations if a second test is performed (default: 1000) .

low_var_genes_th

Perform a filtering to drop out low variance (<th) genes across phenotype samples. Default: 0.25

outdir

Directory for the output folder to be located (default: tempdir())

nrcores

Number of cores to run the parallelization within the rewiring test (default: 3).

last_cluster

Boolean specifying whether to include the last_cluster in the rewiring or not. (default: FALSE)

Value

Return a list containing: LINKER's output, expression matrix, boolean array from phenotype file, array containing number of c(R,NR) samples, significance threshold and output directory.

Examples


## Load the linker output
linker_output <- readRDS(paste0(system.file('extdata',package='TraRe'),
                                 '/linker_rewiring_example.rds'))

## Load the phenotype file
phenotype_p <- paste0(system.file('extdata',package='TraRe'),
                     '/phenotype_rewiring_example.txt')
phenotype <- read.delim(phenotype_p, row.names = 1)
colnames(phenotype) <- 'phenotype'

## We will be using the same file we generated for the LINKER_run phase.
## TraReObj <- readRDS(paste0(system.file('extdata',package='TraRe'),'/TraReObj.rds'))

## Add the phenotype if it was not in the SummarizedExperiment when we did the preprocessing.
## TraReObj <- rewiring_add_phenotype(TraReObj, phenotype)

## outdir <- system.file('extdata',package='TraRe')
## prepared <- preparerewiring(name='example', linker_output= linker_output,
##                            TraReObj = TraReObj, 
##                            final_signif_thresh=0.05,
##                            nrcores=1,outdir=outdir)


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