YeoLab / outrigger

Create a *de novo* alternative splicing database, validate splicing events, and quantify percent spliced-in (Psi) from RNA seq data
http://yeolab.github.io/outrigger/
BSD 3-Clause "New" or "Revised" License
62 stars 22 forks source link

Distinguish last_read_pos == 0 and last_read_pos is None #97

Closed gokceneraslan closed 4 years ago

gokceneraslan commented 4 years ago

Hi,

I really like the project, it's very unfortunate that it's not maintained anymore.

In the _report_read_positions(read, counter) function in io.bam.py, if the the following loop:

    last_read_pos = False
    for read_loc, genome_loc in read.get_aligned_pairs():
        ...

proceeds with the following sequence:

read_loc:               0 genome_loc:        15283628 last_read_pos:           False
read_loc:            None genome_loc:        15283629 last_read_pos:               0
read_loc:            None genome_loc:        15283630 last_read_pos:            None
read_loc:            None genome_loc:        15283631 last_read_pos:            None

...

read_loc:            None genome_loc:        15284476 last_read_pos:            None
read_loc:               1 genome_loc:        15284477 last_read_pos:            None

if read_loc is None and last_read_pos: condition cannot distinguish whether last_read_pos is 0 or None and this leads to the UnboundLocalError: local variable 'start' referenced before assignment exception.

This PR fixes that.

Fixes #83

olgabot commented 4 years ago

Thanks for the fix! Unfortunately I have not had the bandwidth to maintain this project as much as I would like. It's strange that the Travis CI builds aren't getting triggered anymore.