ge11232002 / TFBSTools

Software Package for Transcription Factor Binding Site (TFBS) Analysis
25 stars 10 forks source link

Nathan: possible memory leak in TFMPvalue #1

Closed ge11232002 closed 9 years ago

ge11232002 commented 9 years ago
results = data.frame(motif = c(),
                     pfm.score = c(),
                     pwm.score = c(),
                     pfm.lazy.score = c(),
                     pwm.lazy.score = c()

                     )

pvalue = 1e-3

for(motif in motifs){
  opts <- list(ID=motif) #species = human
  pfm <- getMatrixSet(JASPAR2014, opts)[[1]]
  thres.pfm = TFMpv2sc(as.matrix(pfm) + 1, pvalue, bg=c(A=0.25, C=0.25, G=0.25, T=0.25), type="PFM")
  thres.lazy.pfm = TFMLazyScore(as.matrix(pfm), pvalue, bg=c(A=0.25, C=0.25, G=0.25, T=0.25), type="PFM")
  pwm <- TFBSTools:::toPWM(pfm, pseudocount=1)
  thres.pwm = TFMpv2sc(as.matrix(pwm), pvalue, bg=c(A=0.25, C=0.25, G=0.25, T=0.25), type="PWM")
  thres.lazy.pwm = TFMLazyScore(as.matrix(pwm), pvalue, bg=c(A=0.25, C=0.25, G=0.25, T=0.25), type="PWM")
  print(motif)
  print(thres.pfm)
  print(thres.pwm)
  print(thres.lazy.pfm)
  print(thres.lazy.pwm)
  results = rbind(results, data.frame(motif=motif, pfm.score=thres.pfm,
                                                   pwm.score=thres.pwm,
                                                  pfm.lazy.score=thres.lazy.pfm,
                                                  pwm.lazy.score=thres.lazy.pwm))
}