annotateWithScore: Annotation function for BSFDataSet object

View source: R/Functions.R

annotateWithScoreR Documentation

Annotation function for BSFDataSet object

Description

This function can be used to annotate a BSFDataSet object with merged binding sites with scores from the initial ranges (eg. PureCLIP scores).

Usage

annotateWithScore(
  object,
  match.ranges = NULL,
  match.score = "score",
  match.option = c("max", "sum", "mean"),
  scoreRanges = lifecycle::deprecated(),
  MatchColScore = lifecycle::deprecated(),
  quiet = FALSE
)

Arguments

object

a BSFDataSet object

match.ranges

a GRanges object, with numeric column for the score to match

match.score

character; meta column name of the crosslink site GenomicRanges object that holds the score to match

match.option

character; option how score should be matched

scoreRanges

deprecated -> use match.ranges instead

MatchColScore

deprecated -> use match.score instead

quiet

logical; whether to print messages

Details

The function is part of the standard workflow performed by BSFind.

Value

an object of class BSFDataSet with updated meta columns of the ranges

See Also

BSFind, globalScorePlot

Examples

if (.Platform$OS.type != "windows") {
    # load data
    csFile <- system.file("extdata", "PureCLIP_crosslink_sites_examples.bed",
                        package="BindingSiteFinder")
    cs = rtracklayer::import(con = csFile, format = "BED",
    extraCols=c("additionalScores" = "character"))
    cs$additionalScores = NULL
    clipFiles <- system.file("extdata", package="BindingSiteFinder")
    # two experimental conditions
    meta = data.frame(
    id = c(1,2,3,4),
    condition = factor(c("WT", "WT", "KD", "KD"),
    levels = c("KD", "WT")),
    clPlus = list.files(clipFiles, pattern = "plus.bw$", full.names = TRUE),
    clMinus = list.files(clipFiles, pattern = "minus.bw$",
     full.names = TRUE))
    bds = BSFDataSetFromBigWig(ranges = cs, meta = meta, silent = TRUE)

    # merge binding sites
    bds <- makeBindingSites(object = bds, bsSize = 9, minWidth = 2,
    minCrosslinks = 2, minClSites = 1)

    # annotate with original pureCLIP score
    bdsRe = annotateWithScore(bds, cs)
}

ZarnackGroup/BindingSiteFinder documentation built on May 31, 2024, 3:29 a.m.