Mercurial > repos > iuc > hyphy_meme
annotate scripts/annotator.bf @ 30:45a2366d777e draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 9ef881c2d3d5f240cbff33667b55f72cb82d9896"
| author | iuc | 
|---|---|
| date | Tue, 05 Oct 2021 05:04:06 +0000 | 
| parents | 2f07f5b4e47b | 
| children | 
| rev | line source | 
|---|---|
| 
23
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
1 LoadFunctionLibrary ("libv3/tasks/trees.bf"); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
2 LoadFunctionLibrary ("libv3/tasks/alignments.bf"); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
3 LoadFunctionLibrary ("libv3/convenience/regexp.bf"); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
4 LoadFunctionLibrary ("libv3/IOFunctions.bf"); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
5 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
6 tags = { | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
7 "^Node" : "Internal" | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
8 }; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
9 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
10 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
11 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
12 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
13 tree = trees.LoadAnnotatedTopology (TRUE); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
14 ts = tree[^"terms.trees.newick_with_lengths"]; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
15 root_node = io.PromptUserForString ("Root on this node"); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
16 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
17 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
18 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
19 Topology T = ts; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
20 ts = RerootTree (T, root_node); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
21 ACCEPT_ROOTED_TREES = FALSE; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
22 Topology T = ts; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
23 ACCEPT_ROOTED_TREES = TRUE; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
24 Topology TR = ts; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
25 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
26 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
27 NORMALIZE_SEQUENCE_NAMES = FALSE; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
28 SetDialogPrompt ("File with the sequences to label as the in-clade"); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
29 DataSet query = ReadDataFile (PROMPT_FOR_FILE); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
30 GetString (seqNames,query,-1); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
31 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
32 label = io.PromptUserForString ("Use this label"); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
33 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
34 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
35 for (s;in;seqNames) { | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
36 tags [s && 6] = label; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
37 } | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
38 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
39 reg_exp = Rows (tags); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
40 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
41 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
42 node_labels = {}; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
43 for (_regexp_, _leaves_; in; regexp.PartitionByRegularExpressions (BranchName (T,-1), reg_exp)) { | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
44 tag = tags[_regexp_]; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
45 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
46 if (tag != "Internal") { | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
47 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
48 if (Abs (tag) == 0) { | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
49 tag = "Reference"; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
50 } | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
51 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
52 for (l; in; _leaves_) { | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
53 node_labels[l] = tag; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
54 } | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
55 } | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
56 } | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
57 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
58 node_labelsR = {}; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
59 for (_regexp_, _leaves_; in; regexp.PartitionByRegularExpressions (BranchName (TR,-1), reg_exp)) { | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
60 tag = tags[_regexp_]; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
61 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
62 if (tag != "Internal") { | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
63 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
64 if (Abs (tag) == 0) { | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
65 tag = "Reference"; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
66 } | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
67 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
68 for (l; in; _leaves_) { | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
69 node_labelsR[l] = tag; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
70 } | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
71 } | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
72 } | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
73 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
74 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
75 leaf_labels = node_labels; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
76 node_labelsF = node_labels; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
77 node_labels * ((trees.ParsimonyLabel ("T", node_labels))["labels"]); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
78 node_labelsR * ((trees.ParsimonyLabel ("T", node_labelsR))["labels"]); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
79 node_labelsF * ((trees.ParsimonyLabel ("T", node_labelsF))["labels"]); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
80 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
81 output_to = io.PromptUserForString ("Write output to this prefix"); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
82 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
83 fprintf (output_to + "labels.json", CLEAR_FILE, leaf_labels); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
84 fprintf (output_to + "int.nwk", CLEAR_FILE, tree.Annotate ("T", "relabel_and_annotate", "{}", FALSE)); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
85 fprintf (output_to + "clade.nwk", CLEAR_FILE, tree.Annotate ("TR", "relabel_and_annotate_full", "{}", FALSE)); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
86 fprintf (output_to + "full.nwk", CLEAR_FILE, tree.Annotate ("T", "relabel_and_annotate_full", "{}", FALSE)); | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
87 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
88 function relabel_and_annotate (node_name) { | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
89 _label = ""; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
90 if (node_labels / node_name && leaf_labels / node_name == FALSE) { | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
91 _label = "{" + node_labels[node_name] + "}"; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
92 } | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
93 return node_name + _label; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
94 } | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
95 | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
96 function relabel_and_annotate_full (node_name) { | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
97 _label = ""; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
98 if (node_labelsR / node_name) { | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
99 _label = "{" + node_labelsR[node_name] + "}"; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
100 } | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
101 return node_name + _label; | 
| 
 
2f07f5b4e47b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hyphy/ commit 2742ee3b4e90f65352845265d2f85c4263e0eabb"
 
iuc 
parents:  
diff
changeset
 | 
102 } | 
