comparison prepare_population_structure.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 2c498d40ecde
children 8997f2ca8c7a
comparison
equal deleted inserted replaced
23:66a183c44dd5 24:248b06e86022
51 if exit: 51 if exit:
52 sys.exit(1) 52 sys.exit(1)
53 53
54 ################################################################################ 54 ################################################################################
55 55
56 if len(sys.argv) < 9: 56 if len(sys.argv) < 10:
57 die("Usage") 57 die("Usage")
58 58
59 # parse command line 59 # parse command line
60 input_snp_filename, min_reads, min_qual, min_spacing, output_filename, output_files_path = sys.argv[1:7] 60 input_snp_filename, input_type, min_reads, min_qual, min_spacing, output_filename, output_files_path = sys.argv[1:8]
61 args = sys.argv[7:] 61 args = sys.argv[8:]
62 62
63 individual_metadata = [] 63 individual_metadata = []
64 population_files = [] 64 population_files = []
65 population_names = [] 65 population_names = []
66 all_individuals = False 66 all_individuals = False
117 args.append(min_qual) 117 args.append(min_qual)
118 args.append(min_spacing) 118 args.append(min_spacing)
119 119
120 tags = p1.tag_list() 120 tags = p1.tag_list()
121 for tag in tags: 121 for tag in tags:
122 if input_type == 'gd_genotype':
123 column, name = tag.split(':')
124 tag = '{0}:{1}'.format(int(column) - 2, name)
122 args.append(tag) 125 args.append(tag)
123 126
124 #print "args:", ' '.join(args) 127 #print "args:", ' '.join(args)
125 p = subprocess.Popen(args, bufsize=-1, stdin=None, stdout=subprocess.PIPE, stderr=sys.stderr) 128 p = subprocess.Popen(args, bufsize=-1, stdin=None, stdout=subprocess.PIPE, stderr=sys.stderr)
126 (stdoutdata, stderrdata) = p.communicate() 129 (stdoutdata, stderrdata) = p.communicate()