dropSimilarMotifs: Drop any motifs that appear to be redundant

Description Usage Arguments Value Examples

Description

Uses a table of correlations between motifs' k-mer z scores (as in cisbp$similarMotifs) to remove those that appear to be redundant, taking the best one in cases where motifs are very similar. Takes the best one independently for each PC/enrichment direction, so different PCs might get different motifs as the best representative motif.

Usage

1
dropSimilarMotifs(motifEnrichments, motifSimilarity, similarityCutoff = 0.5)

Arguments

motifEnrichments

data.frame as made by getKMerTFEnrichment, and merged with cisbp$TFTable, such that it has column names including c("Motif_ID", "direction","p","TF_Name","PC"))

motifSimilarity

three column data frame (cisbp$similarMotifs), with columns c("Motif_ID1", "Motif_ID2", "R") describing pairwise motif similarity.

similarityCutoff

a cutoff above which motifs are considered to be redundant.

Value

Returns a filtered version of motifEnrichments with a new column "wereRedundant" containing all the Motif_IDs that were redundant with the remaining Motif_ID

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
kmerMat = inputKMerFreqs(sprintf("kMerFiles/%s.freq.gz",sampleDesc$id), IDs = sampleDesc$id)
myPCA = doKMerPCA(kmerMat, nPCs = "jackstraw")
treatmentPCs = findDistinguishingPCs(myPCA$rotation[,1:myPCA$nPCs], sampleDesc[c("id","treated")])
tfEnrichmentsPBM = getKMerTFEnrichment(myPCA$rotation[,1:myPCA$nPCs], cisbp$binaryPBMZScores);
tfEnrichmentsPBM = tfEnrichmentsPBM[order(tfEnrichmentsPBM$p),]
tfEnrichmentsPBM = merge(tfEnrichmentsPBM2, cisbp$TFTable[c("Motif_ID","TF_Name")], by="Motif_ID") # add TF names
tfEnrichmentsPBM = preferDirect(tfEnrichmentsPBM, cisbp$TFTable)
tfEnrichmentsPBM$Bon.P = tfEnrichmentsPBM$p + log(nrow(tfEnrichmentsPBM)) +  log(3000) #approximate Bonferroni MHT correction; multiply by 3000 for n_max
tfEnrichmentsPBM = tfEnrichmentsPBM[tfEnrichmentsPBM$Bon.P < log(0.01),] # cutoff of P<0.01
tfEnrichmentsPBM_NR = dropSimilarMotifs(tfEnrichmentsPBM, cisbp$similarMotifs);

Carldeboer/BrockmanR documentation built on May 31, 2019, 2:19 p.m.