DrawFdrEstList: DrawFdrEstList Function (FDREst)

View source: R/FDREst.R

DrawFdrEstListR Documentation

DrawFdrEstList Function (FDREst)

Description

Return a plot describing the false discovery rate estimations by threshold on the parameter provided for each dataframe in the list provided.

Usage

DrawFdrEstList(
  listFdrEstByThr,
  cNameParamToTest,
  nFdrPropForFilt = 0.05,
  lAdjustFdr = TRUE
)

Arguments

listFdrEstByThr

A list composed of x dataframes. In each dataframe:

  • fdr: The false discovery rate estimated for this threshold.

  • threshold: The threshold on the parameter.

  • fdr_cummin: The minimum false discovery rate estimated for this threshold and less stringent thresholds (adjusted false discovery rate).

cNameParamToTest

The name of the column containing the parameter to be tested.

nFdrPropForFilt

A number indicating the false discovery rate to be used for filtering: this will allow to choose the closest threshold below this number and represent it on the plot. Defaults to 0.05 (so fdr of 5%).

lAdjustFdr

If TRUE, display fdr_cummin (adjusted false discovery rate) instead of fdr column. Defaults to TRUE.

Examples

myGenome <- Biostrings::readDNAStringSet(system.file(
  package = "DNAModAnnot", "extdata",
  "ptetraurelia_mac_51_sca171819.fa"
))
myGrangesGenome <- GetGenomeGRanges(myGenome)

# Preparing a gposPacBioCSV dataset with sequences
myGposPacBioCSV <-
  ImportPacBioCSV(
    cPacBioCSVPath = system.file(
      package = "DNAModAnnot", "extdata",
      "ptetraurelia.bases.sca171819.csv"
    ),
    cSelectColumnsToExtract = c(
      "refName", "tpl", "strand", "base", "score",
      "ipdRatio", "coverage"
    ),
    lKeepExtraColumnsInGPos = TRUE, lSortGPos = TRUE,
    cContigToBeAnalyzed = names(myGenome)
  )
myGrangesBaseCSV <- as(myGposPacBioCSV[myGposPacBioCSV$base == "A"], "GRanges")
myGrangesBaseCSVWithSeq <- GetGRangesWindowSeqandParam(
  grangesData = myGrangesBaseCSV,
  grangesGenome = myGrangesGenome,
  dnastringsetGenome = myGenome,
  nUpstreamBpToAdd = 0,
  nDownstreamBpToAdd = 1
)

# FDR estimation by motif associated to modifications
myFdr_score_per_motif_list <-
  GetFdrEstListByThresh(
    grangesDataWithSeq = myGrangesBaseCSVWithSeq,
    cNameParamToTest = "score",
    nRoundDigits = 1,
    cModMotifsAsForeground = c("AG", "AT")
  )

DrawFdrEstList(
  listFdrEstByThr = myFdr_score_per_motif_list,
  cNameParamToTest = "score",
  nFdrPropForFilt = 0.05
)

AlexisHardy/DNAModAnnot documentation built on Feb. 27, 2023, 12:03 a.m.