numMotifHits {motifcounter} | R Documentation |
This function counts the number of motif hits that are found in a given set of DNA sequences.
numMotifHits(seqs, pfm, bg, singlestranded = FALSE)
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. |
Optionally, it can be used to count motif hits on one or both strands, respectively.
A list containing
Number of individual sequences
Vector of individual sequence lengths
Vector of the number of hits in each individual sequence
# 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