numMotifHits: Number of motif hits in a set of DNA sequences

Description Usage Arguments Details Value Examples

View source: R/count_wrapper.R

Description

This function counts the number of motif hits that are found in a given set of DNA sequences.

Usage

1
numMotifHits(seqs, pfm, bg, singlestranded = FALSE)

Arguments

seqs

A DNAStringSet or DNAString object

pfm

An R matrix that represents a position frequency matrix

bg

A Background object

singlestranded

Boolean that indicates whether a single strand or both strands shall be scanned for motif hits. Default: singlestranded = FALSE.

Details

Optionally, it can be used to count motif hits on one or both strands, respectively.

Value

A list containing

nseq

Number of individual sequences

lseq

Vector of individual sequence lengths

numofhits

Vector of the number of hits in each individual sequence

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Load sequences
seqfile = system.file("extdata", "seq.fasta", package = "motifcounter")
seqs = Biostrings::readDNAStringSet(seqfile)

# Load background
bg = readBackground(seqs, 1)

# Load motif
motiffile = system.file("extdata", "x31.tab", package = "motifcounter")
motif = t(as.matrix(read.table(motiffile)))

# Count motif hits both strands
noc = motifcounter:::numMotifHits(seqs, motif, bg)
noc$numofhits

# Count motif hits on a single strand
noc = motifcounter:::numMotifHits(seqs, motif, bg, singlestranded = TRUE)
noc$numofhits

motifcounter documentation built on Nov. 8, 2020, 5:44 p.m.