def write(self,fnwig,span=1):
        """Write the wig in a variable step wiggle format.
        
        Parameters:
        1. fnwig: wig file name
        2. span: span for each bar (default=1bp)
        """
        
        fwig=open(fnwig,'w')
        chroms=self.get_chroms()
        
        for chrom in chroms:
            fwig.write('track type=wiggle_0\nvariableStep chrom=%s span=%d\n' %(chrom,span))
            for i in xrange(0,len(self.wig[chrom][0])):
                fwig.write("%d\t%f\n" %(self.wig[chrom][0][i],self.wig[chrom][1][i]))
        
        fwig.close()
dataset/ETHPy150Open taoliu/taolib/Assoc/inout.py/Wig.write/original