Learn R Programming

PWMEnrich (version 4.8.2)

PWMUnscaled: Create a PWM from PFM

Description

The PWM function from Biostrings without unit scaling

Usage

PWMUnscaled(x, id = "", name = "", type = c("log2probratio", "prob"), prior.params = c(A = 0.25, C = 0.25, G = 0.25, T = 0.25), pseudo.count = prior.params, unit.scale = FALSE, seq.count = NULL)

Arguments

x
the integer count matrix representing the motif, rows as nucleotides
id
a systematic ID given to this PWM, could include the source, version, etc
name
the name of the transcription factor (TF) to which the PWM corresponds to
type
the type of PWM calculation, either as log2-odds, or posterior probability (frequency matrix)
prior.params
the pseudocounts for each of the nucleotides
pseudo.count
the pseudo-count values if different from priors
unit.scale
if to unit.scale the pwm (default is no unit scaling)
seq.count
if x is a normalised PFM (i.e. with probabilities instead of sequence counts), then this sequence count will be used to convert x into a count matrix

Value

a new PWM object representing the PWM

Details

By default the Biostrings package scales the log-odds score so it is within 0 and 1. In this function we take a more traditional approach with no unit scaling and offer unit scaling as an additional parameter.

See ?PWM from Biostrings for more information on input arguments.

Examples

Run this code
if(require("PWMEnrich.Dmelanogaster.background")){
    data(MotifDb.Dmel.PFM)

    ttk = MotifDb.Dmel.PFM[["ttk"]]

    PWMUnscaled(ttk, id="ttk-JASPAR", name="ttk") # make a PWM with uniform background
    PWMUnscaled(ttk, id="ttk-JASPAR", name="ttk", prior.params=c("A"=0.2, "C"=0.3, "G"=0.3, "T"=0.2)) # custom background

    prior = getBackgroundFrequencies("dm3", quick=TRUE) # get background for drosophila (quick mode on a reduced dataset)
    PWMUnscaled(ttk, id="ttk-JASPAR", name="ttk", prior.params=prior) # convert using genomic background
}

Run the code above in your browser using DataLab