TemplatesFunctions {openPrimeR} | R Documentation

## Template Functionalities.

### Description

`adjust_binding_regions`

  Adjusts the existing annotation of binding regions by specifying a new binding interval relative to the existing binding region.

`assign_binding_regions`

  Assigns the primer target binding regions to a set of template sequences.

`update_template_cvg`

  Annotates the template coverage.

`select_regions_by_conservation`

  Computes Shannon entropy for the defined binding regions and determines the most conserved regions.

### Usage

    update_template_cvg(template.df, primer.df, mode.directionality = NULL)

    adjust_binding_regions(template.df, region.fw, region.rev)

    assign_binding_regions(
      template.df,
      fw = NULL,
      rev = NULL,
      optimize.region = FALSE,
      primer.length = 20,
      gap.char = "-"
    )

    select_regions_by_conservation(
      template.df,
      gap.char = "-",
      win.len = 30,
      by.group = TRUE,
      mode.directionality = c("both", "fw", "rev")
    )

### Arguments

`template.df` | An object of class `Templates`.
`primer.df` | An object of class `Primers` containing primers with annotated coverage that are to be used to update the template coverage in `template.df`.
`mode.directionality` | The directionality of primers/templates.
`region.fw` | Interval of new binding regions relative to the forward binding region defined in `template.df`.
`region.rev` | Interval of new binding regions relative to the reverse binding region defined in `template.df`
`fw` | Binding regions for forward primers. Either a numeric interval indicating a uniform binding range relative to the template 5' end or a path to a FASTA file providing binding sequences for every template. If `fw` is missing, only `rev` is considered.
`rev` | Binding regions for reverse primers. Either a numeric interval indicating a uniform binding range relative to the template 3' end or the path to a FASTA file providing binding sequences for every template. If `rev` is missing, only `fw` is considered.
`optimize.region` | If `TRUE`, the binding regions specified via `fw` and `rev` are adjusted such that binding regions that may form secondary structures are avoided. This feature requires ViennaRNA (see notes). If `FALSE` (the default), the input binding regions are not modified.
`primer.length` | A numeric scalar providing the probe length that is used for adjusting the primer binding regions when `optimize.region` is `TRUE`.
`gap.char` | The character in the input file representing gaps.
`win.len` | The extent of the desired primer binding region. This should be smaller than the `allowed.region`. The default is 30.
`by.group` | Shall the determination of binding regions be stratified according to the groups defined in `template.df`. By default, this is set to `TRUE`.

### Details

When modifying binding regions with `adjust_binding_regions`, new binding intervals can be specified via `fw` and `rev` for forward and reverse primers, respectively. The new regions should be provided relative to the existing definition of binding regions in `template.df`. For specifying the new binding regions, position `0` refers to the first position after the end of the existing binding region. Hence, negative positions relate to regions within the existing binding region, while non-negative values relate to positions outside the defined binding region.

Binding regions are defined using `assign_binding_regions`, where the arguments `fw` and `rev` provide data describing the binding regions of the forward and reverse primers, respectively. To specify binding regions for each template individually, `fw` and `rev` should provide the paths to FASTA files. The headers of these FASTA file should match the headers of the loaded `template.df` and the sequences in the files specified by `fw` and `rev` should indicate the target binding regions.

To specify uniform binding regions, `fw` and `rev` should be numeric intervals indicating the allowed binding range for primers in the templates. Setting the forward interval to (1,30) indicates that the first 30 bases should be used for forward primers and specifying the reverse interval to (1,30) indicates that the last 30 bases should be used for reverse primer binding.

If `optimize.region` is `TRUE`, the input binding region is adjusted such that regions forming secondary structures are avoided.

### Value

`update_template_cvg` returns an object of class `Templates` with updated coverage columns.

`adjust_binding_regions` returns a `Templates` object with updated binding regions.

`assign_binding_regions` returns an object of class `Templates` with newly assigned binding regions.

`select_regions_by_conservation` returns a `Templates` object with adjusted binding regions. The attribute `entropies` gives a data frame with positional entropies and the attribute `alignments` gives the alignments of the templates.

### Note

`assign_binding_regions` requires the program ViennaRNA (https://www.tbi.univie.ac.at/RNA/) for adjusting the binding regions when `optimize.region` is set to `TRUE`.

`select_regions_by_conservation` requires the MAFFT software for multiple alignments (http://mafft.cbrc.jp/alignment/software/).

### Examples

    # Annotate the coverage of the templates
    data(Ippolito)
    template.df <- update_template_cvg(template.df, primer.df)
    data(Ippolito)
    # Extend the binding region by one position
    relative.interval <- c(-max(template.df$Allowed_End_fw), 0)
    template.df.adj <- adjust_binding_regions(template.df, relative.interval)
    # compare old and new annotations:
    head(cbind(template.df$Allowed_Start_fw, template.df$Allowed_End_fw))
    head(cbind(template.df.adj$Allowed_Start_fw, template.df.adj$Allowed_End_fw))
    data(Ippolito)
    # Assignment of individual binding regions
    l.fasta.file <- system.file("extdata", "IMGT_data", "templates",
         "Homo_sapiens_IGH_functional_leader.fasta", package = "openPrimeR")
    template.df.individual <- assign_binding_regions(template.df, l.fasta.file, NULL)
    # Assign the first/last 30 bases as forward/reverse binding regions
    template.df.uniform <- assign_binding_regions(template.df, c(1,30), c(1,30))
    # Optimization of binding regions (requires ViennaRNA)
    ## Not run: template.df.opti <- assign_binding_regions(template.df, c(1,30), c(1,30),
                         optimize.region = TRUE, primer.length = 20)
    ## End(Not run)
    data(Ippolito)
    new.template.df <- select_regions_by_conservation(template.df)

[Package openPrimeR version 1.16.0 Index]