numMotifHits {motifcounter}R Documentation

Number of motif hits in a set of DNA sequences

Description

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

Usage

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


# 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


[Package motifcounter version 1.10.0 Index]