comparison aggregate_gd_indivs.py @ 22:95a05c1ef5d5

update to devshed revision aaece207bd01
author Richard Burhans <burhans@bx.psu.edu>
date Mon, 11 Mar 2013 11:28:06 -0400
parents
children 91e835060ad2
comparison
equal deleted inserted replaced
21:d6b961721037 22:95a05c1ef5d5
1 #!/usr/bin/env python
2
3 import sys
4 import subprocess
5 from Population import Population
6
7 ################################################################################
8
9 if len(sys.argv) < 9:
10 print >> sys.stderr, "Usage"
11 sys.exit(1)
12
13 #input, p1_input, output, lo, hi, lo_ind, lo_ind_qual = sys.argv[1:8]
14 #individual_metadata = sys.argv[8:]
15 input, p1_input, output, = sys.argv[1:4]
16 individual_metadata = sys.argv[4:]
17
18 p_total = Population()
19 p_total.from_tag_list(individual_metadata)
20
21 p1 = Population()
22 p1.from_population_file(p1_input)
23
24 if not p_total.is_superset(p1):
25 print >> sys.stderr, 'There is an individual in the population that is not in the SNP table'
26 sys.exit(1)
27
28 ################################################################################
29
30 prog = 'aggregate'
31
32 args = []
33 args.append(prog)
34 args.append(input)
35
36 columns = p1.column_list()
37
38 for column in sorted(columns):
39 args.append(column)
40
41 fh = open(output, 'w')
42
43 #print "args:", ' '.join(args)
44 p = subprocess.Popen(args, bufsize=-1, stdin=None, stdout=fh, stderr=sys.stderr)
45 rc = p.wait()
46 fh.close()
47
48 sys.exit(0)
49