aidenlab / straw

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

Potential bug in straw python version #45

Closed BaconZhou closed 3 years ago

BaconZhou commented 4 years ago

Hi,

Thanks for the awesome work!! I just into this field, and try to use straw to get a vanilla matrix from .hic file. There may be a potential bug here.

Line

https://github.com/aidenlab/straw/blob/4d2233652df1088f5530b421b207fe9bd9684600/python/straw/straw.py#L616

        if norm != "NONE":
            c1Norm = futureNorm1.result()
            if isIntra:
                c2Norm = c1Norm
            else:
                c2Norm = futureNorm2.result()
        blockBinCount, blockColumnCount = futureMatrix.result()
        return normalizedmatrix(self.infile, self.is_synapse, binsize, isIntra, neededToFlipIndices, blockBinCount,
                                blockColumnCount, blockMap, norm, c1Norm, c2Norm, self.version)

Describe the bug

When use straw obj to get contact matrix without normalization.

UnboundLocalError: local variable 'c1Norm' referenced before assignment

To Reproduce

import straw
straw.__version__
hicFile = 'test.hic'

strawObj = straw.straw(hicFile)
matObj = strawObj.getNormalizedMatrix('5', '5', 'NONE', 'BP', 10000)

Desktop: