preferDirect: Take directly determined motifs where available

Description Usage Arguments Value Examples

Description

Given a data.frame of motif enrichments, finds instances where the same TF has directly determined motifs as well as indirectly determined motifs (e.g. inferred by homology), and retains only those directly determined, unless no other motif exists (see http://cisbp.ccbr.utoronto.ca/index.php for further explanation).

Usage

1
preferDirect(motifEnrichments, TFInfo)

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"))

Value

Returns a filtered version of motifEnrichments with a new column "indirect" containing all the Motif_IDs that represented the same TF, but were inferred indirectly.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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);
tfEnrichmentsPBM_NR_onePerTF = bestMotifPerTF(tfEnrichmentsPBM_NR);

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