parklab / bamsnap

MIT License
109 stars 23 forks source link

Error about reference index #14

Open sylee623 opened 3 years ago

sylee623 commented 3 years ago

my command was

bamsnap -bam ./NA12878.final.cram -pos chr11:12314 -out ./test.png

It worked well but suddenly it didn't work with error below.

Traceback (most recent call last): File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run self._target(*self._args, **self._kwargs) File "/home/sylee/.local/lib/python3.6/site-packages/bamsnap/bamsnap.py", line 227, in run_process_drawplot_bamlist refseq = rseq.get_refseq(pos1) File "/home/sylee/.local/lib/python3.6/site-packages/bamsnap/bamsnap.py", line 535, in get_refseq refseq = self.get_refseq_from_ucsc(pos1) File "/home/sylee/.local/lib/python3.6/site-packages/bamsnap/bamsnap.py", line 575, in get_refseq_from_ucsc refseq[gpos] = seq[i] IndexError: string index out of range

how can I fix this problem?

ankit-21 commented 2 years ago

I am facing the same issue as the OP. When I run the command

bamsnap -bam BAMs/NA18-281_CID21-7767_B21-613.BAM_ETC-RUO.bam -bed regions.bed -out snapshots

I get the error as follows: Traceback (most recent call last): File "/Users/ankit/Desktop/ETCR-BMO-206/venv/bin/bamsnap", line 8, in sys.exit(cli()) File "/Users/ankit/Desktop/ETCR-BMO-206/venv/lib/python3.8/site-packages/bamsnap/init.py", line 7, in cli opt = get_options() File "/Users/ankit/Desktop/ETCR-BMO-206/venv/lib/python3.8/site-packages/bamsnap/_options.py", line 209, in get_options check_option(opt) File "/Users/ankit/Desktop/ETCR-BMO-206/venv/lib/python3.8/site-packages/bamsnap/_options.py", line 165, in check_option opt['poslist'] = set_pos_list(opt) File "/Users/ankit/Desktop/ETCR-BMO-206/venv/lib/python3.8/site-packages/bamsnap/_options.py", line 131, in set_pos_list p1['t_pos'] = int(arr[1]) IndexError: list index out of range

I have tried both the dockerized container and running locally by installing bamsnap from the pypi. I get the same errors for both the cases. Any information/help regarding the issue will be helpful.

Thanks.

ankit-21 commented 2 years ago

Apparently this issue was caused by the bed file I was using as input. The formatting of bed file was not appropriate and when the lines were split based on tabs (in the _options.py file line 127), the function wasn't able to split the lines properly. By reformatting the bed files, I was able to resolve this issue. Once again, thanks for this awesome tool! :)