diff 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
line wrap: on
line diff
--- a/aggregate_gd_indivs.py	Wed May 29 13:49:19 2013 -0400
+++ b/aggregate_gd_indivs.py	Mon Jun 03 12:29:29 2013 -0400
@@ -6,14 +6,12 @@
 
 ################################################################################
 
-if len(sys.argv) < 9:
+if len(sys.argv) < 6:
     print >> sys.stderr, "Usage"
     sys.exit(1)
 
-#input, p1_input, output, lo, hi, lo_ind, lo_ind_qual = sys.argv[1:8]
-#individual_metadata = sys.argv[8:]
-input, p1_input, output,  = sys.argv[1:4]
-individual_metadata = sys.argv[4:]
+input, p1_input, output, input_type  = sys.argv[1:5]
+individual_metadata = sys.argv[5:]
 
 p_total = Population()
 p_total.from_tag_list(individual_metadata)
@@ -33,9 +31,19 @@
 args.append(prog)
 args.append(input)
 
+if input_type == 'gd_snp':
+    args.append('1')
+elif input_type == 'gd_genotype':
+    args.append('0')
+else:
+    print >> sys.stderr, "unknown input type:", input_type
+    sys.exit(1)
+
 columns = p1.column_list()
 
 for column in sorted(columns):
+    if input_type == 'gd_genotype':
+        column = str(int(column) - 2)
     args.append(column)
 
 fh = open(output, 'w')