Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: index -1 is out of bounds for axis 0 with size 0 #18

Open
Wyinghao opened this issue Aug 4, 2022 · 6 comments
Open

IndexError: index -1 is out of bounds for axis 0 with size 0 #18

Wyinghao opened this issue Aug 4, 2022 · 6 comments

Comments

@Wyinghao
Copy link

Wyinghao commented Aug 4, 2022

Hi,I read the HiTAD article published on NAR,It's a great piece of software,I want to try to use HiTAD to identify TADs for several fish species.I converted the HiC-Pro results into a cool file via hitxplorer, and I also tried to convert the HiC-Pro into a cool file through the pairliftover software you developed.I then tried ran HiTAD twice via hitad -O test.txt -d meta_file -W RAW --exclude chrW chrM --logFile hitad.log (Based on hipxplorer conversion)and hitad -O test.txt -d meta_file --logFile hitad.log (Based on the payliftover conversion)respectively.However, the following error will be reported every time.

tadlib.hitad.genomeLev    DEBUG   @ 08/03/22 22:23:57: Chrom ptg000059l_1647000_1665999:
tadlib.hitad.genomeLev    DEBUG   @ 08/03/22 22:23:57:   resolution: 50000, rep1
tadlib.hitad.genomeLev    DEBUG   @ 08/03/22 22:23:57:   Cache Chrom object into /share/home/stu_wangyinghao/project/fish/SPS/output_dir/newtad/.hitad/tmp7gq5tupd20220803222357 ...
tadlib.hitad.genomeLev    DEBUG   @ 08/03/22 22:24:00: Chrom ptg000226l_145000_146999:
tadlib.hitad.genomeLev    DEBUG   @ 08/03/22 22:24:00:   resolution: 50000, rep1
tadlib.hitad.genomeLev    DEBUG   @ 08/03/22 22:24:00:   Cache Chrom object into /share/home/stu_wangyinghao/project/fish/SPS/output_dir/newtad/.hitad/tmpqyczqsen20220803222400 ...
tadlib.hitad.genomeLev    DEBUG   @ 08/03/22 22:24:03: Chrom ptg000102l_269000_269999:
tadlib.hitad.genomeLev    DEBUG   @ 08/03/22 22:24:03:   resolution: 50000, rep1
tadlib.hitad.genomeLev    DEBUG   @ 08/03/22 22:24:03:   Cache Chrom object into /share/home/stu_wangyinghao/project/fish/SPS/output_dir/newtad/.hitad/tmpb6nue8_f20220803222403 ...
tadlib.hitad.genomeLev    DEBUG   @ 08/03/22 22:24:06: Chrom ptg000013l_375000_454999:
tadlib.hitad.genomeLev    DEBUG   @ 08/03/22 22:24:06:   resolution: 50000, rep1
tadlib.hitad.genomeLev    DEBUG   @ 08/03/22 22:24:06:   Cache Chrom object into /share/home/stu_wangyinghao/project/fish/SPS/output_dir/newtad/.hitad/tmp3bccvaoz20220803222406 ...
tadlib.hitad.genomeLev    DEBUG   @ 08/03/22 22:24:09: Chrom ptg000195l_628000_651999:
tadlib.hitad.genomeLev    DEBUG   @ 08/03/22 22:24:09:   resolution: 50000, rep1
tadlib.hitad.genomeLev    DEBUG   @ 08/03/22 22:24:09:   Cache Chrom object into /share/home/stu_wangyinghao/project/fish/SPS/output_dir/newtad/.hitad/tmp6d6vitey20220803222409 ...
root                      INFO    @ 08/03/22 22:24:12: Done!
root                      DEBUG   @ 08/03/22 22:24:12: Learning HMM parameters for each dataset ...
tadlib.hitad.genomeLev    DEBUG   @ 08/03/22 22:24:12:   resolution: 50000, rep1
Traceback (most recent call last):
  File "/share/home/stu_wangyinghao/miniconda3/envs/py36/bin/hitad", line 121, in run
    G.learning(cpu_core=args.cpu_core)
  File "/share/home/stu_wangyinghao/miniconda3/envs/py36/lib/python3.6/site-packages/tadlib/hitad/genomeLev.py", line 199, in learning
    seqs = self.train_data(res, rep)
  File "/share/home/stu_wangyinghao/miniconda3/envs/py36/lib/python3.6/site-packages/tadlib/hitad/genomeLev.py", line 175, in train_data
    tmpcache.minWindows(0, tmpcache.chromLen, tmpcache._dw)
  File "/share/home/stu_wangyinghao/miniconda3/envs/py36/lib/python3.6/site-packages/tadlib/hitad/chromLev.py", line 284, in minWindows
    ws = self.oriWindow(diff[self._rm+1:])
  File "/share/home/stu_wangyinghao/miniconda3/envs/py36/lib/python3.6/site-packages/tadlib/hitad/chromLev.py", line 239, in oriWindow
    inds = [self.detectPeaks(trends_1, 0.5, 5),
  File "/share/home/stu_wangyinghao/miniconda3/envs/py36/lib/python3.6/site-packages/tadlib/hitad/chromLev.py", line 157, in detectPeaks
    if dx[-1] > 0:
IndexError: index -1 is out of bounds for axis 0 with size 0

I am very puzzled, please help me answer it in your busy schedule, thank you very much

@XiaoTaoWang
Copy link
Owner

Hi, I think this error was caused by some extremely small or unassembled chromosomes in your genome. I just released a new TADLib version (v0.4.4) by adding a parameter --minimum-chrom-size to hitad, to that you can filter out these chromosomes according to chromosome sizes. Can you upgrade your TADlib to this version and let me know whether it works? Thanks!

@XiaoTaoWang
Copy link
Owner

To upgrade your TADlib, just run pip install -U TADLib

@Wyinghao
Copy link
Author

Wyinghao commented Aug 5, 2022

Thank you very much!After adding this parameter--minimum-chrom-size, it can already be used !Now I'm ready to use the TAD visualization module,I see that the result is only outputting the loci file of the TAD,Can this be visualized?

@XiaoTaoWang
Copy link
Owner

Yes. The output from HiTAD can be directly used as an input to the visualization module: https://xiaotaowang.github.io/TADLib/visualize.html

@Wyinghao
Copy link
Author

Wyinghao commented Aug 5, 2022

ok!Thank you very much!

@Wyinghao
Copy link
Author

Wyinghao commented Aug 7, 2022

Sorry I'm bothering you again,I succesful to identify TADs in five of the six species,I've been using the same command hitad -O test1.txt -d meta_file -W RAW --minimum-chrom-size 20000000 --exclude chrW chrM --logFile hitad.logacross six species, but I made a mistake in identifying one of them,It makes me feel weird.The error is as follows,He was stuck here and didn't move:

(base) user@compute:/data/project/TAD/Caa$ hitad -O test1.txt -d meta_file -W RAW --minimum-chrom-size 20000000 --exclude chrW chrM --logFile hitad.log
root                      INFO    @ 08/07/22 18:51:27: 
# ARGUMENT LIST:
# Output file name = test1.txt
# Hi-C datasets = {40000: {'rep1': '/data/project/TAD/Caa/Caa_40000.cool'}}
# Column for matrix balancing = RAW
# Excluded chromosomes = ['chrW', 'chrM']
# Minimum Chromosome Size = 20000000
# Maximum domain size = 4000000
# Column for DI track = DIs
# Number of processes used = 1
# Remove cache data = False
# Log file name = hitad.log
numexpr.utils             INFO    @ 08/07/22 18:51:28: Note: detected 160 virtual cores but NumExpr set to maximum of 64, check "NUMEXPR_MAX_THREADS" environment variable.
numexpr.utils             INFO    @ 08/07/22 18:51:28: Note: NumExpr detected 160 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
numexpr.utils             INFO    @ 08/07/22 18:51:28: NumExpr defaulting to 8 threads.

Bad key "text.kerning_factor" on line 4 in
/home/user/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test_patch.mplstyle.
You probably need to get an updated matplotlibrc file from
https://github.com/matplotlib/matplotlib/blob/v3.1.3/matplotlibrc.template
or from the matplotlib source distribution
root                      INFO    @ 08/07/22 18:51:30: Parsing Hi-C datasets ...
root                      INFO    @ 08/07/22 18:54:36: Done!
root                      INFO    @ 08/07/22 18:55:59: Identifying hierarchical domains ...
Process SubProcess-1:
Traceback (most recent call last):
  File "/home/user/anaconda3/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/home/user/anaconda3/lib/python3.7/site-packages/tadlib/hitad/genomeLev.py", line 256, in run
    worker(chrom, res, rep)
  File "/home/user/anaconda3/lib/python3.7/site-packages/tadlib/hitad/genomeLev.py", line 263, in worker
    curChrom.callDomain()
  File "/home/user/anaconda3/lib/python3.7/site-packages/tadlib/hitad/chromLev.py", line 762, in callDomain
    self.oriIter({})
  File "/home/user/anaconda3/lib/python3.7/site-packages/tadlib/hitad/chromLev.py", line 690, in oriIter
    tmpDomains = self.minCore(self.regionDIs)
  File "/home/user/anaconda3/lib/python3.7/site-packages/tadlib/hitad/chromLev.py", line 558, in minCore
    domains = self.pipe(seq, region[0])
  File "/home/user/anaconda3/lib/python3.7/site-packages/tadlib/hitad/chromLev.py", line 528, in pipe
    bounds = self._getBounds(self.viterbi(seq), junctions=['30'])
  File "/home/user/anaconda3/lib/python3.7/site-packages/tadlib/hitad/chromLev.py", line 458, in viterbi
    path = [int(s.name) for i, s in self.hmm.viterbi(seq)[1][1:-1]]
TypeError: 'NoneType' object is not subscriptable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants