bamsnap icon indicating copy to clipboard operation
bamsnap copied to clipboard

PacBio CCS reads support

Open sjin09 opened this issue 3 years ago • 3 comments

I was wondering if bamsnap supports PacBio CCS reads. When I use bamsnap with my CCS bam files, it produces the following error:

Traceback (most recent call last):
  File "/Users/sl17/Languages/python3/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/Users/sl17/Languages/python3/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/sl17/Languages/python3/lib/python3.8/site-packages/bamsnap/bamsnap.py", line 235, in run_process_drawplot_bamlist
    imagefname = bsplot.drawplot_bamlist(pos1, image_w, bamlist, xscale, refseq)
  File "/Users/sl17/Languages/python3/lib/python3.8/site-packages/bamsnap/bamsnap.py", line 473, in drawplot_bamlist
    ia_sub = self.get_bamplot_image(bam, pos1, image_w, xscale, refseq)
  File "/Users/sl17/Languages/python3/lib/python3.8/site-packages/bamsnap/bamsnap.py", line 383, in get_bamplot_image
    ia_sub = rset.get_image(
  File "/Users/sl17/Languages/python3/lib/python3.8/site-packages/bamsnap/drawreadset.py", line 350, in get_image
    self.draw_read(dr, group, readcolor, readcolorby)
  File "/Users/sl17/Languages/python3/lib/python3.8/site-packages/bamsnap/drawreadset.py", line 357, in draw_read
    r.yidx = self.get_yidx(r, group)
  File "/Users/sl17/Languages/python3/lib/python3.8/site-packages/bamsnap/drawreadset.py", line 199, in get_yidx
    self.readmap[gpos][group] = []
KeyError: 2725160
2021-08-05 14:22:24,744 : [INFO] Total running time: 3.1 sec

The command that I have used is:

bamsnap -bam input.bam -pos 20:2740569  -refversion hg19  -out chr20_2740569

sjin09 avatar Aug 05 '21 13:08 sjin09

I am having a similar issue with ONP reads mapped using minimap2

Noonanav avatar Mar 30 '23 17:03 Noonanav

We are also having the same issue with ONT reads mapped using minimap2, with the following error message:

Process proc 1:
Traceback (most recent call last):
  File "/home/bygul/.local/lib/python3.8/site-packages/bamsnap/drawreadset.py", line 191, in get_yidx
    yidx = self.yidxmap[group][r.id]
KeyError: 'all'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bygul/.local/lib/python3.8/site-packages/bamsnap/drawreadset.py", line 197, in get_yidx
    self.readmap[gpos][group]
KeyError: 765

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/bygul/.local/lib/python3.8/site-packages/bamsnap/bamsnap.py", line 235, in run_process_drawplot_bamlist
    imagefname = bsplot.drawplot_bamlist(pos1, image_w, bamlist, xscale, refseq)
  File "/home/bygul/.local/lib/python3.8/site-packages/bamsnap/bamsnap.py", line 473, in drawplot_bamlist
    ia_sub = self.get_bamplot_image(bam, pos1, image_w, xscale, refseq)
  File "/home/bygul/.local/lib/python3.8/site-packages/bamsnap/bamsnap.py", line 383, in get_bamplot_image
    ia_sub = rset.get_image(
  File "/home/bygul/.local/lib/python3.8/site-packages/bamsnap/drawreadset.py", line 350, in get_image
    self.draw_read(dr, group, readcolor, readcolorby)
  File "/home/bygul/.local/lib/python3.8/site-packages/bamsnap/drawreadset.py", line 357, in draw_read
    r.yidx = self.get_yidx(r, group)
  File "/home/bygul/.local/lib/python3.8/site-packages/bamsnap/drawreadset.py", line 199, in get_yidx
    self.readmap[gpos][group] = []
KeyError: 765
2023-05-05 10:24:49,873 : [INFO] Total running time: 0.5 sec

SieglindeCoppens avatar May 05 '23 08:05 SieglindeCoppens

I have a similar issue. We found that bamsnap can not deal with long cigar strings in BAM generated by CCS or ONT. So we guess bansnap was not designed for long read mapping.

We have made a revised version of bamsnap for long-read mapping. It looks working well for most conditions. you can find it form this repo

comery avatar Aug 09 '23 09:08 comery