slowkow / CENTIPEDE.tutorial

:bug: How to use CENTIPEDE to determine if a transcription factor is bound.
https://slowkow.github.io/CENTIPEDE.tutorial
25 stars 13 forks source link

centipede fitting error #2

Closed ahorvath closed 8 years ago

ahorvath commented 8 years ago

Dear Kamil,

I would like to ask your help. I'm trying to use the CENTIPEDE package for creating ATAC footprint plots with bed a file. I transformed the file to the format that the fimo file has. I got the following error:

fit <- fitCentipede( Xlist = list(DNase = cen$mat), Y = as.matrix(data.frame( Intercept = rep(1, nrow(cen$mat)) )) ) Initialization of the parameters: Error in quantile.default(x, c(TrimP, 1 - TrimP)) : missing values and NaN's not allowed if 'na.rm' is FALSE

Can you help me?

Thanks in advance. Best Regards, Attila

slowkow commented 8 years ago

Please share the input files and the commands you used to construct the variables.

ahorvath commented 8 years ago
library(devtools)
library(Rsamtools)
library(CENTIPEDE)
library(CENTIPEDE.tutorial)

sample1.bam <- "Sample1.bam"
bed <- "Cluster2_peaks.txt"
cen <- centipede_data(
        bam_file = sample1.bam,
        fimo_file = bed,
        log10p = 4,
        flank_size = 100
)
plot(cen$mat[1,], xlab = "column", ylab = "reads")

fit <- fitCentipede(
        Xlist = list(DNase = cen$mat),
        Y = as.matrix(data.frame(
                Intercept = rep(1, nrow(cen$mat))
        ))
)

I just sent you the data in email.

slowkow commented 8 years ago

It seems you have very few reads in your regions, so I'm not sure if CENTIPEDE will work for you.

Unfortunately, I do not provide support for the CENTIPEDE package. I suggest that you direct further questions to the authors of CENTIPEDE.

library(CENTIPEDE.tutorial)

setwd("~/work/attila/")

sample1.bam <- "Sample1.bam"
bed <- "Cluster2_peaks.txt"
cen <- centipede_data(
  bam_file = sample1.bam,
  fimo_file = bed,
  log10p = 4,
  flank_size = 100
)

plot(rowSums(cen$mat))

library(NMF)
library(viridis)
aheatmap(
  cen$mat, labRow = NA, labCol = NA, Colv = NA, Rowv = NA, color = viridis(100))

image

image

AnnaKuchmiy commented 6 years ago

Dear Slowkow, I have exactly the same problem following the tutorial step by step with the data provided here https://slowkow.github.io/CENTIPEDE.tutorial/ Do you aware whether there is any solution for it? Many thanks in advance, Anna

slowkow commented 6 years ago

You might considering taking a step back and looking at your data. Maybe it is not suitable for modeling with CENTIPEDE?

Try making a plot of the read density across the genome. Next, try annotating the positions of transcription factor motifs on the same plot. This should help to develop a sense of how the data might be analyzed further.

zhenzuo2 commented 6 years ago

I debugged the function to see waht caused this error. It turns out to be some zeros in LambdaParList. When take log of LambdaParList, it comes to -Inf. And it will cause NA when the function multiplies LambdaParList to some other matrix. So specify LambdaParList before running the fitting should solve this problem.

rdbcasillas commented 6 years ago

Hey @zhenzuo2 , Thanks for the response. How did you decide the value of LambdaParList. From the documentation, it is not clear other than that it should match the length of Xlist.

bakerwm commented 5 years ago

Hi, @slowkow , I create the cen object using the function centipede_data, and found 0 in some positions of my ATAC-Seq data. And this will cause the above error.

The Error was fixed when I Assign the minimum Lambda value to the 0 positions. see here, fixInf branch.

It means no cut events detected at that position? could it happened in actual experiment?