if(require("PWMEnrich.Dmelanogaster.background")){
###
# load the pre-compiled lognormal background
data(PWMLogn.dm3.MotifDb.Dmel)
# scan two sequences for motif enrichment
sequences = list(DNAString("GAAGTATCAAGTGACCAGTAGATTGAAGTAGACCAGTC"), DNAString("AGGTAGATAGAACAGTAGGCAATGGGGGAAATTGAGAGTC"))
res = motifEnrichment(sequences, PWMLogn.dm3.MotifDb.Dmel)
# most enriched in both sequences (lognormal background P-value)
head(motifRankingForGroup(res))
# most enriched in both sequences (raw affinity, no background)
head(motifRankingForGroup(res, bg=FALSE))
# most enriched in the first sequence (lognormal background P-value)
head(motifRankingForSequence(res, 1))
# most enriched in the first sequence (raw affinity, no background)
head(motifRankingForSequence(res, 1, bg=FALSE))
###
# Load the pre-compiled background for hit-based motif counts with cutoff of P-value = 0.001
data(PWMPvalueCutoff1e3.dm3.MotifDb.Dmel)
res.count = motifEnrichment(sequences, PWMPvalueCutoff1e3.dm3.MotifDb.Dmel)
# Enrichment in the whole group, z-score for the number of motif hits
head(motifRankingForGroup(res))
# First sequence, sorted by number of motif hits with P-value < 0.001
head(motifRankingForSequence(res, 1, bg=FALSE))
}
Run the code above in your browser using DataLab