ay-lab / dcHiC

dcHiC: Differential compartment analysis for Hi-C datasets
MIT License
60 stars 10 forks source link

Error for trans #68

Closed YH-Li7 closed 1 year ago

YH-Li7 commented 1 year ago

Hi,

I got the error 'Bad trans bed file, quiting!' when running '--pcatype trans'. The same index and matrix files work for cis. The file 'chr1.inter.txt' it generated seems to be complete for this chromosome and the beginning looks like this: 1 1 202 2 1 90 3 1 111 4 1 90 5 1 78 And these values match what in the input files between chr2 and chr1.

Is this an error caused by my input files or the system? Thank you!

Here is the log: Reading the 533_MAPQ30_1mb_index_autosome_only.txt file and reindexing chr1 Reindexing complete Reading the matrix file 533_MAPQ30_1mb_matrix_autosome_only.txt Written sample_533_pca/inter_pca/sample_533_mat/chr1.inter.txt Bad trans bed file, quiting! Error in `/cluster/spack-2021/opt/spack/linux-centos7-x86_64/gcc-9.3.0/r-4.0.3-ei2yjjpniyylc6uk2d6sellyduy3d2 pq/rlib/R/bin/exec/R': double free or corruption (!prev): 0x0000000006644820 ======= Backtrace: ========= /usr/lib64/libc.so.6(+0x81329)[0x2aaaaba76329] /storage/hpc/data/software/R-4.0.3/library/functionsdchic/libs/functionsdchic.so(_Z14createtransijkNSt7__cx x1112basic_stringIcSt11char_traitsIcESaIcEEES4_S4S4+0xc24)[0x2aaabb484784] /storage/hpc/data/software/R-4.0.3/library/functionsdchic/libs/functionsdchic.so(_functionsdchic_createtran sijk+0x5ac)[0x2aaabb47c0fc] /cluster/spack-2021/opt/spack/linux-centos7-x86_64/gcc-9.3.0/r-4.0.3-ei2yjjpniyylc6uk2d6sellyduy3d2pq/rlib/R/lib/ libR.so(+0xfa894)[0x2aaaaadc9894] /cluster/spack-2021/opt/spack/linux-centos7-x86_64/gcc-9.3.0/r-4.0.3-ei2yjjpniyylc6uk2d6sellyduy3d2pq/rlib/R/lib/ libR.so(+0xfade6)[0x2aaaaadc9de6] ......

ay-lab commented 1 year ago

There is an issue with the supplied bed file. Can you share the bed file?

YH-Li7 commented 1 year ago

Here is an example bed file. The genome is bosTau9. chrX is removed in both matrix and bed files for non-sex-specific comparisons.

533_MAPQ30_1mb_index_autosome_only.txt

ay-lab commented 1 year ago

I think this may an issue in the bed file.

chr1    154000000   155000000   154
chr1    155000000   156000000   155
chr1    156000000   157000000   156
chr1    157000000   158000000   157
chr1    158000000   158534110   158
chr2    0   1000000 299
chr2    1000000 2000000 300
chr2    2000000 3000000 301
chr2    3000000 4000000 302
chr2    4000000 5000000 303
chr2    5000000 6000000 304
chr2    6000000 7000000 305

If you look at the indices (4th column) going from chr1 to chr2, it is not continuous. Chromosome 1 ends at 158 but chromosome 2 starts at 299. It should have started at 159. Please try to correct the bed file indices (and in the raw matrix file) and give it a shot again. I think it will resolve the issue.

YH-Li7 commented 1 year ago

It's probably not. I tried it before for sex-specific comparisons that include chrX (bin 158 to 298), and I got the same error below. Do you have a small dataset that works on your side I can use to test?

Bed file: 533_MAPQ30_1mb_index_sex_specific.txt

Log: Reading the 533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr1 Reindexing complete Reading the matrix file 533_MAPQ30_1mb_matrix_sex_specific.txt Written sample_533_pca/inter_pca/sample_533_mat/chr1.inter.txt Bad trans bed file, quiting! Error in `/cluster/spack-2021/opt/spack/linux-centos7-x86_64/gcc-9.3.0/r-4.0.3-ei2yjjpniyylc6uk2d6sellyduy3d2 pq/rlib/R/bin/exec/R': double free or corruption (!prev): 0x000000000668c460 ======= Backtrace: ========= /usr/lib64/libc.so.6(+0x81329)[0x2aaaaba76329] /storage/hpc/data/yl5c7/software/R-4.0.3/library/functionsdchic/libs/functionsdchic.so(_Z14createtransijkNSt7__cx x1112basic_stringIcSt11char_traitsIcESaIcEEES4_S4S4+0xc24)[0x2aaabb484784] /storage/hpc/data/yl5c7/software/R-4.0.3/library/functionsdchic/libs/functionsdchic.so(_functionsdchic_createtran sijk+0x5ac)[0x2aaabb47c0fc] /cluster/spack-2021/opt/spack/linux-centos7-x86_64/gcc-9.3.0/r-4.0.3-ei2yjjpniyylc6uk2d6sellyduy3d2pq/rlib/R/lib/ libR.so(+0xfa894)[0x2aaaaadc9894] /cluster/spack-2021/opt/spack/linux-centos7-x86_64/gcc-9.3.0/r-4.0.3-ei2yjjpniyylc6uk2d6sellyduy3d2pq/rlib/R/lib/libR.so(+0xfade6)[0x2aaaaadc9de6]

