Debian Codegraph @

atac-driver/alignOverlap/overlap-printAnno.C

raw symbols SCIP
1 // This file is part of A2Amapper.
2 // Copyright (c) 2005 J. Craig Venter Institute
3 // Author: Brian Walenz
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received (LICENSE.txt) a copy of the GNU General Public
16 // License along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 #include "overlap.H"
20
21 void
22 printAnno(FILE *F, annoList *AL, uint32 &ALlen,
23 char label,
24 uint32 axis,
25 span_t *span,
26 uint32 match1, atacMatch *m1,
27 uint32 match2, atacMatch *m2) {
28
29 // If we're just given match1, make it match2 if it is the second mapping
30 //
31 if ((match1 >> COLORSHIFT) && (match2 == uint32ZERO)) {
32 match2 = match1; m2 = m1;
33 match1 = 0; m1 = 0;
34 }
35
36 uint32 len = span->_end - span->_beg;
37
38 // axis is 1 or 2; if we're the first axis (B35 centric) make a
39 // list of the matches for later processing
40
41 if (axis == 1)
42 AL[ALlen++].add(label, span->_iid, span->_beg, len,
43 match1 & COLORMASK, m1,
44 match2 & COLORMASK, m2);
45
46 fprintf(F, "%c "uint32FMTW(4)":"uint32FMTW(09)"-"uint32FMTW(09)"["uint32FMTW(6)"] ",
47 label,
48 span->_iid, span->_beg, span->_end, len);
49
50 if (m1) {
51 fprintf(F, "%s ", m1->matchuid);
52 uint32 off1 = span->_beg - m1->pos1;
53
54 if (axis == 1) {
55 uint32 sta = m1->pos2 + off1;
56 uint32 end = m1->pos2 + off1 + len;
57
58 if (m1->fwd2 == 0) {
59 sta = m1->pos2 + m1->len2 - off1;
60 end = m1->pos2 + m1->len2 - off1 - len;
61 }
62
63 fprintf(F, "("uint32FMTW(8)": "uint32FMTW(9)"-"uint32FMTW(9)") ", m1->iid2, sta, end);
64 } else {
65 fprintf(F, "("uint32FMTW(8)": "uint32FMTW(9)"-"uint32FMTW(9)") ", m1->iid1, m1->pos1 + off1, m1->pos1 + off1 + len);
66 }
67 } else {
68 fprintf(F, uint32FMTW(07)" ", uint32ZERO);
69 fprintf(F, "("uint32FMTW(8)": "uint32FMTW(9)"-"uint32FMTW(9)") ", uint32ZERO, uint32ZERO, uint32ZERO);
70 }
71
72 if (m2) {
73 fprintf(F, "%s ", m2->matchuid);
74 uint32 off2 = span->_beg - m2->pos1;
75
76 if (axis == 1) {
77 uint32 sta = m2->pos2 + off2;
78 uint32 end = m2->pos2 + off2 + len;
79
80 if (m2->fwd2 == 0) {
81 sta = m2->pos2 + m2->len2 - off2;
82 end = m2->pos2 + m2->len2 - off2 - len;
83 }
84
85 fprintf(F, "("uint32FMTW(8)": "uint32FMTW(9)"-"uint32FMTW(9)") ", m2->iid2, sta, end);
86 } else {
87 fprintf(F, "("uint32FMTW(8)": "uint32FMTW(9)"-"uint32FMTW(9)") ", m2->iid1, m2->pos1 + off2, m2->pos1 + off2 + len);
88 }
89 } else {
90 fprintf(F, uint32FMTW(07)" ", uint32ZERO);
91 fprintf(F, "("uint32FMTW(8)": "uint32FMTW(9)"-"uint32FMTW(9)") ", uint32ZERO, uint32ZERO, uint32ZERO);
92 }
93
94 fprintf(F, "\n");
95 }