createBindingFactor.layer_region: Create a binding factor object to match a given pattern of...

View source: R/createBindingFactor.layer_region.R

createBindingFactor.layer_regionR Documentation

Create a binding factor object to match a given pattern of layers, typically ignoring DNA

Description

Create a new binding factor based on a simple pattern of marks on others layers and may (when used) set marks on other layers.

Usage

createBindingFactor.layer_region(
  name,
  type = "layer_region",
  patternLength = 1,
  patternString = NULL,
  mismatch.rate = 0,
  stateWidth = patternLength,
  profile.layers = NULL,
  profile.marks = NULL,
  mod.layers = NULL,
  mod.marks = NULL,
  offset = 0,
  offset.method = NULL,
  offset.params = NULL,
  align = "centre",
  test.layer0.binding = FALSE,
  test.mismatch.rate = 0.1,
  max.pattern.tries = 1000,
  min.DM.length = 2,
  min.DR.length = 10,
  verbose = FALSE
)

Arguments

name

give the binding factor a name

type

"layer_region" to differentiate from other types

patternLength

[= 1] length of pattern

patternString

= NOT USED in this case

stateWidth

the width of pattern to recognise on other layers, default is same as patternLength

profile.layers

a vector of named layers to set as a match

profile.marks

a vector of 0/1 to match the layers in profile.layers

mod.layers

a vector of named layers to alter on a match

mod.marks

a vector of 0/1 to set on the mod.layers

offset

0 integer value to indicate relative distance from pattern to apply modifications. Very simple.

offset.method

NULL a function to apply to apply offset. MUST have parameter "n" that is used internally to represent the number of hits.

offset.params

NULL a list of named parameters to pass to offset.method function

align

"centre"

test.layer0.binding

when creating, test if the DNA sequence has a match.

test.mismatch.rate

proportion of mismatches to tolerate when testing

max.pattern.tries

NA

min.DM.length

NA

min.DR.length

NA

verbose

set to TRUE for more output

Value

"hits"

Examples

bf.LR <- createBindingFactor.layer_region("bf.LR", type="layer_region", 
         patternLength = 1, 
          stateWidth = 9, profile.layers = "LAYER.1",
          profile.marks = 0, mod.layers = "LAYER.1", mod.marks = 1)
         
 bf.LR1 <- createBindingFactor.layer_region("bf.LR1", type="layer_region",  patternLength = 1, patternString = "N",  profile.layers = "LAYER.1", profile.marks = 0, mod.layers = "LAYER.1", mod.marks = 1)
 bf.LR2 <- createBindingFactor.layer_region("bf.LR2", type="layer_region",  patternLength = 1, patternString = "N",  profile.layers = "LAYER.1", profile.marks = 0)  # profile but no mods
 bf.LR3 <- createBindingFactor.layer_region("bf.LR3", type="layer_region",  patternLength = 1, patternString = "N",   mod.layers = "LAYER.1", mod.marks = 1)  # no profile beyond LAYER.0 (genome)
 
 # example of using an offset.method to pass a function 
 upDownFuncRnorm <- function(n, offset.mean, offset.sd)  {
  y <- round(rnorm(n, mean=offset.mean, sd=offset.sd))
  z <- sample(c(1, -1), length(y), replace=T)  # random vector of 1,-1  to negate half the values
 
  return(round(y*z))
 }
 
 bf.LR4 <- createBindingFactor.layer_region("bf.LR4", type="layer_region",  
                    patternLength = 10,  profile.layers = "LAYER.1", profile.marks = 1, 
                    mod.layers = "LAYER.1", mod.marks = 1,
                   offset.method=upDownFuncRnorm, 
                   offset.params=list(offset.mean=50, offset.sd=15))
 

davetgerrard/GenomicLayers documentation built on Nov. 21, 2024, 6:21 a.m.