Mercurial > repos > miller-lab > genome_diversity
comparison aggregate_gd_indivs.py @ 26:91e835060ad2
Updates to Admixture, Aggregate Individuals, and Restore Attributes to support gd_genotype
author | Richard Burhans <burhans@bx.psu.edu> |
---|---|
date | Mon, 03 Jun 2013 12:29:29 -0400 |
parents | 95a05c1ef5d5 |
children | 8997f2ca8c7a |
comparison
equal
deleted
inserted
replaced
25:cba0d7a63b82 | 26:91e835060ad2 |
---|---|
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) < 9: | 9 if len(sys.argv) < 6: |
10 print >> sys.stderr, "Usage" | 10 print >> sys.stderr, "Usage" |
11 sys.exit(1) | 11 sys.exit(1) |
12 | 12 |
13 #input, p1_input, output, lo, hi, lo_ind, lo_ind_qual = sys.argv[1:8] | 13 input, p1_input, output, input_type = sys.argv[1:5] |
14 #individual_metadata = sys.argv[8:] | 14 individual_metadata = sys.argv[5:] |
15 input, p1_input, output, = sys.argv[1:4] | |
16 individual_metadata = sys.argv[4:] | |
17 | 15 |
18 p_total = Population() | 16 p_total = Population() |
19 p_total.from_tag_list(individual_metadata) | 17 p_total.from_tag_list(individual_metadata) |
20 | 18 |
21 p1 = Population() | 19 p1 = Population() |
31 | 29 |
32 args = [] | 30 args = [] |
33 args.append(prog) | 31 args.append(prog) |
34 args.append(input) | 32 args.append(input) |
35 | 33 |
34 if input_type == 'gd_snp': | |
35 args.append('1') | |
36 elif input_type == 'gd_genotype': | |
37 args.append('0') | |
38 else: | |
39 print >> sys.stderr, "unknown input type:", input_type | |
40 sys.exit(1) | |
41 | |
36 columns = p1.column_list() | 42 columns = p1.column_list() |
37 | 43 |
38 for column in sorted(columns): | 44 for column in sorted(columns): |
45 if input_type == 'gd_genotype': | |
46 column = str(int(column) - 2) | |
39 args.append(column) | 47 args.append(column) |
40 | 48 |
41 fh = open(output, 'w') | 49 fh = open(output, 'w') |
42 | 50 |
43 #print "args:", ' '.join(args) | 51 #print "args:", ' '.join(args) |