I have a bigWig file with the following profile:

    bigWigInfo uniqueness.bw
    version: 4
    isCompressed: yes
    isSwapped: 0
    primaryDataSize: 919,783,047
    primaryIndexSize: 97,088,256
    zoomLevels: 10
    chromCount: 25
    basesCovered: 3,095,693,183
    mean: 0.828284
    min: 0.000000
    max: 1.000000
    std: 0.361063

I would like to create a bed for all regions with value < 1.

More generally, I'd like to be able to threshold a bigWig on a value and get all regions above or below that value in bed format.

Thanks a lot!
Copy-pasting from [where you cross-posted](https://bioinformatics.stackexchange.com/questions/2800/bigwig-to-bed-for-regions-above-below-threshold/2801#2801):

You can do that with a bit of python:

    #!/usr/bin/env python
    import pyBigWig
    threshold = 10  # Change me
    bw = pyBigWig.open("file.bw")  # Change me
    of = open("regions.bed", "w")  # Change me
    
    for chrom, len in bw.chroms().items():
        intervals = bw.intervals(chrom)
        for interval in interals:
            if abs(interval[2]) > threshold:
                of.write("{}\t{}\t{}\n".format(chrom, interval[0], interval[1]))
    bw.close()
    of.close()

You'll need to install pyBigWig (it's available via pip or conda install) and change the lines with Change me in them.
