Adamtaranto / frisk

Screen genomic scaffolds for regions of unusual k-mer composition.
http://adamtaranto.github.io/frisk/
GNU General Public License v3.0
2 stars 3 forks source link

Pybedtools update fucks float to BED conversion. #16

Closed Adamtaranto closed 9 years ago

Adamtaranto commented 9 years ago
def thresholdList(intervalList, threshold, args, threshCol=3, merge=True):
    if args.findSelf:
        tItems = [t for t in intervalList if np.log10(t[3]) <= threshold]
    else:
        tItems = [t for t in intervalList if np.log10(t[3]) >= threshold]
    sItems = sorted(tItems, key=itemgetter(0, 1, 2))
    anomaliesBED  = pybedtools.BedTool(sItems) ##Fails here! cannot deal with float (KLI) at index 3.
    if merge:
        anomalies = anomaliesBED.merge(d=args.mergeDist, c='4,4,4', o='max,min,mean')
    else:
        anomalies = anomaliesBED
    return anomalies

Possible solution: Change lines 1158 and 1161 (window data), to store windowKLI, PI, SI, and CRI and strings. Have thresholdList() convert back to float for thresholding window records.

Although, this will probably still leave line 549 pretty fucked when pybedtools trys to do merge stats on strings:

anomalies = anomaliesBED.merge(d=args.mergeDist, c='4,4,4', o='max,min,mean')

Have raised Pybedtools issue, with any luck they will just fix it: https://github.com/daler/pybedtools/issues/150

Adamtaranto commented 9 years ago

Could just require older version of pybedtools as an intermediate fix?

Adamtaranto commented 9 years ago

Yep, changed setup.py require to pybedtools 0.6.9 - works fine.

Action: Wait for pybedtools to fix it.

Adamtaranto commented 9 years ago

Pybedtools no longer support conversion of floats to strings in the BedTool conversion function....

Have updated frisk to preprocess floats to strings.

Fixed.