ay-lab commented 1 year ago

If it's working for the chr1 then it should be working for the rest too! Very hard for me to debug from my side but I can suggest to check if a specific chromosome is making it to crash. Can you delete the chr1 and chr2 coordinates from the bed file and try it again? This would force dchic to start from chr3.

YH-Li7 commented 1 year ago

The error is not caused by the next chromosome. If I set '--cthread 30' and assign 30 CPUs, all the chromosomes can generate the *.inter.txt file in parallel and all end with this error. Here I attach a matrix for test, can you try this with your system? I see the same error from this file.

matrix: test_matrix.txt index: 533_MAPQ30_1mb_index_sex_specific.txt input: dcHiC_input.txt

ay-lab commented 1 year ago

I just ran using your files and it did generate the files (Attached). Here is the output log

(base) Rscript ../dchicf.r --file dcHiC_input.txt --pcatype trans --dirovwt T --cthread 1 --pthread 1
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr1
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr1.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chrX
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chrX.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr2
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr2.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr3
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr3.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr5
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr5.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr4
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr4.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr6
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr6.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr8
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr8.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr7
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr7.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr11
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr11.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr9
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr9.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr10
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr10.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr12
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr12.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr15
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr15.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr13
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr13.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr14
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr14.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr16
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr16.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr17
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr17.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr20
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr20.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr21
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr21.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr18
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr18.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr19
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr19.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr24
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr24.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr22
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr22.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr23
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr23.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr26
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr26.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr29
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr29.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr28
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr28.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr27
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr27.inter.txt
Reading the /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/533_MAPQ30_1mb_index_sex_specific.txt file and reindexing chr25
Reindexing complete
Reading the matrix file /mnt/bioadhoc-temp/Groups/vd-ay/abhijit/overflow/proj_overflow/Diffential_HiC_Compartment_Analysis/githubIssues/Apr252023/test_matrix.txt
Written sample_533_1_pca/inter_pca/sample_533_1_mat/chr25.inter.txt
Reading the sample_533_1_pca/inter_pca/sample_533_1_mat/chr1.inter.txt   : complete!
Reducing the matrix rows to 9999 X 159
Error in functionsdchic::transmat(paste0(path, "/", chr[l], ".inter.txt"),  :
  upper value must be greater than lower value
Calls: lapply -> FUN -> lapply -> FUN -> <Anonymous> -> .Call
Execution halted

Ignore the last error, it is probably due to the truncated version of the matrix file. sample_533_1_pca.tar.gz

YH-Li7 commented 1 year ago

OK. Then it is something incompatible with our server. I'll focus on cis analyses for now. If I can figure out the issue, I'll let you know. Thank you for your time and help!