KDM is based on a dictionary of k-mers of a given length, possibly including a
number of undefined positions (gaps, written N). A dictionary can also be
defined as double strand, in which case each k-mer and its reverse complement are
considered the same entity.
Everything downstream — motifs, sequences, scores — lives in the space this dictionary
defines, so it is the first choice you make. To define one, use the function
KDMDictionary, which requires the following parameters:
KDMDictionary| Parameter | Meaning |
|---|---|
kmerlength | integer: the length of the k-mers |
ngaps | integer [0, kmerlength): the number of undefined positions |
double.strand | logical: TRUE if the dictionary is double strand |
| Output | a list containing kmerlength, ngap, double.strand and kmers, a data.frame containing the list of k-mers in the dictionary |
For instance, we can define a dictionary as the one we use for RBP binding proteins as follows:
dictionaryRBP<-KDMDictionary(kmerlength=6,ngaps=2,double.strand=FALSE)
In this case the kmers field will contain:
kmer
1 NNAAAA
2 NANAAA
3 ANNAAA
4 NAANAA
5 ANANAA
6 AANNAA
7 NAAANA
8 ANAANA
9 AANANA
10 AAANNA
. . .
For transcription factors we define:
dictionaryTF<-KDMDictionary(kmerlength=8,ngaps=2,double.strand=TRUE)
obtaining:
kmer kmer_rc
1 NNAAAAAA TTTTTTNN
2 NANAAAAA TTTTTNTN
3 ANNAAAAA TTTTTNNT
4 NAANAAAA TTTTNTTN
5 ANANAAAA TTTTNTNT
6 AANNAAAA TTTTNNTT
7 NAAANAAA TTTNTTTN
8 ANAANAAA TTTNTTNT
9 AANANAAA TTTNTNTT
10 AAANNAAA TTTNNTTT
. . .
With
double.strand = TRUEthe dictionary gains akmer_rccolumn holding the reverse complement that each entry is pooled with.
The rest of this tutorial uses dictionaryTF, since the worked example is the
transcription factor NRF1.