DrawModBaseCountsWithinFeature: DrawModBaseCountsWithinFeature Function (ModAnnot)

View source: R/ModAnnot.R

DrawModBaseCountsWithinFeatureR Documentation

DrawModBaseCountsWithinFeature Function (ModAnnot)

Description

Return a plot describing the proportion of the base modified (Mod) and the base letter of the modified base (Base) between windows (of relative size) of feature provided. Example: for Mod="6mA", Base="A"; for Mod="5mC", Base="C".

Usage

DrawModBaseCountsWithinFeature(
  grangesAnnotationsWithCountsByWindow,
  cFeatureName,
  cBaseMotif,
  cModMotif
)

Arguments

grangesAnnotationsWithCountsByWindow

A GRanges object containing feature annotation with the counts:

  • Modcount: The number of "Mod" within this window of this feature.

  • ModcountSum: Total number of "Mod" within all windows of this feature.

  • Modprop: (Modcount / ModcountSum)*100

  • Basecount: The number of "Base" within this window of this feature.

  • BasecountSum: Total number of "Base" within all windows of this feature.

  • Baseprop: (Basecount/BasecountSum)*100

The Genomic features categories must be in a column named "type".

cFeatureName

Name of the feature (which is cut into windows) to be displayed.

cBaseMotif

The name of the motif with the base letter of the modified base.

cModMotif

The name of the motif with the modification in the output.

Examples

# loading genome
myGenome <- Biostrings::readDNAStringSet(system.file(
  package = "DNAModAnnot", "extdata",
  "ptetraurelia_mac_51_sca171819.fa"
))

# loading annotation
library(rtracklayer)
myAnnotations <- readGFFAsGRanges(system.file(
  package = "DNAModAnnot", "extdata",
  "ptetraurelia_mac_51_annotation_v2.0_sca171819.gff3"
))

# Preparing a grangesPacBioGFF and a grangesPacBioCSV datasets
myGrangesPacBioGFF <-
  ImportPacBioGFF(
    cPacBioGFFPath = system.file(
      package = "DNAModAnnot", "extdata",
      "ptetraurelia.modifications.sca171819.gff"
    ),
    cNameModToExtract = "m6A",
    cModNameInOutput = "6mA",
    cContigToBeAnalyzed = names(myGenome)
  )
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)
  )
myGposPacBioCSV <- myGposPacBioCSV[myGposPacBioCSV$base == "A"]

# Retrieve annotations with "Mod" and "Base" counts (and counts per kbp)
myAnn_ModBase_counts_by_window <-
  GetModBaseCountsWithinFeature(
    grangesAnnotations = myAnnotations[myAnnotations$type == "gene", ],
    grangesModPos = myGrangesPacBioGFF,
    gposModTargetBasePos = myGposPacBioCSV,
    nWindowsNb = 20
  )

DrawModBaseCountsWithinFeature(myAnn_ModBase_counts_by_window,
  cFeatureName = "gene",
  cBaseMotif = "A",
  cModMotif = "6mA"
)

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