Mercurial > repos > miller-lab > genome_diversity
comparison average_fst.py @ 24:248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
author | Richard Burhans <burhans@bx.psu.edu> |
---|---|
date | Tue, 28 May 2013 16:24:19 -0400 |
parents | f04f40a36cc8 |
children | 8997f2ca8c7a |
comparison
equal
deleted
inserted
replaced
23:66a183c44dd5 | 24:248b06e86022 |
---|---|
4 import subprocess | 4 import subprocess |
5 from Population import Population | 5 from Population import Population |
6 | 6 |
7 ################################################################################ | 7 ################################################################################ |
8 | 8 |
9 if len(sys.argv) < 11: | 9 if len(sys.argv) < 12: |
10 print >> sys.stderr, "Usage" | 10 print >> sys.stderr, "Usage" |
11 sys.exit(1) | 11 sys.exit(1) |
12 | 12 |
13 input, p1_input, p2_input, data_source, min_total_count, discard_fixed, output, shuffles, p0_input = sys.argv[1:10] | 13 input, p1_input, p2_input, input_type, data_source, min_total_count, discard_fixed, output, shuffles, p0_input = sys.argv[1:11] |
14 individual_metadata = sys.argv[10:] | 14 individual_metadata = sys.argv[11:] |
15 | 15 |
16 try: | 16 try: |
17 shuffle_count = int(shuffles) | 17 shuffle_count = int(shuffles) |
18 except: | 18 except: |
19 shuffle_count = 0 | 19 shuffle_count = 0 |
53 args.append(discard_fixed) | 53 args.append(discard_fixed) |
54 args.append(shuffles) | 54 args.append(shuffles) |
55 | 55 |
56 columns = p1.column_list() | 56 columns = p1.column_list() |
57 for column in columns: | 57 for column in columns: |
58 if input_type == 'gd_genotype': | |
59 column = int(column) - 2 | |
58 args.append('{0}:1'.format(column)) | 60 args.append('{0}:1'.format(column)) |
59 | 61 |
60 columns = p2.column_list() | 62 columns = p2.column_list() |
61 for column in columns: | 63 for column in columns: |
64 if input_type == 'gd_genotype': | |
65 column = int(column) - 2 | |
62 args.append('{0}:2'.format(column)) | 66 args.append('{0}:2'.format(column)) |
63 | 67 |
64 if p0 is not None: | 68 if p0 is not None: |
65 columns = p0.column_list() | 69 columns = p0.column_list() |
66 for column in columns: | 70 for column in columns: |
71 if input_type == 'gd_genotype': | |
72 column = int(column) - 2 | |
67 args.append('{0}:0'.format(column)) | 73 args.append('{0}:0'.format(column)) |
68 | 74 |
69 fh = open(output, 'w') | 75 fh = open(output, 'w') |
70 | 76 |
71 #print "args:", ' '.join(args) | 77 #print "args:", ' '.join(args) |