hoffmangroup / segway

Application for semi-automated genomic annotation.
http://segway.hoffmanlab.org/
GNU General Public License v2.0
13 stars 7 forks source link

segway-layer bigBed conversion fails when blockSize == 0 #22

Closed EricR86 closed 9 years ago

EricR86 commented 9 years ago

Original report (BitBucket issue) by Jay Hesselberth (Bitbucket: jayhesselberth, GitHub: jayhesselberth).


bigBed conversion is failing in segway-layer, it appears this is because the blockSizes begin with 0 instead of 1. Here's an example from within the simpleseg test:

#!python

jayhesselberth@urburp ~/devel/segway/test/simpleseg/test-20141020.VYnG8M/identifydir
$ segway-layer -b segway.layered.bb segway.bed.gz 
track autoScale=off description="segway 4-label segmentation of testtrack1, testtrack2" viewLimits=0:1 visibility=full name=segway.034364de589011e4ac68542696df0d9d itemRgb=on

chr1    0   8000    1   1000    .   0   8000    217,95,2    3   2000,2000,1 0,4000,7999
chr1    0   8000    2   1000    .   0   8000    117,112,179 4   0,1000,1000,1   0,2000,6000,7999
chr1    0   8000    3   1000    .   0   8000    231,41,138  3   0,1000,1000 0,3000,7000
pass1 - making usageList (1 chroms): 0 millis
Error line 2 of /var/folders/s5/dh_w3yds5qx9gl409s178_qw0000gn/T/segway2UkENz.bed: BED blockSizes must be greater than 0, blockSize[0] = 0
Traceback (most recent call last):
  File "/usr/local/bin/segway-layer", line 9, in <module>
    load_entry_point('segway==1.2', 'console_scripts', 'segway-layer')()
  File "/usr/local/lib/python2.7/site-packages/segway/layer.py", line 393, in main
    *args)
  File "/usr/local/lib/python2.7/site-packages/segway/layer.py", line 358, in layer
    segmentation.save(outfilename, bigbed_outfilename)
  File "/usr/local/lib/python2.7/site-packages/segway/layer.py", line 270, in save
    BEDTOBIGBED_PROG(bigbed_infilename, sizes_file.name, bigbed_outfilename)
  File "/usr/local/lib/python2.7/site-packages/segway/layer.py", line 270, in save
    BEDTOBIGBED_PROG(bigbed_infilename, sizes_file.name, bigbed_outfilename)
  File "/usr/local/lib/python2.7/site-packages/optbuild.py", line 81, in __call__
    return self.run(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/optbuild.py", line 212, in run
    self._getoutput(args, kwargs)
  File "/usr/local/lib/python2.7/site-packages/optbuild.py", line 194, in _getoutput
    stdin, stdout, stderr, cwd)
  File "/usr/local/lib/python2.7/site-packages/optbuild.py", line 157, in _popen
    _returncode_error_factory(cmdline, returncode, output, error)
  File "/usr/local/lib/python2.7/site-packages/optbuild.py", line 57, in _returncode_error_factory
    raise error_cls, (cmdline, returncode, output, error)
optbuild.ReturncodeError: bedToBigBed returned 255
EricR86 commented 9 years ago

Original comment by Jay Hesselberth (Bitbucket: jayhesselberth, GitHub: jayhesselberth).


EricR86 commented 9 years ago

Original comment by Jay Hesselberth (Bitbucket: jayhesselberth, GitHub: jayhesselberth).


Pull request #14 submitted.

EricR86 commented 9 years ago

Original comment by Michael Hoffman (Bitbucket: hoffman, GitHub: michaelmhoffman).


EricR86 commented 9 years ago

Original comment by Eric Roberts (Bitbucket: ericr86, GitHub: ericr86).


Motivation for this patch: UCSC track hubs require bigBed files. segway 1.2 cannot generate bigBed files (see issue #22).

Patched layer.py to make sure that the segment added as a pad has length 1 instead of 0.

Updated segway.layered.bed and segway.layered.bb in test/segway_layer/touchstone. Tests pass.

Visual inspection of the old and new outputs in the browser shows that this creates a segment of length 1 at the first chromosomal coordinate. But I don't see any way around this, as bedToBigBed requires bedSizes > 0.

Another side effect is that I hard coded the -b option in the test, which means that 1 of the 2 tests will fail on machines where the bedToBigBed executable is not installed.

→ \<\<cset 0fa5d5140ee9dfbaa6f076ad579cd21c4bd76018>>

EricR86 commented 9 years ago

Original comment by Eric Roberts (Bitbucket: ericr86, GitHub: ericr86).


Update NEWS with test baselines with non-zero blockSizes to fix issue #22

→ \<\<cset bb37905402c2c5d32640c156f1475286561b021f>>

EricR86 commented 9 years ago

Original comment by Eric Roberts (Bitbucket: ericr86, GitHub: ericr86).


Resolved from pull request: https://hoffmangroup.github.io//#!/hoffmanlab/segway/pull-request/14/fix-layerpy-bigbed-conversion-issue-22

Followed by test-wide updates to baselines and NEWS update