1#@UGENE_WORKFLOW
2#For each input sequence the workflow performs a search of inverted repeats. Then it saves the repeats found on the direct strand to the "direct_strand_repeat_units.fa" file and the complement ones to the "compl_strand_repeat_units.fa" file.
3
4include "Get the first half of sequence.usa" as "Script-Get the first half of sequence"
5include "Get the second half of sequence.usa" as "Script-Get the second half of sequence"
6
7workflow "Search for inverted repeats"{
8
9    read-sequence {
10        type:read-sequence;
11        name:"Read Sequence";
12        url-in {
13            dataset:"Dataset 1";
14        }
15    }
16    repeats-search {
17        type:repeats-search;
18        name:"Find Inverted Repeats";
19        algorithm:0;
20        exclude-tandems:false;
21        filter-algorithm:0;
22        identity:90;
23        inverted:true;
24        max-distance:5000;
25        min-distance:100;
26        min-length:10;
27        threads:0;
28    }
29    extract-annotated-sequence {
30        type:extract-annotated-sequence;
31        name:"Get Sequences by Annotations";
32    }
33    reverse-complement {
34        type:reverse-complement;
35        name:"Reverse Complement";
36    }
37    write-sequence {
38        type:write-sequence;
39        name:"Write the Direct Strand Repeat Unit";
40        url-out:direct_strand_repeat_units.fa;
41    }
42    write-sequence-1 {
43        type:write-sequence;
44        name:"Write the Direct Strand Repeat Unit";
45        url-out:compl_strand_repeat_units.fa;
46    }
47    Script-Get-the-first-half-of-sequence {
48        type:"Script-Get the first half of sequence";
49        name:"Get the First Half of Sequence";
50        script {
51out_sequence = subsequence(in_sequence, 0, size(in_sequence) / 2 - 1);
52        };
53    }
54    Script-Get-the-second-half-of-sequence {
55        type:"Script-Get the second half of sequence";
56        name:"Get the Second Half of Sequence";
57        script {
58out_sequence = subsequence(in_sequence, size(in_sequence) / 2, size(in_sequence) - 1);
59        };
60    }
61
62    .actor-bindings {
63        read-sequence.out-sequence->repeats-search.in-sequence
64        repeats-search.out-annotations->extract-annotated-sequence.in-sequence
65        extract-annotated-sequence.out-sequence->Script-Get-the-second-half-of-sequence.in
66        extract-annotated-sequence.out-sequence->Script-Get-the-first-half-of-sequence.in
67        reverse-complement.out-sequence->write-sequence-1.in-sequence
68        Script-Get-the-first-half-of-sequence.out->write-sequence.in-sequence
69        Script-Get-the-second-half-of-sequence.out->reverse-complement.in-sequence
70    }
71
72    read-sequence.sequence->repeats-search.in-sequence.sequence
73    repeats-search.annotations->extract-annotated-sequence.in-sequence.annotations
74    read-sequence.sequence->extract-annotated-sequence.in-sequence.sequence
75    Script-Get-the-second-half-of-sequence.sequence->reverse-complement.in-sequence.sequence
76    Script-Get-the-first-half-of-sequence.sequence->write-sequence.in-sequence.sequence
77    reverse-complement.sequence->write-sequence-1.in-sequence.sequence
78    extract-annotated-sequence.sequence->Script-Get-the-first-half-of-sequence.in.sequence
79    extract-annotated-sequence.sequence->Script-Get-the-second-half-of-sequence.in.sequence
80
81    .meta {
82        visual {
83            Script-Get-the-first-half-of-sequence {
84                pos:"-491 -642";
85                style:ext;
86                bg-color-ext:"85 170 255 64";
87                in.angle:58.5704;
88                out.angle:290.298;
89            }
90            Script-Get-the-second-half-of-sequence {
91                pos:"-217 -651";
92                style:ext;
93                bg-color-ext:"85 170 255 64";
94                bounds:"-30 -30 81.625 81";
95                in.angle:47.0454;
96                out.angle:288.06;
97            }
98            extract-annotated-sequence {
99                pos:"-386 -822";
100                style:ext;
101                bg-color-ext:"0 128 128 64";
102                in-sequence.angle:180;
103                out-sequence.angle:294.605;
104            }
105            read-sequence {
106                pos:"-932 -828";
107                style:ext;
108                bg-color-ext:"255 170 127 64";
109                out-sequence.angle:360;
110            }
111            repeats-search {
112                pos:"-735 -828";
113                style:ext;
114                bg-color-ext:"0 128 128 64";
115                in-sequence.angle:180;
116                out-annotations.angle:358.946;
117            }
118            reverse-complement {
119                pos:"-221 -487";
120                style:ext;
121                bg-color-ext:"0 128 128 64";
122                bounds:"-30 -30 114.5 81";
123                in-sequence.angle:44.1931;
124                out-sequence.angle:292.714;
125            }
126            write-sequence {
127                pos:"-486 -471";
128                style:ext;
129                bg-color-ext:"170 170 0 64";
130                bounds:"-30 -30 87 112";
131                in-sequence.angle:49.844;
132            }
133            write-sequence-1 {
134                pos:"-209 -297";
135                style:ext;
136                bg-color-ext:"170 170 0 64";
137                bounds:"-30 -30 97.25 102";
138                in-sequence.angle:50.5275;
139            }
140            Script-Get-the-first-half-of-sequence.out->write-sequence.in-sequence {
141                text-pos:"-30.5 -12";
142            }
143            Script-Get-the-second-half-of-sequence.out->reverse-complement.in-sequence {
144                text-pos:"-32.5 -13";
145            }
146            extract-annotated-sequence.out-sequence->Script-Get-the-first-half-of-sequence.in {
147                text-pos:"-38 -15";
148            }
149            extract-annotated-sequence.out-sequence->Script-Get-the-second-half-of-sequence.in {
150                text-pos:"-52 -19";
151            }
152            read-sequence.out-sequence->repeats-search.in-sequence {
153                text-pos:"-27.5 -24";
154            }
155            repeats-search.out-annotations->extract-annotated-sequence.in-sequence {
156                text-pos:"-45 -37";
157            }
158            reverse-complement.out-sequence->write-sequence-1.in-sequence {
159                text-pos:"-37 -21";
160            }
161        }
162        wizard {
163            name:"Search for Inverted Repeats Wizard";
164            help-page-id:16122701;
165            auto-run: true;
166            page {
167                id:1;
168                next:2;
169                title:"Input sequence(s)";
170                parameters-area {
171                    read-sequence.url-in {
172                        type:datasets;
173                    }
174                }
175            }
176            page {
177                id:2;
178                next:3;
179                title:"Search for inverted repeats parameters";
180                parameters-area {
181                    group {
182                        title:"Find Inverted Repeats parameters";
183                        label-size:150;
184                        repeats-search.result-name {
185                        }
186                        repeats-search.min-length {
187                        }
188                        repeats-search.identity {
189                        }
190                        repeats-search.min-distance {
191                        }
192                        repeats-search.max-distance {
193                        }
194                        repeats-search.filter-algorithm {
195                        }
196                        repeats-search.algorithm {
197                        }
198                        repeats-search.threads {
199                        }
200                    }
201                }
202            }
203            page {
204                id:3;
205                title:"Output sequences";
206                parameters-area {
207                    group {
208                        title:"Result files";
209                        label-size:150;
210                        write-sequence.url-out {
211                            label:"Direct strand repeat units";
212                        }
213                        write-sequence-1.url-out {
214                            label:"Compl. strand repeat units";
215                        }
216                    }
217                }
218            }
219        }
220    }
221}
222
223