vaquerizaslab / tadtool

TADtool is an interactive tool for the identification of meaningful parameters in TAD-calling algorithms for Hi-C data.
MIT License
43 stars 13 forks source link

Regions must be the same length as rows in matrix! #19

Closed hzaumsq closed 5 years ago

hzaumsq commented 5 years ago

I use the hicpro result for the input,and try twice ,it also meet mistake

(base) []$ tadtool tads iced/40000/sample1_40000_iced.matrix raw/40000/sample1_40000_abs.bed 40000 0.005 tadtools_output.bed
2019-08-30 11:14:34,049 INFO Loading regions...
2019-08-30 11:14:34,066 INFO Calculating index...
2019-08-30 11:14:34,067 INFO Loading matrix Scaffold0...
2019-08-30 11:14:44,333 INFO Loading matrix Scaffold1...
Traceback (most recent call last):
  File "/public/home/csxie/miniconda2/bin/tadtool", line 442, in <module>
    TADtool()
  File "/public/home/csxie/miniconda2/bin/tadtool", line 42, in __init__
    getattr(self, args.command)()
  File "/public/home/csxie/miniconda2/bin/tadtool", line 308, in tads
    raise ValueError("Regions must be the same length as rows in matrix!")
ValueError: Regions must be the same length as rows in matrix!
(base) []$ tadtool tads iced/40000/sample1_40000_iced.matrix raw/20000/sample1_20000_abs.bed 20000 0.005 tadtools_output.bed
2019-08-30 11:17:00,427 INFO Loading regions...
^Z
[7]+  Stopped                 tadtool tads iced/40000/sample1_40000_iced.matrix raw/20000/sample1_20000_abs.bed 20000 0.005 tadtools_output.bed
(base) [csxie@mn02 sample1]$ tadtool tads iced/20000/sample1_20000_iced.matrix raw/20000/sample1_20000_abs.bed 20000 0.005 tadtools_output.bed
2019-08-30 11:17:10,587 INFO Loading regions...
2019-08-30 11:17:10,614 INFO Calculating index...
2019-08-30 11:17:10,614 INFO Loading matrix Scaffold0...
2019-08-30 11:17:37,181 INFO Loading matrix Scaffold1...
Traceback (most recent call last):
  File "/public/home/csxie/miniconda2/bin/tadtool", line 442, in <module>
    TADtool()
  File "/public/home/csxie/miniconda2/bin/tadtool", line 42, in __init__
    getattr(self, args.command)()
  File "/public/home/csxie/miniconda2/bin/tadtool", line 308, in tads
    raise ValueError("Regions must be the same length as rows in matrix!")
ValueError: Regions must be the same length as rows in matrix!
vaquerizaslab-old commented 5 years ago

Hi, I was unable to reproduce the issue with the sample data provided on the HicPro site. From your logging output, it looks like you are working with a custom genome - perhaps this has something to do with the size of the scaffolds you are using as input. To investigate this issue, can you please install the latest TADtool version?

pip install --upgrade tadtool

I have just updated the tool to version 0.79 with more helpful logging output on the issue you have encountered. Then please run the first command you posted again and post the error message. In addition, could you please post the following:

  1. The top 5 lines of both input files (matrix and regions)
  2. The output of the following command: pip freeze | grep tadtool
  3. The output of the following command: cut -f1,1 raw/40000/sample1_40000_abs.bed | sort -k1,1 | uniq -c
  4. The output of the following command: awk 'BEGIN{a=0}{if ($1>0+a) a=$1} END{print a}' iced/40000/sample1_40000_iced.matrix

Then let's see where we go from there! Thanks!

hzaumsq commented 5 years ago

1、pip freeze | grep tadtool tadtool==0.79 2、cut -f1,1 ../../raw/20000/sample1_20000_abs.bed | sort -k1,1 | uniq -c

   1099 Scaffold0
    857 Scaffold1
    513 Scaffold10
    457 Scaffold11
    422 Scaffold12
    392 Scaffold13
    389 Scaffold14
    354 Scaffold15
    334 Scaffold16
    171 Scaffold17
     10 Scaffold18
    765 Scaffold2
    687 Scaffold3
    623 Scaffold4
    614 Scaffold5
    599 Scaffold6
    564 Scaffold7
    519 Scaffold8
    514 Scaffold9

3、awk 'BEGIN{a=0}{if ($1>0+a) a=$1} END{print a}' sample1_20000_iced.matrix 9883 4、head -n 5 sample1_20000_iced.matrix

1   353 1286.213146
1   511 749.025769
1   2521    2152.962144
1   3256    1641.368325
1   3838    1781.179045

5、head -n 5 ../../raw/20000/sample1_20000_abs.bed

Scaffold0   0   20000   1
Scaffold0   20000   40000   2
Scaffold0   40000   60000   3
Scaffold0   60000   80000   4
Scaffold0   80000   100000  5
hzaumsq commented 5 years ago

Now the error like this !

