Mercurial > repos > miller-lab > genome_diversity
annotate phylogenetic_tree.py @ 25:cba0d7a63b82
workaround for gd_genotype datatype
admix shift int -> float
author | Richard Burhans <burhans@bx.psu.edu> |
---|---|
date | Wed, 29 May 2013 13:49:19 -0400 |
parents | 248b06e86022 |
children | 8997f2ca8c7a |
rev | line source |
---|---|
0 | 1 #!/usr/bin/env python |
2 | |
3 import os | |
4 import errno | |
5 import sys | |
6 import subprocess | |
7 import shutil | |
8 from Population import Population | |
9 import gd_composite | |
10 | |
11 ################################################################################ | |
12 | |
13 def mkdir_p(path): | |
14 try: | |
15 os.makedirs(path) | |
16 except OSError, e: | |
17 if e.errno <> errno.EEXIST: | |
18 raise | |
19 | |
20 ################################################################################ | |
21 | |
24
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
22 # <command interpreter="python"> |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
23 # phylogenetic_tree.py "$input" "$output" "$output.files_path" |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
24 # |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
25 # #if $input_type.choice == '0' |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
26 # "gd_snp" |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
27 # #if $input_type.data_source.choice == '0' |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
28 # "sequence_coverage" |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
29 # "$input_type.data_source.minimum_coverage" |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
30 # "$input_type.data_source.minimum_quality" |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
31 # #else if $input_type.data_source.choice == '1' |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
32 # "estimated_genotype" |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
33 # #else if $input_type.choice == '1' |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
34 # "gd_genotype" |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
35 # #end if |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
36 # |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
37 # #if $individuals.choice == '0' |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
38 # "all_individuals" |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
39 # #else if $individuals.choice == '1' |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
40 # "$individuals.p1_input" |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
41 # #end if |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
42 # |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
43 # #if ((str($input.metadata.scaffold) == str($input.metadata.ref)) and (str($input.metadata.pos) == str($input.metadata.rPos))) or (str($include_reference) == '0') |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
44 # "none" |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
45 # #else |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
46 # "$input.metadata.dbkey" |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
47 # #end if |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
48 # |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
49 # #set $draw_tree_options = ''.join(str(x) for x in [$branch_style, $scale_style, $length_style, $layout_style]) |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
50 # #if $draw_tree_options == '' |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
51 # "" |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
52 # #else |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
53 # "-$draw_tree_options" |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
54 # #end if |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
55 # |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
56 # #for $individual_name, $individual_col in zip($input.dataset.metadata.individual_names, $input.dataset.metadata.individual_columns) |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
57 # #set $arg = '%s:%s' % ($individual_col, $individual_name) |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
58 # "$arg" |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
59 # #end for |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
60 # </command> |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
61 |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
62 ################################################################################ |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
63 |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
64 # if len(sys.argv) < 11: |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
65 # print >> sys.stderr, "Usage" |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
66 # sys.exit(1) |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
67 # |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
68 # input, p1_input, output, extra_files_path, minimum_coverage, minimum_quality, dbkey, data_source, draw_tree_options = sys.argv[1:10] |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
69 # |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
70 # individual_metadata = sys.argv[10:] |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
71 # |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
72 # # note: TEST THIS |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
73 # if dbkey in ['', '?', 'None']: |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
74 # dbkey = 'none' |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
75 # |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
76 # p_total = Population() |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
77 # p_total.from_tag_list(individual_metadata) |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
78 |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
79 if len(sys.argv) < 5: |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
80 print >> sys.stderr, 'Usage' |
0 | 81 sys.exit(1) |
82 | |
24
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
83 input, output, extra_files_path, input_type = sys.argv[1:5] |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
84 args = sys.argv[5:] |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
85 |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
86 data_source = '1' |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
87 minimum_coverage = '0' |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
88 minimum_quality = '0' |
0 | 89 |
24
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
90 if input_type == 'gd_snp': |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
91 data_source_arg = args.pop(0) |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
92 if data_source_arg == 'sequence_coverage': |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
93 data_source = '0' |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
94 minimum_coverage = args.pop(0) |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
95 minimum_quality = args.pop(0) |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
96 elif data_source_arg == 'estimated_genotype': |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
97 pass |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
98 else: |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
99 print >> sys.stderr, 'Unsupported data_source:', data_source_arg |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
100 sys.exit(1) |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
101 elif input_type == 'gd_genotype': |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
102 pass |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
103 else: |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
104 print >> sys.stderr, 'Unsupported input_type:', input_type |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
105 sys.exit(1) |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
106 |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
107 p1_input, dbkey, draw_tree_options = args[:3] |
0 | 108 |
109 # note: TEST THIS | |
110 if dbkey in ['', '?', 'None']: | |
111 dbkey = 'none' | |
112 | |
24
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
113 individual_metadata = args[3:] |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
114 |
0 | 115 p_total = Population() |
116 p_total.from_tag_list(individual_metadata) | |
117 | |
118 ################################################################################ | |
119 | |
120 mkdir_p(extra_files_path) | |
121 | |
122 ################################################################################ | |
123 | |
124 def run_program(prog, args, ofh): | |
125 #print "args: ", ' '.join(args) | |
126 p = subprocess.Popen(args, bufsize=-1, executable=prog, stdin=None, stdout=ofh, stderr=subprocess.PIPE) | |
127 (stdoutdata, stderrdata) = p.communicate() | |
128 rc = p.returncode | |
129 ofh.close() | |
130 | |
131 if rc != 0: | |
132 #print >> sys.stderr, "FAILED: rc={0}: {1}".format(rc, ' '.join(args)) | |
133 print >> sys.stderr, stderrdata | |
134 sys.exit(1) | |
135 | |
136 ################################################################################ | |
137 | |
138 phylip_outfile = os.path.join(extra_files_path, 'distance_matrix.phylip') | |
139 newick_outfile = os.path.join(extra_files_path, 'phylogenetic_tree.newick') | |
140 ps_outfile = 'tree.ps' | |
141 pdf_outfile = os.path.join(extra_files_path, 'tree.pdf') | |
142 | |
143 ################################################################################ | |
144 | |
145 informative_snp_file = os.path.join(extra_files_path, 'informative_snps.txt') | |
146 mega_distance_matrix_file = os.path.join(extra_files_path, 'mega_distance_matrix.txt') | |
147 | |
148 prog = 'dist_mat' | |
149 | |
150 args = [] | |
151 args.append(prog) | |
152 args.append(input) | |
153 args.append(minimum_coverage) | |
154 args.append(minimum_quality) | |
155 args.append(dbkey) | |
156 args.append(data_source) | |
157 args.append(informative_snp_file) | |
158 args.append(mega_distance_matrix_file) | |
159 | |
160 if p1_input == "all_individuals": | |
161 tags = p_total.tag_list() | |
162 else: | |
163 p1 = Population() | |
164 p1.from_population_file(p1_input) | |
165 if not p_total.is_superset(p1): | |
166 print >> sys.stderr, 'There is an individual in the population that is not in the SNP table' | |
167 sys.exit(1) | |
168 tags = p1.tag_list() | |
169 | |
170 for tag in tags: | |
24
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
171 if input_type == 'gd_genotype': |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
172 column, name = tag.split(':') |
248b06e86022
Added gd_genotype datatype. Modified tools to support new datatype.
Richard Burhans <burhans@bx.psu.edu>
parents:
0
diff
changeset
|
173 tag = '{0}:{1}'.format(int(column) - 2, name) |
0 | 174 args.append(tag) |
175 | |
176 fh = open(phylip_outfile, 'w') | |
177 run_program(None, args, fh) | |
178 | |
179 ################################################################################ | |
180 | |
181 prog = 'quicktree' | |
182 | |
183 args = [] | |
184 args.append(prog) | |
185 args.append('-in') | |
186 args.append('m') | |
187 args.append('-out') | |
188 args.append('t') | |
189 args.append(phylip_outfile) | |
190 | |
191 fh = open(newick_outfile, 'w') | |
192 run_program(None, args, fh) | |
193 | |
194 ################################################################################ | |
195 | |
196 prog = 'draw_tree' | |
197 | |
198 args = [] | |
199 args.append(prog) | |
200 if draw_tree_options: | |
201 args.append(draw_tree_options) | |
202 args.append(newick_outfile) | |
203 | |
204 fh = open(ps_outfile, 'w') | |
205 run_program(None, args, fh) | |
206 | |
207 ################################################################################ | |
208 | |
209 prog = 'ps2pdf' | |
210 | |
211 args = [] | |
212 args.append(prog) | |
213 args.append('-dPDFSETTINGS=/prepress') | |
214 args.append(ps_outfile) | |
215 args.append('-') | |
216 | |
217 fh = open(pdf_outfile, 'w') | |
218 run_program(None, args, fh) | |
219 | |
220 shutil.copyfile(pdf_outfile, output) | |
221 | |
222 ################################################################################ | |
223 | |
224 info_page = gd_composite.InfoPage() | |
225 info_page.set_title('Phylogenetic tree Galaxy Composite Dataset') | |
226 | |
227 display_file = gd_composite.DisplayFile() | |
228 display_value = gd_composite.DisplayValue() | |
229 | |
230 out_pdf = gd_composite.Parameter(name='tree.pdf', value='tree.pdf', display_type=display_file) | |
231 out_newick = gd_composite.Parameter(value='phylogenetic_tree.newick', name='phylogenetic tree (newick)', display_type=display_file) | |
232 out_phylip = gd_composite.Parameter(value='distance_matrix.phylip', name='Phylip distance matrix', display_type=display_file) | |
233 out_mega = gd_composite.Parameter(value='mega_distance_matrix.txt', name='Mega distance matrix', display_type=display_file) | |
234 out_snps = gd_composite.Parameter(value='informative_snps.txt', name='informative SNPs', display_type=display_file) | |
235 | |
236 info_page.add_output_parameter(out_pdf) | |
237 info_page.add_output_parameter(out_newick) | |
238 info_page.add_output_parameter(out_phylip) | |
239 info_page.add_output_parameter(out_mega) | |
240 info_page.add_output_parameter(out_snps) | |
241 | |
242 in_min_cov = gd_composite.Parameter(description='Minimum coverage', value=minimum_coverage, display_type=display_value) | |
243 in_min_qual = gd_composite.Parameter(description='Minimum quality', value=minimum_quality, display_type=display_value) | |
244 | |
245 include_ref_value = 'no' | |
246 if dbkey != 'none': | |
247 include_ref_value = 'yes' | |
248 | |
249 in_include_ref = gd_composite.Parameter(description='Include reference sequence', value=include_ref_value, display_type=display_value) | |
250 | |
251 if data_source == '0': | |
252 data_source_value = 'sequence coverage' | |
253 elif data_source == '1': | |
254 data_source_value = 'estimated genotype' | |
255 | |
256 in_data_source = gd_composite.Parameter(description='Data source', value=data_source_value, display_type=display_value) | |
257 | |
258 branch_type_value = 'square' | |
259 if 'd' in draw_tree_options: | |
260 branch_type_value = 'diagonal' | |
261 | |
262 in_branch_type = gd_composite.Parameter(description='Branch type', value=branch_type_value, display_type=display_value) | |
263 | |
264 branch_scale_value = 'yes' | |
265 if 's' in draw_tree_options: | |
266 branch_scale_value = 'no' | |
267 | |
268 in_branch_scale = gd_composite.Parameter(description='Draw branches to scale', value=branch_scale_value, display_type=display_value) | |
269 | |
270 branch_length_value = 'yes' | |
271 if 'b' in draw_tree_options: | |
272 branch_length_value = 'no' | |
273 | |
274 in_branch_length = gd_composite.Parameter(description='Show branch lengths', value=branch_length_value, display_type=display_value) | |
275 | |
276 tree_layout_value = 'horizontal' | |
277 if 'v' in draw_tree_options: | |
278 tree_layout_value = 'vertical' | |
279 | |
280 in_tree_layout = gd_composite.Parameter(description='Tree layout', value=tree_layout_value, display_type=display_value) | |
281 | |
282 info_page.add_input_parameter(in_min_cov) | |
283 info_page.add_input_parameter(in_min_qual) | |
284 info_page.add_input_parameter(in_include_ref) | |
285 info_page.add_input_parameter(in_data_source) | |
286 info_page.add_input_parameter(in_branch_type) | |
287 info_page.add_input_parameter(in_branch_scale) | |
288 info_page.add_input_parameter(in_branch_length) | |
289 info_page.add_input_parameter(in_tree_layout) | |
290 | |
291 misc_individuals = gd_composite.Parameter(name='Individuals', value=tags, display_type=gd_composite.DisplayTagList()) | |
292 | |
293 info_page.add_misc(misc_individuals) | |
294 | |
295 | |
296 with open(output, 'w') as ofh: | |
297 print >> ofh, info_page.render() | |
298 | |
299 ################################################################################ | |
300 | |
301 sys.exit(0) | |
302 |