Mercurial > repos > miller-lab > genome_diversity
comparison dpmix.py @ 9:22fe0154fa54
added support for heterochromatic regions
author | Richard Burhans <burhans@bx.psu.edu> |
---|---|
date | Tue, 10 Jul 2012 11:41:22 -0400 |
parents | 2c498d40ecde |
children |
comparison
equal
deleted
inserted
replaced
8:30771a097f14 | 9:22fe0154fa54 |
---|---|
5 import os | 5 import os |
6 import subprocess | 6 import subprocess |
7 from Population import Population | 7 from Population import Population |
8 import gd_composite | 8 import gd_composite |
9 from dpmix_plot import make_dpmix_plot | 9 from dpmix_plot import make_dpmix_plot |
10 from LocationFile import LocationFile | |
10 | 11 |
11 ################################################################################ | 12 ################################################################################ |
12 | 13 |
13 def mkdir_p(path): | 14 def mkdir_p(path): |
14 try: | 15 try: |
38 print >> sys.stderr, stderrdata | 39 print >> sys.stderr, stderrdata |
39 sys.exit(1) | 40 sys.exit(1) |
40 | 41 |
41 ################################################################################ | 42 ################################################################################ |
42 | 43 |
43 if len(sys.argv) < 14: | 44 if len(sys.argv) < 15: |
44 print "usage" | 45 print "usage" |
45 sys.exit(1) | 46 sys.exit(1) |
46 | 47 |
47 input, data_source, switch_penalty, ap1_input, ap2_input, p_input, output, output2, output2_dir, dbkey, ref_column, galaxy_data_index_dir = sys.argv[1:13] | 48 input, data_source, switch_penalty, ap1_input, ap2_input, p_input, output, output2, output2_dir, dbkey, ref_column, galaxy_data_index_dir, heterochromatin_loc_file = sys.argv[1:14] |
48 individual_metadata = sys.argv[13:] | 49 individual_metadata = sys.argv[14:] |
49 | 50 |
50 chrom = 'all' | 51 chrom = 'all' |
51 analyze_additional = '0' | |
52 add_logs = '0' | 52 add_logs = '0' |
53 | |
54 loc_path = os.path.join(galaxy_data_index_dir, heterochromatin_loc_file) | |
55 location_file = LocationFile(loc_path) | |
56 heterochrom_path = location_file.get_values_if_exists(dbkey) | |
57 if heterochrom_path is None: | |
58 heterochrom_path = '/dev/null' | |
53 | 59 |
54 population_list = [] | 60 population_list = [] |
55 | 61 |
56 p_total = Population() | 62 p_total = Population() |
57 p_total.from_tag_list(individual_metadata) | 63 p_total.from_tag_list(individual_metadata) |
91 args.append(ref_column) | 97 args.append(ref_column) |
92 args.append(chrom) | 98 args.append(chrom) |
93 args.append(data_source) | 99 args.append(data_source) |
94 args.append(add_logs) | 100 args.append(add_logs) |
95 args.append(switch_penalty) | 101 args.append(switch_penalty) |
96 args.append(analyze_additional) | 102 args.append(heterochrom_path) |
97 args.append(misc_file) | 103 args.append(misc_file) |
98 | 104 |
99 columns = ap1.column_list() | 105 columns = ap1.column_list() |
100 for column in columns: | 106 for column in columns: |
101 args.append('{0}:1:{1}'.format(column, ap1.individual_with_column(column).name)) | 107 args.append('{0}:1:{1}'.format(column, ap1.individual_with_column(column).name)) |
136 if data_source == '0': | 142 if data_source == '0': |
137 data_source_value = 'sequence coverage' | 143 data_source_value = 'sequence coverage' |
138 elif data_source == '1': | 144 elif data_source == '1': |
139 data_source_value = 'estimated genotype' | 145 data_source_value = 'estimated genotype' |
140 | 146 |
141 if analyze_additional == '0': | |
142 analyze_additional_value = 'no' | |
143 elif analyze_additional == '1': | |
144 analyze_additional_value = 'yes' | |
145 | |
146 in_data_source = gd_composite.Parameter(description='Data source', value=data_source_value, display_type=display_value) | 147 in_data_source = gd_composite.Parameter(description='Data source', value=data_source_value, display_type=display_value) |
147 in_switch_penalty = gd_composite.Parameter(description='Switch penalty', value=switch_penalty, display_type=display_value) | 148 in_switch_penalty = gd_composite.Parameter(description='Switch penalty', value=switch_penalty, display_type=display_value) |
148 in_analyze_additional = gd_composite.Parameter(description='Also analyze random chromosome', value=analyze_additional_value, display_type=display_value) | |
149 | 149 |
150 info_page.add_input_parameter(in_data_source) | 150 info_page.add_input_parameter(in_data_source) |
151 info_page.add_input_parameter(in_switch_penalty) | 151 info_page.add_input_parameter(in_switch_penalty) |
152 info_page.add_input_parameter(in_analyze_additional) | |
153 | 152 |
154 misc_populations = gd_composite.Parameter(name='Populations', value=population_list, display_type=gd_composite.DisplayPopulationList()) | 153 misc_populations = gd_composite.Parameter(name='Populations', value=population_list, display_type=gd_composite.DisplayPopulationList()) |
155 | 154 |
156 info_page.add_misc(misc_populations) | 155 info_page.add_misc(misc_populations) |
157 | 156 |