aidenlab / straw

Extract data quickly from Juicebox via straw
MIT License
62 stars 36 forks source link

straw.py contains a typo that breaks code #31

Closed proinde closed 5 years ago

proinde commented 5 years ago

In line 384 in the readBlock function, there's a variable "countsnot" which should simply be "counts":

` elif (type_== 2):

        temp=14

        nPts = struct.unpack('<i',uncompressedBytes[temp:(temp+4)])[0]

        temp=temp+4

        w = struct.unpack('<h',uncompressedBytes[temp:(temp+2)])[0]

        temp=temp+2

        for i in range(nPts):

            row=int(i/w)

            col=i-row*w

            bin1=int(binXOffset+col)

            bin2=int(binYOffset+row)

            if (useShort==0):

                c = struct.unpack('<h',uncompressedBytes[temp:(temp+2)])[0]

                temp=temp+2

                if (c != -32768):

                    record = dict()

                    record['binX'] = bin1

                    record['binY'] = bin2

                    record['counts'] = c

                    v.append(record)

                    index = index + 1

            else:

                counts = struct.unpack('<f',uncompressedBytes[temp:(temp+4)])[0]

                temp=temp+4

                if (countsnot != 0x7fc00000): #<-----------------here

                    record = dict()

                    record['binX'] = bin1

                    record['binY'] = bin2

                    record['counts'] = counts

                    v.append(record)

                    index = index + 1

return v`
nchernia commented 5 years ago

Thanks for the catch - what file was this?

On Wed, May 1, 2019 at 1:59 PM Matthew Pendleton notifications@github.com wrote:

In line 384 in the readBlock function, there's a variable "countsnot" which should simply be "counts":

` elif (type_== 2):

    temp=14

    nPts = struct.unpack('<i',uncompressedBytes[temp:(temp+4)])[0]

    temp=temp+4

    w = struct.unpack('<h',uncompressedBytes[temp:(temp+2)])[0]

    temp=temp+2

    for i in range(nPts):

        row=int(i/w)

        col=i-row*w

        bin1=int(binXOffset+col)

        bin2=int(binYOffset+row)

        if (useShort==0):

            c = struct.unpack('<h',uncompressedBytes[temp:(temp+2)])[0]

            temp=temp+2

            if (c != -32768):

                record = dict()

                record['binX'] = bin1

                record['binY'] = bin2

                record['counts'] = c

                v.append(record)

                index = index + 1

        else:

            counts = struct.unpack('<f',uncompressedBytes[temp:(temp+4)])[0]

            temp=temp+4

            if (countsnot != 0x7fc00000): #<-----------------here

                record = dict()

                record['binX'] = bin1

                record['binY'] = bin2

                record['counts'] = counts

                v.append(record)

                index = index + 1

return v`

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/aidenlab/straw/issues/31, or mute the thread https://github.com/notifications/unsubscribe-auth/AAK2EWYGAPWL5NNNNLPVLGDPTHK7JANCNFSM4HJVE65A .

-- Neva Cherniavsky Durand, Ph.D. Staff Scientist, Aiden Lab www.aidenlab.org