DiffBind error when calling dba.count
2
0
Entering edit mode
16 months ago
aropri ▴ 80

I am trying to compute count information for each of the peaks/regions in the consensus set. In this step, for each of the consensus regions DiffBind takes the number of aligned reads in the ChIP sample and the input sample, to compute a normalized read count for each sample at every potential binding site.

I use the code: dbObj <- dba.count(dbObj, bUseSummarizeOverlaps=TRUE) and my samplesheet is at this link:

However, I get the following error:

Error in pv.counts(DBA, peaks = peaks, minOverlap = minOverlap, defaultScore = score, :

Some read files could not be accessed. See warnings for details.

1: data/alignment_output/10A_1_H3K_aligned.bam not accessible

2: data/alignment_output/10A_2_H3K_aligned.bam not accessible

3: data/alignment_output/10A_1_IgG_aligned.bam not accessible

4: data/alignment_output/10A_2_IgG_aligned.bam not accessible

Please, if someone would be able to help me troubleshoot this, would really appreciate it.

Thank you!

ChIP-Seq • 1.7k views
0
Entering edit mode

Can you post a ls -lh when you are in this folder?

0
Entering edit mode
16 months ago
Rory Stark ★ 1.2k

Is there a subdirectory named data in your current working directory with the bam files? Try:

file.exists("data/alignment_output/10A_1_H3K_aligned.bam")

There also need to be a matching index file (.bai) for each bam.

0
Entering edit mode

I do have a subdirectory named data in my current working directory where the bam files are. Also, I tried:

file.exists("data/alignment_output/10A_1_H3K_aligned.bam")

and got TRUE

Lastly, why do I need a matching index file (.bai) for each bam file. I do have them, just wondering what is the purpose for it?

Hope you can help, and you are amazing with helping so many ppl out. Thank you for all you do!

0
Entering edit mode

The index is for random access to read only specific parts of the bam, I assume it is the peak coordinates in this case. I was asking for the ls -lh because if the files are there maybe it is some permission rights that are (for whatever reason) not set correctly and you do not have the access/read right to actually read from them.

0
Entering edit mode

Thank you for your answer. The peak files are fine, but i will check permission rights to see if that fixes the problem and the bam files are able to be accessed

0
Entering edit mode

I checked the permission status using ls -lh and i think you are correct in that I do not have permission to access the files, even though I am the one that created them. For example all my files have this as read write or execute:

rwxr-xr-x

Thus the r-x, after the first three characters (rwx) signifies I do not have permission. How would I be able to fix this so I can get permission to access them. Hope you can help.

0
Entering edit mode

Hi Rory,

I am also getting this same error when running dba.count() despite all my .bam files and matching .bai files being in the working directory. I have enabled full permissions (i.e -rwxrwxrwx) on all files in the folder. Any help would be greatly appreciated! Thanks

0
Entering edit mode

Hello, I have the same problem except for all my paths are correct, the files all exist with the matching .bai and I checked and there is nothing wrong with permissions. I don't know why but out of 36 files I got warnings for 29 of them. Please help me.

0
Entering edit mode

If you are running dba,count() in the default parallel mode, it can help to run with bParallel=FALSE to see the full warning one at a time.

When the warning is that the files are not accessible, and permission are not an issue, the most common cause is that the files are specified using relative paths and the command is not being run from the correct working directory.

0
Entering edit mode

Thanks for the response. I changed my working directory but it is still not working. I am also not getting warnings for all of the bams files despite the fact that all of them are stored in the same directory. Could there be other issues causing this problem?

0
Entering edit mode
8 months ago

This appears to result from an issue with the file.access(filelist,mode=4) call in the pv.checkExists function in dba.count()

file.access(Peaks$samples$bamReads,mode=4) does not produce the expected behavior on my windows 10 system/R version 4.0.2

it always returns -1 for anything other than mode=0

0
Entering edit mode

Hmm, I tested it on Windows and it works with mode=4 (returning zeros).

If you are running Bioconductor 3.12 to use DiffBind_3.0.x you should be on R 4.0.3, I don't know if that is part of the issue?

You can also try

file.mode(Peaks$samples$bamReads)


You should get back 666 for read/write files.

My sessionInfo():

R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods
[9] base

other attached packages:
[1] DiffBind_3.0.13             SummarizedExperiment_1.20.0 Biobase_2.50.0
[4] MatrixGenerics_1.2.1        matrixStats_0.58.0          GenomicRanges_1.42.0
[7] GenomeInfoDb_1.26.2         IRanges_2.24.1              S4Vectors_0.28.1
[10] BiocGenerics_0.36.0

loaded via a namespace (and not attached):