X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=erange.git;a=blobdiff_plain;f=geneLocusBins.py;fp=geneLocusBins.py;h=03cade292225b55513b300a0fca2d8f2c4f5d50a;hp=49745dc0c1361c2a8dbe4736c9c8630396fd93e4;hb=03f1e0b3bab22d517ad75b9af4d54e8fcb8540fb;hpb=b54eee5365a0fad35d2f6168eaac82ff5a359222 diff --git a/geneLocusBins.py b/geneLocusBins.py index 49745dc..03cade2 100755 --- a/geneLocusBins.py +++ b/geneLocusBins.py @@ -138,7 +138,7 @@ def writeBins(gidList, geneinfoDict, gidBins, gidLen, outfilename, normalizeBins try: geneinfo = geneinfoDict[gid] symbol = geneinfo[0][0] - except KeyError: + except (KeyError, IndexError): pass else: symbol = gid @@ -154,6 +154,7 @@ def writeBins(gidList, geneinfoDict, gidBins, gidLen, outfilename, normalizeBins try: normalizedValue = 100. * binAmount / tagCount except ZeroDivisionError: + #TODO: QForALi - this is the right way to refactor the original code, but I don't think this is the right answer normalizedValue = 100. * binAmount binAmount = normalizedValue @@ -167,4 +168,4 @@ def writeBins(gidList, geneinfoDict, gidBins, gidLen, outfilename, normalizeBins if __name__ == "__main__": - main(sys.argv) + main(sys.argv) \ No newline at end of file