def computePCsPlink(plink_path,k,out_dir,bfile,ffile):
    """
    computing the covariance matrix via plink
    """
    print("Using plink to compute principal components")
    cmd = '%s --bfile %s --pca %d '%(plink_path,bfile,k)
    cmd+= '--out %s'%(os.path.join(out_dir,'plink'))
    subprocess.call(cmd,shell=True)
    plink_fn = os.path.join(out_dir, 'plink.eigenvec')
    M = sp.loadtxt(plink_fn,dtype=str)
    U = sp.array(M[:,2:],dtype=float)
    U-= U.mean(0)
    U/= U.std(0)
    sp.savetxt(ffile,U)