GetModRatioByContig: GetModRatioByContig Function (GloModAn)

View source: R/GloModAn.R

GetModRatioByContigR Documentation

GetModRatioByContig Function (GloModAn)

Description

Return a list with the Modification ratio (Mod ratio) by strand for all scaffolds of genome assembly provided. For "b" as the base that can be modified, Mod ratio = Number of modified "b" / Total number of "b".

Usage

GetModRatioByContig(
  grangesModPos,
  gposModTargetBasePos,
  dnastringsetGenome,
  cBaseLetterForMod
)

Arguments

grangesModPos

A GRanges object containing Modifications Positions data.

gposModTargetBasePos

A GPos object containing Base Positions that can be targeted by the modification.

dnastringsetGenome

A DNAStringSet object containing the sequence for each contig.

cBaseLetterForMod

The name of the base letter of the modified base.

Examples

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

# Preparing a grangesPacBioGFF and gposPacBioCSV 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"]

# Mod report
myMod_ratio_list <- GetModRatioByContig(
  grangesModPos = myGrangesPacBioGFF,
  gposModTargetBasePos = myGposPacBioCSV,
  dnastringsetGenome = myGenome,
  cBaseLetterForMod = "A"
)
myMod_ratio_list

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