SaveGeneLevelFiles: Save a file for each gene containing all information...

View source: R/utility_functions.R

SaveGeneLevelFilesR Documentation

Save a file for each gene containing all information necessary to run CompDTUReg

Description

Save a file for each gene containing all information necessary to run CompDTUReg

Usage

SaveGeneLevelFiles(
  directory,
  GeneLevelFilesSaveDir,
  curr_part_num,
  useInferentialReplicates = TRUE,
  GibbsSamps,
  CLE = TRUE,
  CLEParam = 0.05
)

Arguments

directory

is the directory where previous datasets are saved by sumToGene and DRIMSeqFilter

GeneLevelFilesSaveDir

is the directory the gene level files will be saved to

curr_part_num

if the current part number to save results for. See SaveFullinfRepDat for more details.

useInferentialReplicates

is set to TRUE if inferential replicates are to be used in the analysis and FALSE otherwise. If useInferentialReplicates if set to FALSE the gene-level files will only contain data corresponding to the point estimates (output as Y) and if it is TRUE the gene-level files will also contain data corresponding to the inferential replicates (output as YInfRep) If FALSE the argument GibbsSamps is ignored.

GibbsSamps

is TRUE if the inferential replicates are Gibbs samples and FALSE if the replicates are bootstrap samples

CLE

is TRUE if the CorrectLowExpression procedure is to be used to correct low expression and FALSE if not. Should be the same value in both SaveWithinSubjCovMatrices and SaveGeneLevelFiles.

CLEParam

is the parameter (betwen 0 and 1) that controls the correction threshold (see details of CorrectLowExpression for more information)

Details

See the file (3)SaveNecessaryDatasetsForCompDTUReg.R in the package's SampleCode folder for example code.

Value

The function saves gene-level .RData files within the subdirectory GeneLevelFilesSaveDir of save_dir that contain all necessary information to run a CompDTUReg analysis, including inferential replicates (if any). The name of each file is the name of the current gene. Specifically, these files contain:
(1) key, which contains the sample names (in the Sample column), condition information (in the Condition column), and an identifier in the form of Sample1, Sample2, Sample3, etc
(2) genename, the name of the current gene (that will be the name of the outputted file as well)
(3) Group, which is a factor of the condition information specified in the Condition column of key
(4) samps, the identifiers of the sample (Sample1, Sample2, Sample3, etc) contained within key$Sample
(5) Y, the ilr-transformed matrix of response values (ie the ilr coordinates) corresponding to the point estimates for all samples for the current gene for use with CompDTU.
(6) YInfRep, the ilr-transformed matrix of response values (ie the ilr coordinates) corresponding to all inferential replicates for all samples for the current gene for use with CompDTUme.
Will be in the order Sample1InfRep1, Sample2InfRep1, Sample3InfRep1, etc and will only be output if useInferentialReplicates is TRUE.
(7) mean.withinhat The overall within-sample covariance matrix (that is the mean of each sample's witin-subject covariance matrix) used to correct the total covariance in the CompDTUme method. Only output if useInferentialReplicates is TRUE.


skvanburen/CompDTUReg documentation built on Jan. 23, 2025, 9:01 a.m.