[7924] | 1 | #! /usr/bin/perl |
---|
| 2 | |
---|
| 3 | # Terminator builder. |
---|
| 4 | $inp_file="terminator.inp"; |
---|
| 5 | open(IN,$inp_file); |
---|
| 6 | |
---|
| 7 | $_=<IN>; |
---|
| 8 | $_=<IN>; |
---|
| 9 | |
---|
| 10 | @par=(); |
---|
| 11 | while(<IN>){ |
---|
| 12 | chop($_); |
---|
| 13 | $_ =~ s/^.+://; |
---|
| 14 | $_ =~ s/ //g; |
---|
| 15 | push(@par,$_); |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | #for($i=0;$i<$#par+1;$i++){ |
---|
| 19 | # print "$par[$i] \n"; |
---|
| 20 | #} |
---|
| 21 | |
---|
| 22 | @def=("terminator",'n','n','n','n',31.25,0.5); |
---|
| 23 | |
---|
| 24 | # Setting file/class name. |
---|
| 25 | if($par[0] !~ /^\s*$/){ |
---|
| 26 | $t_name = $par[0]; |
---|
| 27 | }else{ |
---|
| 28 | $t_name = $def[0]; |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | # Setting forward readthrough flag (y/n): |
---|
| 32 | if($par[1] !~ /^\s*$/){ |
---|
| 33 | $frt_flag= $par[1]; |
---|
| 34 | }else{ |
---|
| 35 | $frt_flag= $def[1]; |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | # Setting backwards readthrough flag |
---|
| 39 | if($par[2] !~ /^\s*$/){ |
---|
| 40 | $brt_flag= $par[2]; |
---|
| 41 | }else{ |
---|
| 42 | $brt_flag= $def[2]; |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | # Setting terminator flag |
---|
| 46 | if($par[3] !~ /^\s*$/){ |
---|
| 47 | $p_flag= $par[3]; |
---|
| 48 | }else{ |
---|
| 49 | $p_flag= $def[3]; |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | # Setting RNA flag (y/n): |
---|
| 53 | if($par[4] !~ /^\s*$/){ |
---|
| 54 | $RNA_flag= $par[4]; |
---|
| 55 | }else{ |
---|
| 56 | $RNA_flag= $def[4]; |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | # Setting zeta value |
---|
| 60 | if($par[5] !~ /^\s*$/){ |
---|
| 61 | $zeta= $par[5]; |
---|
| 62 | }else{ |
---|
| 63 | $zeta= $def[5]; |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | # Setting eta value |
---|
| 67 | if($par[6] !~ /^\s*$/){ |
---|
| 68 | $eta= $par[6]; |
---|
| 69 | }else{ |
---|
| 70 | $eta= $def[6]; |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | ##################################################################### |
---|
| 74 | # Checking parameters |
---|
| 75 | |
---|
| 76 | if($RNA_flag eq 'y' && $brt_flag eq 'y'){ |
---|
| 77 | die "sRNA production can not be affected by readthrough. You set \"backwards readthrough\" to 'y' \n"; |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | if($frt_flag eq 'n' && $brt_flag eq 'y'){ |
---|
| 81 | die "A backwards readthrough cannot exist without a forward one. You set \"backwards readthrough\" to 'y' and \"forward readthrough\" to 'n' \n"; |
---|
| 82 | } |
---|
| 83 | |
---|
| 84 | if($RNA_flag eq 'y' && $p_flag eq 'y'){ |
---|
| 85 | die "A terminator can be preceded only by one part. You set to 'y' both \"promoter flag\" and \"RNA flag\". \n"; |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | #################################################################### |
---|
| 89 | |
---|
| 90 | open(OUT,">$t_name.mdl"); |
---|
| 91 | |
---|
| 92 | print OUT " |
---|
| 93 | (define-module |
---|
| 94 | :class \"$t_name\" |
---|
| 95 | :super-classes (\"module\") |
---|
| 96 | :icon \"terminator.png\" |
---|
| 97 | :terminals((\"in_pol\" |
---|
| 98 | :geometry-side \"LEFT\"\ |
---|
| 99 | :geometry-position \"0.9\" |
---|
| 100 | :variables |
---|
| 101 | ((\"pops\" |
---|
| 102 | :documentation \"Incoming PoPS\" |
---|
| 103 | :system-theoretic \"input\" |
---|
| 104 | :value \"0.0d0\" |
---|
| 105 | :unit \"m/s\")"; |
---|
| 106 | |
---|
| 107 | if($RNA_flag eq 'y' || $p_flag eq 'y'){ |
---|
| 108 | print OUT " |
---|
| 109 | (\"pops_lk\" |
---|
| 110 | :documentation \"Incoming PoPS_lk\" |
---|
| 111 | :system-theoretic \"input\" |
---|
| 112 | :value \"0.0d0\" |
---|
| 113 | :unit \"m/s\")"; |
---|
| 114 | } |
---|
| 115 | |
---|
| 116 | print OUT "))"; |
---|
| 117 | |
---|
| 118 | print OUT " |
---|
| 119 | (\"out_pol\" |
---|
| 120 | :geometry-side \"LEFT\" |
---|
| 121 | :geometry-position \"0.1\" |
---|
| 122 | :variables |
---|
| 123 | ((\"pops\" |
---|
| 124 | :is-eq-to \"parent.pops_out\")))"; |
---|
| 125 | |
---|
| 126 | if($frt_flag eq 'y'){ |
---|
| 127 | print OUT " |
---|
| 128 | (\"out_rt\" |
---|
| 129 | :geometry-side \"RIGHT\" |
---|
| 130 | :geometry-position \"0.9\" |
---|
| 131 | :variables |
---|
| 132 | ((\"pops\" |
---|
| 133 | :is-eq-to \"parent.pops_rt\")))"; |
---|
| 134 | } |
---|
| 135 | |
---|
| 136 | if($brt_flag eq 'y'){ |
---|
| 137 | print OUT " |
---|
| 138 | (\"out_rbs\" |
---|
| 139 | :geometry-side \"BOTTOM\" |
---|
| 140 | :geometry-position \"0.5\" |
---|
| 141 | :variables |
---|
| 142 | ((\"pops\" |
---|
| 143 | :is-eq-to \"parent.pops_rbs\")))"; |
---|
| 144 | } |
---|
| 145 | |
---|
| 146 | if($RNA_flag eq 'y'){ |
---|
| 147 | print OUT " |
---|
| 148 | (\"out_rna\" |
---|
| 149 | :geometry-side \"RIGHT\"\ |
---|
| 150 | :geometry-position \"0.1\" |
---|
| 151 | :variables |
---|
| 152 | ((\"rnaps\" |
---|
| 153 | :is-eq-to \"parent.rnaps_out\")))"; |
---|
| 154 | $rnaps_out="zeta*polt"; |
---|
| 155 | } |
---|
| 156 | |
---|
| 157 | print OUT ")"; |
---|
| 158 | |
---|
| 159 | print OUT " |
---|
| 160 | :variables((\"pops_in\" |
---|
| 161 | :is-eq-to \"in_pol.pops\") |
---|
| 162 | (\"pops_out\" |
---|
| 163 | :documentation \"Outgoing PoPS\" |
---|
| 164 | :system-theoretic \"output\" |
---|
| 165 | :value \"0.0d0\" |
---|
| 166 | :unit \"m/s\") |
---|
| 167 | (\"polt\" |
---|
| 168 | :documentation \"[PolT] (polymerase-terminator) complex\" |
---|
| 169 | :system-theoretic \"state\" |
---|
| 170 | :value \"0.0d0\" |
---|
| 171 | :unit \"m/s\") |
---|
| 172 | (\"zeta\" |
---|
| 173 | :documentation \"[PolT] dissociation rate\" |
---|
| 174 | :system-theoretic \"real-parameter\" |
---|
| 175 | :value \"${zeta}d0\" |
---|
| 176 | :unit \"s ^ (-1)\")"; |
---|
| 177 | |
---|
| 178 | if($frt_flag eq 'y'){ |
---|
| 179 | print OUT " |
---|
| 180 | (\"pops_rt\" |
---|
| 181 | :documentation \"Outgoing readthrough PoPS\" |
---|
| 182 | :system-theoretic \"output\" |
---|
| 183 | :value \"0.0d0\" |
---|
| 184 | :unit \"m/s\") |
---|
| 185 | (\"eta\" |
---|
| 186 | :documentation \"Readthrough rate\" |
---|
| 187 | :system-theoretic \"real-parameter\" |
---|
| 188 | :value \"${eta}d0\" |
---|
| 189 | :unit \"s ^ (-1)\")"; |
---|
| 190 | } |
---|
| 191 | |
---|
| 192 | if($brt_flag eq 'y'){ |
---|
| 193 | print OUT " |
---|
| 194 | (\"pops_rbs\" |
---|
| 195 | :documentation \"Readthrough PoPS to the previous RBS\" |
---|
| 196 | :system-theoretic \"output\" |
---|
| 197 | :value \"0.0d0\" |
---|
| 198 | :unit \"m/s\")"; |
---|
| 199 | } |
---|
| 200 | |
---|
| 201 | if($RNA_flag eq 'y'){ |
---|
| 202 | print OUT " |
---|
| 203 | (\"rnaps_out\" |
---|
| 204 | :documentation \"Outgoing RNAPS\" |
---|
| 205 | :system-theoretic \"output\" |
---|
| 206 | :value \"0.0d0\" |
---|
| 207 | :unit \"m/s\") |
---|
| 208 | (\"pops_lk\" |
---|
| 209 | :is-eq-to \"in_pol.pops_lk\")"; |
---|
| 210 | } |
---|
| 211 | |
---|
| 212 | if($p_flag eq 'y'){ |
---|
| 213 | print OUT " |
---|
| 214 | (\"pops_lk\" |
---|
| 215 | :is-eq-to \"in_pol.pops_lk\")"; |
---|
| 216 | } |
---|
| 217 | |
---|
| 218 | print OUT ")"; |
---|
| 219 | |
---|
| 220 | $pops_rt="eta*polt"; |
---|
| 221 | $pops_rbs="eta*polt"; |
---|
| 222 | |
---|
| 223 | print OUT " |
---|
| 224 | :equations((\"pops_out_eq\" |
---|
| 225 | :relation \"pops_out == zeta*polt\")"; |
---|
| 226 | |
---|
| 227 | if($RNA_flag eq 'y'){ |
---|
| 228 | print OUT " |
---|
| 229 | (\"rnaps_out_eq\" |
---|
| 230 | :relation \"rnaps_out == $rnaps_out + pops_lk\")"; |
---|
| 231 | } |
---|
| 232 | |
---|
| 233 | if($frt_flag eq 'y'){ |
---|
| 234 | print OUT " |
---|
| 235 | (\"polt_eq\" |
---|
| 236 | :relation \":diff<t> polt == pops_in-zeta*polt-$pops_rt\") |
---|
| 237 | (\"pops_rt_eq\" |
---|
| 238 | :relation \"pops_rt == $pops_rt\")"; |
---|
| 239 | } |
---|
| 240 | |
---|
| 241 | if($brt_flag eq 'y'){ |
---|
| 242 | print OUT " |
---|
| 243 | (\"pops_rbs_eq\" |
---|
| 244 | :relation \"pops_rbs == $pops_rbs\")"; |
---|
| 245 | } |
---|
| 246 | |
---|
| 247 | if($frt_flag eq 'n'){ |
---|
| 248 | print OUT " |
---|
| 249 | (\"polt_eq\" |
---|
| 250 | :relation \":diff<t> polt == pops_in-zeta*polt\")"; |
---|
| 251 | } |
---|
| 252 | |
---|
| 253 | print OUT "))\n"; |
---|