import os

import matplotlib as mpl

import pandas as pd;
import numpy as np;

np.set_printoptions(linewidth=200, precision=5, suppress=True)
import pandas as pd;

from matplotlib.backends.backend_pdf import PdfPages

pd.options.display.max_rows = 50;
pd.options.display.expand_frame_repr = False
import os;

home = os.path.expanduser('~') + '/'
import Utils.Util as utl
import glob
path=open('path').readline()+'Fst/merge/'
dedup=utl.dedup
a=[]
for f in glob.glob(path+'*fst'):
    print f
    x=pd.read_csv(path+f,sep='\t',header=None).rename(columns={0:'CHROM',1:'POS',2: tuple(f.split('.')[:2])}).set_index(['CHROM','POS']).iloc[:,0]
    x[x<0]=0
    utl.gz.save(dedup(x),path+f.replace('fst','gz'))
