Example #1
0
# ------------------------------------
# Misc functions
# ------------------------------------

# ------------------------------------
# Classes
# ------------------------------------

# ------------------------------------
# Main
# ------------------------------------

if __name__=="__main__":
    # get information from bigwig file
    wWigIO.open('test.bw')
    chroms = wWigIO.getChromSize('test.bw')
    wigs = wWigIO.getIntervals('test.bw', 'chr1', 10, 200)
    wWigIO.close('test.bw')
    print wigs

    # bigwig -> wig
    wWigIO.bigWigToWig('test.bw','test.wig')

    # write the chrom sizes into test.sizes
    with open('test.sizes','w') as fh:
        for chrom in chroms:
            print >>fh, chrom+"\t"+str(chroms[chrom])
    
    # wig -> bigwig
    wWigIO.wigToBigWig('test.wig','test.sizes','test2.bw')
Example #2
0
 def getChromSizesWigIO(self):
     wWigIO.open(self.path)
     out = wWigIO.getChromSize(self.path)
     out = dict(zip(out[0], out[1]))
     wWigIO.close(self.path)
     return out
Example #3
0
 def chromSizes(self):
     ''' Get chromosome sizes.'''
     chroms=wWigIO.getChromSize(self.fname)
     return chroms