Compute the KL divergence between two given PSSMs
pssm_diff.RdThe KL divergence is computed by shifting the shorter PSSM along the longer one and computing the divergence at each position. The minimum divergence is returned.
Examples
if (FALSE) { # \dontrun{
res1 <- regress_pwm(cluster_sequences_example, cluster_mat_example[, 1])
pssm_diff(res1$pssm, JASPAR_motifs[JASPAR_motifs$motif == "HNF1A", ])
} # }
# Compare KL divergence between two motifs from MOTIF_DB
pssm_diff(as.matrix(MOTIF_DB["HOMER.GATA3_2"]), as.matrix(MOTIF_DB["JASPAR.CDX1"]))
#> [1] 8.327341
# Lower values indicate more similar motifs
pssm_diff(as.matrix(MOTIF_DB["HOMER.GATA3_2"]), as.matrix(MOTIF_DB["JASPAR.GATA3"]))
#> [1] 9.37645