histWrapper: Histogram Wrapper

Description Usage Examples

Description

Histogram Wrapper

Usage

1
histWrapper(h, motifNames, names = c("NoName"), ...)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
FastaFile<-"~/Dropbox/UTX-Alex/jan/combined.fasta"
data<-loadHeightFile("~/Dropbox/UTX-Alex/jan/combined_heights.bed")$data
reg<-as.matrix(ascore(data,c(1,1,1),c("top","bottom","middle"),c(1,1,1)))
Sequences <- readDNAStringSet(FastaFile, "fasta")
motifFile<-"inst/data/abnormal_normal.pwm"
motifs<-homerWrapper(Sequences,reg[,1],reg[,2],"~/Masters/mulcal/inst/lib/homer-4.7/cpp/homer2",motifFile)
motifs<-loadPWM(motifFile)
mots<-unlist(lapply(unlist(motifs[,1]),function(x)gsub(">","",x)))
motifs<-loadPWM("inst/data/jaspar_motifs.txt","jaspar")
mots<-c(mots,unlist(lapply(1:length(motifs[,2]),function(i)PWMtoCons(motifs[i,2]$data))))
addmotifs<-c("CGNNGC")
mList<-unlist(lapply(c(mots,addmotifs),IUPACtoBase))
cList<-unlist(lapply(lapply(c(mots,addmotifs),IUPACtoBase),compliment))
locationsM<-lapply(mList,grep,Sequences)
locationsC<-lapply(cList,grep,Sequences)
l<-length(cList)
motifHist(Sequences,mList,cList,locationsM,locationsC,4,l,reg)

h<-lapply(seq(3),function(k)lapply(seq(1:l-1),function(i)motifHist(Sequences,mList,cList,locationsM,locationsC,i,l,reg[,k])))

h<-lapply(seq(10),function(k)lapply(seq(10),function(i)lapply(seq(3),function(j)motifHist(Sequences,mList,cList,locationsM,locationsC,i,k,reg[,j]))))
lapply(h,scoreList,c(mots,addmotifs)[1:10],addmotifs)
histWrapper(lapply(h,function(x) lapply(x,function(y)y[[2]])),c(mots,addmotifs), names=c("NonName"),c(1),c(30))

alexjgriffith/mulcal documentation built on May 10, 2019, 8:53 a.m.