2019-09-03 20:40:19,734 INFO Loading matrix Scaffold1...
Traceback (most recent call last):
  File "/home/sqmao/miniconda2/bin/tadtool", line 445, in <module>
    TADtool()
  File "/home/sqmao/miniconda2/bin/tadtool", line 42, in __init__
    getattr(self, args.command)()
  File "/home/sqmao/miniconda2/bin/tadtool", line 309, in tads
    chromosome_regions[chromosome], matrix.shape[0]
ValueError: Regions ([<tadtool.tad.GenomicRegion object at 0x7f8287ced4d0>, <tadtool.tad.GenomicRegion object at 0x7f8287ced450>, <tadtool.tad.GenomicRegion object at 0x7f8287ced510>, <tadtool.tad.GenomicRegion object at 0x7f8287ced550>, <tadtool.tad.GenomicRegion object at 0x7f8287ced590>, <tadtool.tad.GenomicRegion object at 0x7f8287ced490>, <tadtool.tad.GenomicRegion object at 0x7f8287ced5d0>, <tadtool.tad.GenomicRegion object at 0x7f8287ced610>, <tadtool.tad.GenomicRegion object at 0x7f8287ced650>, <tadtool.tad.GenomicRegion object at 0x7f8287ced690>, <tadtool.tad.GenomicRegion object at 0x7f8287ced6d0>, <tadtool.tad.GenomicRegion object at 0x7f8287ced710>, <tadtool.tad.GenomicRegion object at 0x7f8287ced750>, <tadtool.tad.GenomicRegion object at 0x7f8287ced790>, <tadtool.tad.GenomicRegion object at 0x7f8287ced7d0>, <tadtool.tad.GenomicRegion object at 0x7f8287ced810>, <tadtool.tad.GenomicRegion object at 0x7f8287ced850>, <tadtool.tad.GenomicRegion object at 0x7f8287ced890>, <tadtool.tad.GenomicRegion object at 0x7f8287ced8d0>, <tadtool.tad.GenomicRegion object at 0x7f8287ced910>, <tadtool.tad.GenomicRegion object at 0x7f8287ced950>, <tadtool.tad.GenomicRegion object at 0x7f8287ced990>, <tadtool.tad.GenomicRegion object at 0x7f8287ced9d0>, <tadtool.tad.GenomicRegion object at 0x7f8287ceda10>, <tadtool.tad.GenomicRegion object at 0x7f8287ceda50>, <tadtool.tad.GenomicRegion object at 0x7f8287ceda90>, <tadtool.tad.GenomicRegion object at 0x7f8287cedad0>, <tadtool.tad.GenomicRegion object at 0x7f8287cedb10>, <tadtool.tad.GenomicRegion object at 0x7f8287cedb50>, <tadtool.tad.GenomicRegion object at 0x7f8287cedb90>, <tadtool.tad.GenomicRegion object at 0x7f8287cedbd0>, <tadtool.tad.GenomicRegion object at 0x7f8287cedc10>, <tadtool.tad.GenomicRegion object at 0x7f8287cedc50>, <tadtool.tad.GenomicRegion object at 0x7f8287cedc90>, <tadtool.tad.GenomicRegion object at 0x7f8287cedcd0>, <tadtool.tad.GenomicRegion object at 0x7f8287cedd10>, <tadtool.tad.GenomicRegion object at 0x7f8287cedd50>, <tadtool.tad.GenomicRegion object at 0x7f8287cedd90>, <tadtool.tad.GenomicRegion object at 0x7f8287ceddd0>, <tadtool.tad.GenomicRegion object at 0x7f8287cede10>, <tadtool.tad.GenomicRegion object at 0x7f8287cede50>, <tadtool.tad.GenomicRegion object at 0x7f8287cede90>
vaquerizaslab-old commented 5 years ago

Sorry, I missed a function call there, can you please try again with the fixed version?

pip install --upgrade tadtool

This should upgrade to 0.80. And then just post the error message again. Thanks!

hzaumsq commented 5 years ago

@vaquerizaslab

pip freeze | grep tadtool
tadtool==0.80
Traceback (most recent call last):
  File "/home/sqmao/miniconda2/bin/tadtool", line 445, in <module>
    TADtool()
  File "/home/sqmao/miniconda2/bin/tadtool", line 42, in __init__
    getattr(self, args.command)()
  File "/home/sqmao/miniconda2/bin/tadtool", line 309, in tads
    chromosome_regions[chromosome], matrix.shape[0]
ValueError: Regions ([<tadtool.tad.GenomicRegion object at 0x7fbbe4f374d0>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37450>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37510>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37550>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37590>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37490>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f375d0>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37610>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37650>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37690>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f376d0>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37710>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37750>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37790>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f377d0>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37810>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37850>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37890>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f378d0>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37910>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37950>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37990>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f379d0>, <tadtool.tad.GenomicRegion object at 0x7fbbe4f37a10>, 
vaquerizaslab-old commented 5 years ago

Thank you.

Though it looks like your update did not fully work (the fix that I uploaded for the error message did not make it to your error message, despite showing the correct version), I found the issue and fixed it in the latest version. Please update again to version 0.81:

pip install --upgrade tadtool

hzaumsq commented 5 years ago

@vaquerizaslab It works for me ! 66666! Thank you !