Mercurial > repos > rico > testing_again
comparison modify_snp_table.py @ 0:4d28d3295ac3 default tip
Uploaded
| author | rico |
|---|---|
| date | Fri, 06 Apr 2012 13:46:42 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:4d28d3295ac3 |
|---|---|
| 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 | |
| 16 p_total = Population() | |
| 17 p_total.from_tag_list(individual_metadata) | |
| 18 | |
| 19 p1 = Population() | |
| 20 p1.from_population_file(p1_input) | |
| 21 | |
| 22 if not p_total.is_superset(p1): | |
| 23 print >> sys.stderr, 'There is an individual in the population that is not in the SNP table' | |
| 24 sys.exit(1) | |
| 25 | |
| 26 ################################################################################ | |
| 27 | |
| 28 prog = 'pop' | |
| 29 | |
| 30 args = [] | |
| 31 args.append(prog) | |
| 32 args.append(input) | |
| 33 args.append(lo) | |
| 34 args.append(hi) | |
| 35 args.append(lo_ind) | |
| 36 args.append(lo_ind_qual) | |
| 37 | |
| 38 columns = p1.column_list() | |
| 39 | |
| 40 for column in sorted(columns): | |
| 41 args.append(column) | |
| 42 | |
| 43 fh = open(output, 'w') | |
| 44 | |
| 45 #print "args:", ' '.join(args) | |
| 46 p = subprocess.Popen(args, bufsize=-1, stdin=None, stdout=fh, stderr=sys.stderr) | |
| 47 rc = p.wait() | |
| 48 fh.close() | |
| 49 | |
| 50 sys.exit(0) | |
| 51 |
