import pandas as pd
import argparse
import itertools

parser = argparse.ArgumentParser(description='Convert list of population to all possible qp3 combinations', usage="proj_path")
parser.add_argument('pops', type=str, help='population file')
parser.add_argument('out', type=str, help='output file')
# parser.add_argument('output_name', type=str, help='root name of output file')

arg = parser.parse_args()

pops = pd.read_csv(arg.pops,names=['pop'],squeeze=True)

perms = list(itertools.permutations(pops.unique(),3))

out = open(arg.out,'w')
for p in perms:
    out.write(' '.join(p)+'\n')
#out.write(' '.join([pop1, pop2, pop3])+'\n')
#out.write(' '.join([pop1, pop3, pop2])+'\n')
#out.write(' '.join([pop2, pop3, pop1])+'\n')
out.close()

