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

Runs into error with genomic region size in megabases #25

Open
ManavalanG opened this issue Jun 16, 2021 · 1 comment
Open

Runs into error with genomic region size in megabases #25

ManavalanG opened this issue Jun 16, 2021 · 1 comment

Comments

@ManavalanG
Copy link

Is there a limit on the size of genomic region that can be plotted using bamsnap? My attempts to plot 1.5MB region failed with this error:

Process proc 1:
Traceback (most recent call last):
  File ".conda/envs/bamsnap/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File ".conda/envs/bamsnap/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File ".conda/envs/bamsnap/lib/python3.9/site-packages/bamsnap/bamsnap.py", line 235, in run_process_drawplot_bamlist
    imagefname = bsplot.drawplot_bamlist(pos1, image_w, bamlist, xscale, refseq)
  File ".conda/envs/bamsnap/lib/python3.9/site-packages/bamsnap/bamsnap.py", line 467, in drawplot_bamlist
    ia = self.append_coordinates_image(ia, pos1, image_w, xscale)
  File ".conda/envs/bamsnap/lib/python3.9/site-packages/bamsnap/bamsnap.py", line 430, in append_coordinates_image
    ia_sub = coord.get_image()
  File ".conda/envs/bamsnap/lib/python3.9/site-packages/bamsnap/coordinates.py", line 106, in get_image
    self.draw(dr)
  File ".conda/envs/bamsnap/lib/python3.9/site-packages/bamsnap/coordinates.py", line 62, in draw
    self.cal_axis()
  File ".conda/envs/bamsnap/lib/python3.9/site-packages/bamsnap/coordinates.py", line 52, in cal_axis
    unitlen = 10 ** (len(str(axis_base_unit)) - 1)
UnboundLocalError: local variable 'axis_base_unit' referenced before assignment

Error is occuring due to conditional used with hardcoded list here:

min_base_number = int(self.MIN_AXIS_LABEL_WIDTH / (self.w/self.glen))
for k in [1, 5, 10, 20, 50, 100, 150, 200, 300, 400, 500, 800, 1000, 1500, 2000, 3000, 5000, 10000, 20000, 50000, 100000]:
if min_base_number <= k:
axis_base_unit = k
break

@ManavalanG ManavalanG changed the title Runs into error with genomic region in megabases Runs into error with genomic region size in megabases Jun 16, 2021
@riazgillani
Copy link

Hello - I am experiencing a similar error with large genomic regions. Is there a workaround?

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