CreateOutputDF: Create output data in the format of data frame.

View source: R/util_CreateOutputDF.R

CreateOutputDFR Documentation

Create output data in the format of data frame.

Description

Output all the contiguous co-edited subregions found by FindCorrelatedRegions function and filtered by GetMinPairwiseCor function.

Usage

CreateOutputDF(
  keepSites_df,
  keepContiguousSites_df,
  keepminPairwiseCor_df,
  returnAllSites = FALSE,
  verbose = TRUE
)

Arguments

keepSites_df

An output data frame from function MarkCoeditedSites, with variables site, keep, ind, r_drop. Please see MarkCoeditedSites for details.

keepContiguousSites_df

An output data frame from function FindCorrelatedRegions with variables site, subregion. Please see FindCorrelatedRegions for details.

keepminPairwiseCor_df

An output data frame from function GetMinPairwiseCor with variables subregion, keepminPairwiseCor and minPairwiseCor. Please see GetMinPairwiseCor for details.

returnAllSites

When no contiguous co-edited regions are found in a input genomic region, returnAllSites = TRUE indicates outputting all the sites in this input region, while returnAllSites = FALSE indicates not returning any site in this input region. Defaults to FALSE.

verbose

Should messages and warnings be displayed? Defaults to TRUE.

Value

A data frame with following columns:

  • site : site ID.

  • chr : chromosome number.

  • pos : genomic location.

  • r_drop : the correlation between RNA editing levels of one site and the mean RNA editing levels of the rest of the sites.

  • keep : indicator for co-edited sites, The sites with keep = 1 belong to the contiguous and co-edited region.

  • keep_contiguous : contiguous co-edited region number.

  • regionMinPairwiseCor : the minimum pairwise correlation between sites within a sub-region.

  • keep_regionMinPairwiseCor : indicator for contiguous co-edited subregions, The regions with keepminPairwiseCor = 1 are the ones that passed regionMinPairwiseCor filter and will be returned as a contiguous co-edited sub-region.

Examples

  data(t_rnaedit_df)
  
  ordered_cols <- OrderSitesByLocation(
    sites_char = colnames(t_rnaedit_df),
    output = "vector"
  )
  exm_data <- t_rnaedit_df[, ordered_cols]
  
  exm_sites <- MarkCoeditedSites(
    rnaEditCluster_mat = exm_data,
    method = "spearman"
  )
  
  exm_regions <- FindCorrelatedRegions(
    sites_df = exm_sites,
    featureType = "site"
  )
  
  exm_probes <- split(
    x = exm_regions$site,
    f = exm_regions$subregion
  )
  
  exm_cor <- GetMinPairwiseCor(
    rnaEditCluster_mat = exm_data,
    minPairCorr = 0.1,
    probes_ls = exm_probes,
    method = "spearman"
  )
  
  CreateOutputDF(
    keepSites_df = exm_sites,
    keepContiguousSites_df = exm_regions,
    keepminPairwiseCor_df = exm_cor$keepminPairwiseCor_df
  )
   

TransBioInfoLab/rnaEditr documentation built on Nov. 29, 2022, 3:31 p.m.