ay-lab / dcHiC

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

Error: upper value must be greater than lower value after removing X, Y, M chromosomes #88

Closed yardimcilab closed 10 months ago

yardimcilab commented 10 months ago

I tried converting a pair of .hic contact matrices to sparse matrices and calling one of your example commands:

python utility/preprocess.py -input hic -file EXP_KO_dsmin.hic -genomeFile ../../hg38_noalt.sizes -res 100000 -prefix EXP_KO -removeChr X,Y,M

python utility/preprocess.py -input hic -file EXP_Mock_dsmin.hic -genomeFile ../../hg38_noalt.sizes -res 100000 -prefix EXP_Mock -removeChr X,Y,M

Rscript dchicf.r --file input.txt --pcatype cis --dirovwt T --cthread 1 --pthread 1

Here is the output:

Reading  /home/groups/ravnica/projects/HiCkory/resources/test_apps/dcHiC/EXP_Mock_100000.matrix  Hi-C matrix file
Reading  /home/groups/ravnica/projects/HiCkory/resources/test_apps/dcHiC/EXP_Mock_100000_abs.bed  Hi-C bed file
   A    B Weight chr1   pos1 chr2      pos2      dist
1: 1 1156      1 chr1      0 chr1 115500000 115500000
2: 1 1798      1 chr1      0 chr1 179700000 179700000
3: 2    2     14 chr1 100000 chr1    100000         0
4: 2   59      1 chr1 100000 chr1   5800000   5700000
5: 2  185      1 chr1 100000 chr1  18400000  18300000
6: 2  186      1 chr1 100000 chr1  18500000  18400000
 [1] "chr1"  "chr10" "chr11" "chr12" "chr13" "chr14" "chr15" "chr16" "chr17" "chr18" "chr19" "chr2"  "chr20" "chr21" "chr22" "chr3"  "chr4"  "chr5"  "chr6"  "chr7"  "chr8"  "chr9" 
 [1] "chr1"  "chr10" "chr11" "chr12" "chr13" "chr14" "chr15" "chr16" "chr17" "chr18" "chr19" "chr2"  "chr20" "chr21" "chr22" "chr3"  "chr4"  "chr5"  "chr6"  "chr7"  "chr8"  "chr9"  "chrM"  "chrX"  "chrY" 
Found  chr1 chr10 chr11 chr12 chr13 chr14 chr15 chr16 chr17 chr18 chr19 chr2 chr20 chr21 chr22 chr3 chr4 chr5 chr6 chr7 chr8 chr9  files
Matrix dimension 1 X 1
Performing Z transformation  : complete!
Performing block wise correlation calculation   Error: upper value must be greater than lower value
Execution halted

I have tried processing with all chromosomes, as well as removing chromosome Y, M and Y, and X,Y,M.

These contact matrices are based on about 135 million valid pairs and the contact matrices look like normal Hi-C data visualized with Juicebox. The same error

ay-lab commented 10 months ago

It seems like an issue with the input file format.

Please check this link https://github.com/ay-lab/dcHiC/issues/83#issuecomment-1859047515 to convert the .hic file.

While running dchic, please remove the chrY and chrM instances from the bed file to avoid any further issues.

yardimcilab commented 10 months ago

As I said (and showed in my comment), I did convert the input file format and removed the Y and M chromosomes. So neither of those issues is the problem here.

ay-lab commented 10 months ago

The "Error: upper value must be greater than lower value" means an issue with file conversion. The indices (first and second column) in the .matrix file should be of a particular order. That is, the first column value must be equal to or less than the second column value. If this condition is not satisfied, then the error can occur. Can you check and confirm if this condition is satisfied for the matrix file?