1/* Last edited: Mar 5 10:27 1997 (birney) */ 2 3%{ 4#include "dyna.h" 5#include "geneparser4.h" 6#include "genewisemodel.h" 7#include "genewisemodeldb.h" 8#include "genestats.h" 9 10%} 11 12 13matrix GeneStretch6 14query type="GENEWISEMODEL" name="query" field:len="len" 15target type="GENOMIC" name="target" 16resource type="GeneParser4Score *" name="gp" 17resource type="GeneralGeneModelScore *" name="general_model" 18extern name="GW_*" type="int" 19extern name="GP4_*" type="int" 20state MATCH offi="1" offj="3" 21 calc="GENOMIC_CDS_POT(target,j)" 22 source MATCH 23 calc="query->seg[i]->transition[GW_MATCH2MATCH] + query->seg[i]->match[GENOMIC_CODON(target,j)]" 24 endsource 25 source INSERT 26 calc="query->seg[i]->transition[GW_INSERT2MATCH] + query->seg[i]->match[GENOMIC_CODON(target,j)]" 27 endsource 28 source DELETE 29 calc="query->seg[i]->transition[GW_DELETE2MATCH] + query->seg[i]->match[GENOMIC_CODON(target,j)]" 30 endsource 31 source START 32 calc="query->seg[i]->transition[GW_START2MATCH] + query->seg[i]->match[GENOMIC_CODON(target,j)]" 33 endsource 34 source BEFORE_MATCH_CODING 35 calc="query->seg[i]->transition[GW_START2MATCH] + query->seg[i]->match[GENOMIC_CODON(target,j)]" 36 endsource 37# 38# phase 0,1,2 introns can calculate whole amino acid for 0. 39# 40 source INTRON_0 offi="1" offj="6" 41 calc="query->seg[i]->transition[GW_MATCH2MATCH] + gp->transition[GP4_INTRON2CDS] + query->seg[i]->match[GENOMIC_CODON(target,j)]+GENOMIC_3SS(target,j-3)" 42 target_label 3SS_PHASE_0 43 endsource 44 source INTRON_1 offi="1" offj="5" 45 calc="query->seg[i]->transition[GW_MATCH2MATCH] + gp->transition[GP4_INTRON2CDS] + GENOMIC_3SS(target,j-2)" 46 target_label 3SS_PHASE_1 47 endsource 48 source INTRON_2 offi="1" offj="4" 49 calc="query->seg[i]->transition[GW_MATCH2MATCH] + gp->transition[GP4_INTRON2CDS] + GENOMIC_3SS(target,j-1)" 50 target_label 3SS_PHASE_2 51 endsource 52# 53# Sequencing error transitions, at offsets 1,2,4,5 for delete 1,2 or insert 1,2 54# 55 source MATCH offi="1" offj="2" 56 calc="gp->transition[GP4_DELETE_1_BASE]" 57 target_label SEQUENCE_DELETION 58 endsource 59 source MATCH offi="1" offj="1" 60 calc="gp->transition[GP4_DELETE_2_BASE]" 61 target_label SEQUENCE_DELETION 62 endsource 63 source MATCH offi="1" offj="4" 64 calc="gp->transition[GP4_INSERT_1_BASE]" 65 target_label SEQUENCE_INSERTION 66 endsource 67 source MATCH offi="1" offj="5" 68 calc="gp->transition[GP4_INSERT_2_BASE]" 69 target_label SEQUENCE_INSERTION 70 endsource 71 query_label MATCH_STATE 72 target_label CODON 73 endstate 74# 75# Insert state: does not move along model, produces DNA sequence... 76# 77state INSERT offi="0" offj="3" 78 calc="GENOMIC_CDS_POT(target,j)" 79 source MATCH 80 calc="query->seg[i]->transition[GW_MATCH2INSERT] + query->seg[i]->insert[GENOMIC_CODON(target,j)]" 81 endsource 82 source INSERT 83 calc="query->seg[i]->transition[GW_INSERT2INSERT] + query->seg[i]->insert[GENOMIC_CODON(target,j)]" 84 endsource 85 source DELETE 86 calc="query->seg[i]->transition[GW_DELETE2INSERT] + query->seg[i]->insert[GENOMIC_CODON(target,j)]" 87 endsource 88 source START 89 calc="query->seg[i]->transition[GW_START2INSERT] + query->seg[i]->insert[GENOMIC_CODON(target,j)]" 90 endsource 91# 92# phase 0,1,2 introns can calculate whole amino acid for 0. 93# 94 source INTRON_0 offi="0" offj="6" 95 calc="query->seg[i]->transition[GW_INSERT2INSERT] + gp->transition[GP4_INTRON2CDS] + query->seg[i]->match[GENOMIC_CODON(target,j)]+GENOMIC_3SS(target,j-3)" 96 target_label 3SS_PHASE_0 97 endsource 98 source INTRON_1 offi="0" offj="5" 99 calc="query->seg[i]->transition[GW_INSERT2INSERT] + gp->transition[GP4_INTRON2CDS] + GENOMIC_3SS(target,j-2)" 100 target_label 3SS_PHASE_1 101 endsource 102 source INTRON_2 offi="0" offj="4" 103 calc="query->seg[i]->transition[GW_INSERT2INSERT] + gp->transition[GP4_INTRON2CDS] + GENOMIC_3SS(target,j-1)" 104 target_label 3SS_PHASE_2 105 endsource 106# 107# Sequencing error transitions: because insertions are "for free" usually, we will 108# only model sequence deletion here. Could produce odd results though! 109# 110 source INSERT offi="0" offj="2" 111 calc="gp->transition[GP4_DELETE_1_BASE]" 112 target_label SEQUENCE_DELETION 113 endsource 114 source INSERT offi="0" offj="1" 115 calc="gp->transition[GP4_DELETE_2_BASE]" 116 target_label SEQUENCE_DELETION 117 endsource 118 query_label INSERT_STATE 119 target_label CODON 120 endstate 121state DELETE offi="1" offj="0" 122 source MATCH 123 calc="query->seg[i]->transition[GW_MATCH2DELETE]" 124 endsource 125 source INSERT 126 calc="query->seg[i]->transition[GW_INSERT2DELETE]" 127 endsource 128 source DELETE 129 calc="query->seg[i]->transition[GW_DELETE2DELETE]" 130 endsource 131 source START 132 calc="query->seg[i]->transition[GW_START2DELETE]" 133 endsource 134 query_label DELETE_STATE 135 target_label INSERT 136 endstate 137# 138# Intron state: 3 separate phases, and merge INSERT/MATCH information 139# 140state INTRON_0 offi="0" offj="1" 141 source MATCH offj="8" 142 calc="gp->intron[GENOMIC_BASE(target,j)]+GENOMIC_5SS(target,j-7)" 143 target_label 5SS_PHASE_0 144 endsource 145 source INSERT offj="8" 146 calc="gp->intron[GENOMIC_BASE(target,j)]+GENOMIC_5SS(target,j-7)" 147 target_label 5SS_PHASE_0 148 endsource 149 source INTRON_0 offj="1" 150 calc="gp->intron[GENOMIC_BASE(target,j)] + gp->transition[GP4_INTRON2INTRON]" 151 target_label CENTRAL_INTRON 152 endsource 153 query_label INTRON_STATE 154 endstate 155state INTRON_1 offi="0" offj="1" 156 source MATCH offj="9" offi="0" 157 calc="gp->intron[GENOMIC_BASE(target,j)]+GENOMIC_5SS(target,j-7)" 158 target_label 5SS_PHASE_1 159 endsource 160 source INSERT offj="9" offi="0" 161 calc="gp->intron[GENOMIC_BASE(target,j)]+GENOMIC_5SS(target,j-7)" 162 target_label 5SS_PHASE_1 163 endsource 164 source INTRON_1 offj="1" 165 calc="gp->intron[GENOMIC_BASE(target,j)] + gp->transition[GP4_INTRON2INTRON]" 166 target_label CENTRAL_INTRON 167 endsource 168 query_label INTRON_STATE 169 endstate 170state INTRON_2 offi="0" offj="1" 171 source MATCH offj="10" offi="0" 172 calc="gp->intron[GENOMIC_BASE(target,j)]+GENOMIC_5SS(target,j-7)" 173 target_label 5SS_PHASE_2 174 endsource 175 source INSERT offj="10" offi="0" 176 calc="gp->intron[GENOMIC_BASE(target,j)]+GENOMIC_5SS(target,j-7)" 177 target_label 5SS_PHASE_2 178 endsource 179 source INTRON_2 offj="1" 180 calc="gp->intron[GENOMIC_BASE(target,j)] + gp->transition[GP4_INTRON2INTRON]" 181 target_label CENTRAL_INTRON 182 endsource 183 query_label INTRON_STATE 184 endstate 185state START !start !special 186 endstate 187state END !end !special 188 source MATCH 189 calc="query->seg[i]->transition[GW_MATCH2END]" 190 endsource 191 source INSERT 192 calc="query->seg[i]->transition[GW_INSERT2END]" 193 endsource 194 source DELETE 195 calc="query->seg[i]->transition[GW_DELETE2END]" 196 endsource 197 source AFTER_MATCH_CODING offj="3" 198 calc="general_model->stop->codon[GENOMIC_CODON(target,j)]" 199 endsource 200 target_label END 201 query_label END 202 endstate 203state BEFORE_MATCH_CODING !special 204 source START offj="3" 205 calc="general_model->start->codon[GENOMIC_CODON(target,j)]" 206 endsource 207 source BEFORE_MATCH_CODING offj="3" 208 calc="general_model->general->codon[GENOMIC_CODON(target,j)]" 209 endsource 210 target_label CODON 211 query_label BEFORE_MATCH 212endstate 213state AFTER_MATCH_CODING !special 214 source MATCH 215 calc="query->seg[i]->transition[GW_MATCH2END]" 216 endsource 217 source AFTER_MATCH_CODING offj="3" 218 calc="general_model->general->codon[GENOMIC_CODON(target,j)]" 219 endsource 220 target_label CODON 221 query_label BEFORE_MATCH 222endstate 223# 224# collapse Intron labels! 225# 226collapse INTRON_STATE CENTRAL_INTRON 227endmatrix 228 229%{ 230#include "genestretch6.h" 231 232 233%} 234 235 236 237 238