-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathContentType.C
672 lines (585 loc) · 20.9 KB
/
ContentType.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
/*
ContentType.C
Copyright (C)2013 William H. Majoros ([email protected]).
This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
License (GPL) version 3, as described at www.opensource.org.
*/
#include "ContentType.H"
#include "BOOM/Map.H"
static BOOM::Map<BOOM::String,ContentType> contentTypeMap;
static BOOM::Map<BOOM::String,ContentType> longContentTypeMap;
ContentTypeInitializer ContentTypeInitializer::initializer;
ContentTypeInitializer::ContentTypeInitializer()
{
contentTypeMap["INTERGENIC"]= INTERGENIC;
contentTypeMap["INITIAL-EXON"]= INITIAL_EXON;
contentTypeMap["INTERNAL-EXON"]= INTERNAL_EXON;
contentTypeMap["FINAL-EXON"]= FINAL_EXON;
contentTypeMap["SINGLE-EXON"]= SINGLE_EXON;
contentTypeMap["INTRON"]= INTRON;
contentTypeMap["UTR5-INTRON"]= UTR5_INTRON;
contentTypeMap["UTR3-INTRON"]= UTR3_INTRON;
contentTypeMap["INITIAL-UTR5"]= UTR5_INITIAL;
contentTypeMap["INTERNAL-UTR5"]= UTR5_INTERNAL;
contentTypeMap["FINAL-UTR5"]= UTR5_FINAL;
contentTypeMap["SINGLE-UTR5"]= UTR5_SINGLE;
contentTypeMap["INITIAL-UTR3"]= UTR3_INITIAL;
contentTypeMap["INTERNAL-UTR3"]= UTR3_INTERNAL;
contentTypeMap["FINAL-UTR3"]= UTR3_FINAL;
contentTypeMap["SINGLE-UTR3"]= UTR3_SINGLE;
contentTypeMap["NEG-INITIAL-UTR5"]= NEG_UTR5_INITIAL;
contentTypeMap["NEG-INTERNAL-UTR5"]= NEG_UTR5_INTERNAL;
contentTypeMap["NEG-FINAL-UTR5"]= NEG_UTR5_FINAL;
contentTypeMap["NEG-SINGLE-UTR5"]= NEG_UTR5_SINGLE;
contentTypeMap["NEG-INITIAL-UTR3"]= NEG_UTR3_INITIAL;
contentTypeMap["NEG-INTERNAL-UTR3"]= NEG_UTR3_INTERNAL;
contentTypeMap["NEG-FINAL-UTR3"]= NEG_UTR3_FINAL;
contentTypeMap["NEG-SINGLE-UTR3"]= NEG_UTR3_SINGLE;
contentTypeMap["NEG-INITIAL-EXON"]= NEG_INITIAL_EXON;
contentTypeMap["NEG-INTERNAL-EXON"]= NEG_INTERNAL_EXON;
contentTypeMap["NEG-FINAL-EXON"]= NEG_FINAL_EXON;
contentTypeMap["NEG-SINGLE-EXON"]= NEG_SINGLE_EXON;
contentTypeMap["NEG-INTRON"]= NEG_INTRON;
contentTypeMap["NEG-UTR5-INTRON"]= NEG_UTR5_INTRON;
contentTypeMap["NEG-UTR3-INTRON"]= NEG_UTR3_INTRON;
contentTypeMap["UNKNOWN-CONTENT-FORWARD"]=UNKNOWN_CONTENT_FORWARD;
contentTypeMap["UNKNOWN-CONTENT-REVERSE"]=UNKNOWN_CONTENT_REVERSE;
longContentTypeMap["initial-exon"]= INITIAL_EXON;
longContentTypeMap["internal-exon"]= INTERNAL_EXON;
longContentTypeMap["final-exon"]= FINAL_EXON;
longContentTypeMap["single-exon"]= SINGLE_EXON;
longContentTypeMap["intron"]= INTRON;
longContentTypeMap["UTR5-intron"]= UTR5_INTRON;
longContentTypeMap["UTR3-intron"]= UTR3_INTRON;
longContentTypeMap["intergenic"]= INTERGENIC;
longContentTypeMap["initial-UTR5"]= UTR5_INITIAL;
longContentTypeMap["internal-UTR5"]= UTR5_INTERNAL;
longContentTypeMap["final-UTR5"]= UTR5_FINAL;
longContentTypeMap["single-UTR5"]= UTR5_SINGLE;
longContentTypeMap["initial-UTR3"]= UTR3_INITIAL;
longContentTypeMap["internal-UTR3"]= UTR3_INTERNAL;
longContentTypeMap["final-UTR3"]= UTR3_FINAL;
longContentTypeMap["single-UTR3"]= UTR3_SINGLE;
}
Strand getStrand(ContentType t)
{
switch(t)
{
case UNKNOWN_CONTENT_FORWARD:
case INITIAL_EXON:
case INTERNAL_EXON:
case FINAL_EXON:
case SINGLE_EXON:
case INTRON:
case UTR5_INTRON:
case UTR3_INTRON:
case INTERGENIC://###
case UTR5_INITIAL:
case UTR5_INTERNAL:
case UTR5_FINAL:
case UTR5_SINGLE:
case UTR3_INITIAL:
case UTR3_INTERNAL:
case UTR3_FINAL:
case UTR3_SINGLE:
return FORWARD_STRAND;
case UNKNOWN_CONTENT_REVERSE:
case NEG_INITIAL_EXON:
case NEG_INTERNAL_EXON:
case NEG_FINAL_EXON:
case NEG_SINGLE_EXON:
case NEG_INTRON:
case NEG_UTR5_INTRON:
case NEG_UTR3_INTRON:
case NEG_UTR5_INITIAL:
case NEG_UTR5_INTERNAL:
case NEG_UTR5_FINAL:
case NEG_UTR5_SINGLE:
case NEG_UTR3_INITIAL:
case NEG_UTR3_INTERNAL:
case NEG_UTR3_FINAL:
case NEG_UTR3_SINGLE:
return REVERSE_STRAND;
default: throw BOOM::String(__FILE__)+__LINE__;
}
}
BOOM::String contentTypeToString(ContentType t)
{
switch(t)
{
case UNKNOWN_CONTENT_FORWARD: return "UNKNOWN-CONTENT-FORWARD";
case UNKNOWN_CONTENT_REVERSE: return "UNKNOWN-CONTENT-REVERSE";
case INITIAL_EXON: return "INITIAL-EXON";
case INTERNAL_EXON: return "INTERNAL-EXON";
case FINAL_EXON: return "FINAL-EXON";
case SINGLE_EXON: return "SINGLE-EXON";
case INTRON: return "INTRON";
case UTR5_INTRON: return "UTR5-INTRON";
case UTR3_INTRON: return "UTR3-INTRON";
case INTERGENIC: return "INTERGENIC";
case UTR5_INITIAL: return "UTR5-INITIAL";
case UTR5_INTERNAL: return "UTR5-INTERNAL";
case UTR5_FINAL: return "UTR5-FINAL";
case UTR5_SINGLE: return "UTR5-SINGLE";
case UTR3_INITIAL: return "UTR3-INITIAL";
case UTR3_INTERNAL: return "UTR3-INTERNAL";
case UTR3_FINAL: return "UTR3-FINAL";
case UTR3_SINGLE: return "UTR3-SINGLE";
case NEG_INITIAL_EXON: return "NEG-INITIAL-EXON";
case NEG_INTERNAL_EXON: return "NEG-INTERNAL-EXON";
case NEG_FINAL_EXON: return "NEG-FINAL-EXON";
case NEG_SINGLE_EXON: return "NEG-SINGLE-EXON";
case NEG_INTRON: return "NEG-INTRON";
case NEG_UTR5_INTRON: return "NEG-UTR5-INTRON";
case NEG_UTR3_INTRON: return "NEG-UTR3-INTRON";
case NEG_UTR5_INITIAL: return "NEG-UTR5-INITIAL";
case NEG_UTR5_INTERNAL: return "NEG-UTR5-INTERNAL";
case NEG_UTR5_FINAL: return "NEG-UTR5-FINAL";
case NEG_UTR5_SINGLE: return "NEG-UTR5-SINGLE";
case NEG_UTR3_INITIAL: return "NEG-UTR3-INITIAL";
case NEG_UTR3_INTERNAL: return "NEG-UTR3-INTERNAL";
case NEG_UTR3_FINAL: return "NEG-UTR3-FINAL";
case NEG_UTR3_SINGLE: return "NEG-UTR3-SINGLE";
default: throw BOOM::String("INVALID CONTENT TYPE: ")+int(t);
}
}
BOOM::String contentTypeNiceString(ContentType t)
{
switch(t)
{
case UNKNOWN_CONTENT_FORWARD: return "UNKNOWN-CONTENT-FORWARD";
case UNKNOWN_CONTENT_REVERSE: return "UNKNOWN-CONTENT-REVERSE";
case INITIAL_EXON: return "initial-exon";
case INTERNAL_EXON: return "internal-exon";
case FINAL_EXON: return "final-exon";
case SINGLE_EXON: return "single-exon";
case INTRON: return "intron";
case UTR5_INTRON: return "UTR5-intron";
case UTR3_INTRON: return "UTR3-intron";
case INTERGENIC: return "intergenic";
case UTR5_INITIAL: return "initial-UTR5";
case UTR5_INTERNAL: return "internal-UTR5";
case UTR5_FINAL: return "final-UTR5";
case UTR5_SINGLE: return "single-UTR5";
case UTR3_INITIAL: return "initial-UTR3";
case UTR3_INTERNAL: return "internal-UTR3";
case UTR3_FINAL: return "final-UTR3";
case UTR3_SINGLE: return "single-UTR3";
case NEG_INITIAL_EXON: return "initial-exon";
case NEG_INTERNAL_EXON: return "internal-exon";
case NEG_FINAL_EXON: return "final-exon";
case NEG_SINGLE_EXON: return "single-exon";
case NEG_INTRON: return "intron";
case NEG_UTR5_INTRON: return "UTR5-intron";
case NEG_UTR3_INTRON: return "UTR3-intron";
case NEG_UTR5_INITIAL: return "initial-UTR5";
case NEG_UTR5_INTERNAL: return "internal-UTR5";
case NEG_UTR5_FINAL: return "final-UTR5";
case NEG_UTR5_SINGLE: return "single-UTR5";
case NEG_UTR3_INITIAL: return "initial-UTR3";
case NEG_UTR3_INTERNAL: return "internal-UTR3";
case NEG_UTR3_FINAL: return "final-UTR3";
case NEG_UTR3_SINGLE: return "single-UTR3";
default: throw BOOM::String("INVALID CONTENT TYPE: ")+int(t);
}
}
ContentType stringToContentType(const BOOM::String &str)
{
if(contentTypeMap.isDefined(str)) return contentTypeMap[str];
if(longContentTypeMap.isDefined(str)) return longContentTypeMap[str];
throw BOOM::String("undefined ContentType: ")+str;
}
istream &operator>>(istream &is,ContentType &t)
{
BOOM::String buf;
is >> buf;
t=stringToContentType(buf);
return is;
}
ostream &operator<<(ostream &os,const ContentType &t)
{
os << contentTypeToString(t);
return os;
}
ContentType reverseComplement(ContentType t)
{
switch(t)
{
case INITIAL_EXON: return NEG_INITIAL_EXON;
case INTERNAL_EXON: return NEG_INTERNAL_EXON;
case FINAL_EXON: return NEG_FINAL_EXON;
case SINGLE_EXON: return NEG_SINGLE_EXON;
case INTRON: return NEG_INTRON;
case UTR5_INTRON: return NEG_UTR5_INTRON;
case UTR3_INTRON: return NEG_UTR3_INTRON;
case UTR5_INITIAL: return NEG_UTR5_INITIAL;
case UTR5_INTERNAL: return NEG_UTR5_INTERNAL;
case UTR5_FINAL: return NEG_UTR5_FINAL;
case UTR5_SINGLE: return NEG_UTR5_SINGLE;
case UTR3_INITIAL: return NEG_UTR3_INITIAL;
case UTR3_INTERNAL: return NEG_UTR3_INTERNAL;
case UTR3_FINAL: return NEG_UTR3_FINAL;
case UTR3_SINGLE: return NEG_UTR3_SINGLE;
case UNKNOWN_CONTENT_FORWARD: return UNKNOWN_CONTENT_REVERSE;
case NEG_INITIAL_EXON: return INITIAL_EXON;
case NEG_INTERNAL_EXON: return INTERNAL_EXON;
case NEG_FINAL_EXON: return FINAL_EXON;
case NEG_SINGLE_EXON: return SINGLE_EXON;
case NEG_INTRON: return INTRON;
case NEG_UTR5_INTRON: return UTR5_INTRON;
case NEG_UTR3_INTRON: return UTR3_INTRON;
case NEG_UTR5_INITIAL: return UTR5_INITIAL;
case NEG_UTR5_INTERNAL: return UTR5_INTERNAL;
case NEG_UTR5_FINAL: return UTR5_FINAL;
case NEG_UTR5_SINGLE: return UTR5_SINGLE;
case NEG_UTR3_INITIAL: return UTR3_INITIAL;
case NEG_UTR3_INTERNAL: return UTR3_INTERNAL;
case NEG_UTR3_FINAL: return UTR3_FINAL;
case NEG_UTR3_SINGLE: return UTR3_SINGLE;
case UNKNOWN_CONTENT_REVERSE: return UNKNOWN_CONTENT_FORWARD;
case INTERGENIC: return INTERGENIC;
default: INTERNAL_ERROR;
}
}
bool isCoding(ContentType t)
{
switch(t)
{
case INITIAL_EXON:
case INTERNAL_EXON:
case FINAL_EXON:
case SINGLE_EXON:
case NEG_INITIAL_EXON:
case NEG_INTERNAL_EXON:
case NEG_FINAL_EXON:
case NEG_SINGLE_EXON:
return true;
case INTRON:
case UTR5_INTRON:
case UTR3_INTRON:
case INTERGENIC:
case NEG_INTRON:
case NEG_UTR5_INTRON:
case NEG_UTR3_INTRON:
case UTR5_INITIAL:
case UTR5_INTERNAL:
case UTR5_FINAL:
case UTR5_SINGLE:
case UTR3_INITIAL:
case UTR3_INTERNAL:
case UTR3_FINAL:
case UTR3_SINGLE:
case NEG_UTR5_INITIAL:
case NEG_UTR5_INTERNAL:
case NEG_UTR5_FINAL:
case NEG_UTR5_SINGLE:
case NEG_UTR3_INITIAL:
case NEG_UTR3_INTERNAL:
case NEG_UTR3_FINAL:
case NEG_UTR3_SINGLE:
return false;
case UNKNOWN_CONTENT_FORWARD:
case UNKNOWN_CONTENT_REVERSE:
throw "isCoding(UNKNOWN_CONTENT_FORWARD/REVERSE)";
default: INTERNAL_ERROR;
}
}
bool isIntron(ContentType t)
{
switch(t)
{
case INTRON:
case UTR5_INTRON:
case UTR3_INTRON:
case NEG_INTRON:
case NEG_UTR5_INTRON:
case NEG_UTR3_INTRON:
return true;
default:
return false;
}
}
bool isIntergenic(ContentType t)
{
return t==INTERGENIC;
}
bool isUTR(ContentType t)
{
switch(t)
{
case UTR5_INITIAL:
case UTR5_INTERNAL:
case UTR5_FINAL:
case UTR5_SINGLE:
case UTR3_INITIAL:
case UTR3_INTERNAL:
case UTR3_FINAL:
case UTR3_SINGLE:
case NEG_UTR5_INITIAL:
case NEG_UTR5_INTERNAL:
case NEG_UTR5_FINAL:
case NEG_UTR5_SINGLE:
case NEG_UTR3_INITIAL:
case NEG_UTR3_INTERNAL:
case NEG_UTR3_FINAL:
case NEG_UTR3_SINGLE:
return true;
default:
return false;
}
}
bool isUTR5(ContentType t)
{
switch(t)
{
case UTR5_INITIAL:
case UTR5_INTERNAL:
case UTR5_FINAL:
case UTR5_SINGLE:
case NEG_UTR5_INITIAL:
case NEG_UTR5_INTERNAL:
case NEG_UTR5_FINAL:
case NEG_UTR5_SINGLE:
return true;
}
return false;
}
bool isUTR3(ContentType t)
{
switch(t)
{
case UTR3_INITIAL:
case UTR3_INTERNAL:
case UTR3_FINAL:
case UTR3_SINGLE:
case NEG_UTR3_INITIAL:
case NEG_UTR3_INTERNAL:
case NEG_UTR3_FINAL:
case NEG_UTR3_SINGLE:
return true;
}
}
bool isUTR5intron(ContentType t)
{
switch(t)
{
case UTR5_INTRON:
case NEG_UTR5_INTRON:
return true;
}
}
bool isUTR3intron(ContentType t)
{
switch(t)
{
case UTR3_INTRON:
case NEG_UTR3_INTRON:
return true;
}
}
static Set<SignalType> sigset(SignalType t)
{
Set<SignalType> s;
s+=t;
return s;
}
static Set<SignalType> sigset(SignalType t1,SignalType t2)
{
Set<SignalType> s;
s+=t1;
s+=t2;
return s;
}
static Set<SignalType> sigset(SignalType t1,SignalType t2,SignalType t3)
{
Set<SignalType> s;
s+=t1;
s+=t2;
s+=t3;
return s;
}
Set<SignalType> leftSignals(ContentType contentType)
{
switch(contentType)
{
case INTERGENIC: return sigset(LEFT_TERMINUS,TAG,TES);
case INITIAL_EXON: return sigset(ATG);
case INTERNAL_EXON: return sigset(AG);
case FINAL_EXON: return sigset(AG);
case SINGLE_EXON: return sigset(ATG);
case INTRON: return sigset(GT);
case UTR5_INTRON: return sigset(UTR5GT);
case UTR3_INTRON: return sigset(UTR3GT);
case UTR5_INITIAL: return sigset(TSS);
case UTR5_INTERNAL: return sigset(UTR5AG);
case UTR5_FINAL: return sigset(UTR5AG);
case UTR5_SINGLE: return sigset(TSS);
case UTR3_INITIAL: return sigset(TAG);
case UTR3_INTERNAL: return sigset(UTR3AG);
case UTR3_FINAL: return sigset(UTR3AG);
case UTR3_SINGLE: return sigset(TAG);
case NEG_INITIAL_EXON: return sigset(NEG_GT);
case NEG_INTERNAL_EXON: return sigset(NEG_GT);
case NEG_FINAL_EXON: return sigset(NEG_TAG);
case NEG_SINGLE_EXON: return sigset(NEG_TAG);
case NEG_INTRON: return sigset(NEG_AG);
case NEG_UTR5_INTRON: return sigset(NEG_UTR5AG);
case NEG_UTR3_INTRON: return sigset(NEG_UTR3AG);
case NEG_UTR5_INITIAL: return sigset(NEG_GT);
case NEG_UTR5_INTERNAL: return sigset(NEG_GT);
case NEG_UTR5_FINAL: return sigset(NEG_ATG,NEG_TES);
case NEG_UTR5_SINGLE: return sigset(NEG_ATG,NEG_TES);
case NEG_UTR3_INITIAL: return sigset(NEG_GT);
case NEG_UTR3_INTERNAL: return sigset(NEG_GT);
case NEG_UTR3_FINAL: return sigset(NEG_TES);
case NEG_UTR3_SINGLE: return sigset(NEG_TES);
default: INTERNAL_ERROR;
}
}
Set<SignalType> rightSignals(ContentType contentType)
{
switch(contentType)
{
case INTERGENIC: return sigset(TSS,ATG,RIGHT_TERMINUS);
case INITIAL_EXON: return sigset(GT);
case INTERNAL_EXON: return sigset(GT);
case FINAL_EXON: return sigset(TAG);
case SINGLE_EXON: return sigset(TAG);
case INTRON: return sigset(AG);
case UTR5_INTRON: return sigset(UTR5AG);
case UTR3_INTRON: return sigset(UTR3AG);
case UTR5_INITIAL: return sigset(UTR5GT);
case UTR5_INTERNAL: return sigset(UTR5GT);
case UTR5_FINAL: return sigset(ATG,TES);
case UTR5_SINGLE: return sigset(ATG,TES);
case UTR3_INITIAL: return sigset(UTR3GT);
case UTR3_INTERNAL: return sigset(UTR3GT);
case UTR3_FINAL: return sigset(TES);
case UTR3_SINGLE: return sigset(TES);
case NEG_INITIAL_EXON: return sigset(NEG_ATG);
case NEG_INTERNAL_EXON: return sigset(NEG_AG);
case NEG_FINAL_EXON: return sigset(NEG_AG);
case NEG_SINGLE_EXON: return sigset(NEG_ATG);
case NEG_INTRON: return sigset(NEG_GT);
case NEG_UTR5_INTRON: return sigset(NEG_UTR5GT);
case NEG_UTR3_INTRON: return sigset(NEG_UTR3GT);
case NEG_UTR5_INITIAL: return sigset(NEG_TSS);
case NEG_UTR5_INTERNAL: return sigset(NEG_UTR5AG);
case NEG_UTR5_FINAL: return sigset(NEG_UTR5AG);
case NEG_UTR5_SINGLE: return sigset(NEG_TSS);
case NEG_UTR3_INITIAL: return sigset(NEG_TAG);
case NEG_UTR3_INTERNAL: return sigset(NEG_UTR3AG);
case NEG_UTR3_FINAL: return sigset(NEG_UTR3AG);
case NEG_UTR3_SINGLE: return sigset(NEG_TAG);
default: throw BOOM::String(__FILE__)+__LINE__;
}
}
ExonType contentTypeToExonType(ContentType ct)
{
switch(ct) {
case INITIAL_EXON: return ET_INITIAL_EXON;
case INTERNAL_EXON: return ET_INTERNAL_EXON;
case FINAL_EXON: return ET_FINAL_EXON;
case SINGLE_EXON: return ET_SINGLE_EXON;
case NEG_INITIAL_EXON: return ET_INITIAL_EXON;
case NEG_INTERNAL_EXON: return ET_INTERNAL_EXON;
case NEG_FINAL_EXON: return ET_FINAL_EXON;
case NEG_SINGLE_EXON: return ET_SINGLE_EXON;
case UTR5_INITIAL: return ET_INITIAL_UTR5;
case UTR5_INTERNAL: return ET_INTERNAL_UTR5;
case UTR5_FINAL: return ET_FINAL_UTR5;
case UTR5_SINGLE: return ET_SINGLE_UTR5;
case UTR3_INITIAL: return ET_INITIAL_UTR3;
case UTR3_INTERNAL: return ET_INTERNAL_UTR3;
case UTR3_FINAL: return ET_FINAL_UTR3;
case UTR3_SINGLE: return ET_SINGLE_UTR3;
case NEG_UTR5_INITIAL: return ET_INITIAL_UTR5;
case NEG_UTR5_INTERNAL: return ET_INTERNAL_UTR5;
case NEG_UTR5_FINAL: return ET_FINAL_UTR5;
case NEG_UTR5_SINGLE: return ET_SINGLE_UTR5;
case NEG_UTR3_INITIAL: return ET_INITIAL_UTR3;
case NEG_UTR3_INTERNAL: return ET_INTERNAL_UTR3;
case NEG_UTR3_FINAL: return ET_FINAL_UTR3;
case NEG_UTR3_SINGLE: return ET_SINGLE_UTR3;
default: INTERNAL_ERROR;
}
}
ContentType exonTypeToContentType(ExonType exonType,
Strand strand)
{
switch(exonType)
{
case ET_INITIAL_EXON:
return strand==FORWARD_STRAND ? INITIAL_EXON : NEG_INITIAL_EXON;
case ET_INTERNAL_EXON:
return strand==FORWARD_STRAND ? INTERNAL_EXON : NEG_INTERNAL_EXON;
case ET_FINAL_EXON:
return strand==FORWARD_STRAND ? FINAL_EXON : NEG_FINAL_EXON;
case ET_SINGLE_EXON:
return strand==FORWARD_STRAND ? SINGLE_EXON : NEG_SINGLE_EXON;
case ET_INITIAL_UTR5:
return strand==FORWARD_STRAND ? UTR5_INITIAL : NEG_UTR5_INITIAL;
case ET_INTERNAL_UTR5:
return strand==FORWARD_STRAND ? UTR5_INTERNAL : NEG_UTR5_INTERNAL;
case ET_FINAL_UTR5:
return strand==FORWARD_STRAND ? UTR5_FINAL : NEG_UTR5_FINAL;
case ET_SINGLE_UTR5:
return strand==FORWARD_STRAND ? UTR5_SINGLE : NEG_UTR5_SINGLE;
case ET_INITIAL_UTR3:
return strand==FORWARD_STRAND ? UTR3_INITIAL : NEG_UTR3_INITIAL;
case ET_INTERNAL_UTR3:
return strand==FORWARD_STRAND ? UTR3_INTERNAL : NEG_UTR3_INTERNAL;
case ET_FINAL_UTR3:
return strand==FORWARD_STRAND ? UTR3_FINAL : NEG_UTR3_FINAL;
case ET_SINGLE_UTR3:
return strand==FORWARD_STRAND ? UTR3_SINGLE : NEG_UTR3_SINGLE;
case ET_UTR: // nonspecific
case ET_UTR5:// nonspecific
case ET_UTR3:// nonspecific
case ET_EXON:// nonspecific
default:
throw "::exonTypeToContentType()";
}
}
ContentType dropStrand(ContentType t)
{
switch(t)
{
case INITIAL_EXON:
case INTERNAL_EXON:
case FINAL_EXON:
case SINGLE_EXON:
case INTRON:
case UTR5_INTRON:
case UTR3_INTRON:
case UTR5_INITIAL:
case UTR5_INTERNAL:
case UTR5_FINAL:
case UTR5_SINGLE:
case UTR3_INITIAL:
case UTR3_INTERNAL:
case UTR3_FINAL:
case UTR3_SINGLE:
case INTERGENIC:
return t;
case UNKNOWN_CONTENT_FORWARD:
case NEG_INITIAL_EXON:
case NEG_INTERNAL_EXON:
case NEG_FINAL_EXON:
case NEG_SINGLE_EXON:
case NEG_INTRON:
case NEG_UTR5_INTRON:
case NEG_UTR3_INTRON:
case NEG_UTR5_INITIAL:
case NEG_UTR5_INTERNAL:
case NEG_UTR5_FINAL:
case NEG_UTR5_SINGLE:
case NEG_UTR3_INITIAL:
case NEG_UTR3_INTERNAL:
case NEG_UTR3_FINAL:
case NEG_UTR3_SINGLE:
case UNKNOWN_CONTENT_REVERSE:
return reverseComplement(t);
}
INTERNAL_ERROR;
}