Debian Codegraph @

atac-driver/libatac/atacMatch.C

raw symbols SCIP
1 // This file is part of A2Amapper.cxx . . $ `<file>/atac-driver/libatac/atacMatch.C`/
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 "atac.H"cxx . . $ `<file>/atac-driver/libatac/atac.H`/
20
21 static
22 uint32cxx . . $ uint32#
23 decodeAtacNamecxx . . $ decodeAtacName(fb80c8a16196665a).(char *atac,
24 char *label) {
25 if (label) {
26 while (*atac && (*atac != ':'))
27 *label++ = *atac++;
28 *label = 0;
29 } else {
30 while (*atac && (*atac != ':'))
31 atac++;
32 }
33 if (*atac)
34 return(strtouint32cxx . . $ `libutil/util.h:82:10`!(atac+1, 0L));
35 return(~uint32ZEROcxx . . $ `libutil/util.h:60:10`!);
36 }
37
38
39 atacMatchcxx . . $ atacMatch#::atacMatchcxx . . $ atacMatch#atacMatch(fda57c8427c60377).(char *line) {
40 decodecxx . . $ atacMatch#decode(fda57c8427c60377).(line);
41 }
42
43 atacMatchcxx . . $ atacMatch#::atacMatchcxx . . $ atacMatch#atacMatch(821cb801e037c3a4).(char *muid,
44 char *puid,
45 uint32cxx . . $ uint32# miid,
46 char *t,
47 uint32cxx . . $ uint32# i1, uint32cxx . . $ uint32# p1, uint32cxx . . $ uint32# l1, uint32cxx . . $ uint32# f1,
48 uint32cxx . . $ uint32# i2, uint32cxx . . $ uint32# p2, uint32cxx . . $ uint32# l2, uint32cxx . . $ uint32# f2) {
49
50 strncpy(matchuidcxx . . $ atacMatch#matchuid., muid, 16);
51 strncpy(parentuidcxx . . $ atacMatch#parentuid., puid, 16);
52
53 matchuidcxx . . $ atacMatch#matchuid.[15] = 0;
54 parentuidcxx . . $ atacMatch#parentuid.[15] = 0;
55
56 matchiidcxx . . $ atacMatch#matchiid. = miid;
57
58 typecxx . . $ atacMatch#type.[0] = 0;
59 typecxx . . $ atacMatch#type.[1] = 0;
60 typecxx . . $ atacMatch#type.[2] = 0;
61 typecxx . . $ atacMatch#type.[3] = 0;
62
63 typecxx . . $ atacMatch#type.[0] = t[0];
64 typecxx . . $ atacMatch#type.[1] = t[1];
65 if (t[1])
66 typecxx . . $ atacMatch#type.[2] = t[2];
67
68 iid1cxx . . $ atacMatch#iid1. = i1;
69 pos1cxx . . $ atacMatch#pos1. = p1;
70 len1cxx . . $ atacMatch#len1. = l1;
71 fwd1cxx . . $ atacMatch#fwd1. = f1;
72 iid2cxx . . $ atacMatch#iid2. = i2;
73 pos2cxx . . $ atacMatch#pos2. = p2;
74 len2cxx . . $ atacMatch#len2. = l2;
75 fwd2cxx . . $ atacMatch#fwd2. = f2;
76 }
77
78 void
79 atacMatchcxx . . $ atacMatch#::decodecxx . . $ atacMatch#decode(fda57c8427c60377).(char *line) {
80 iid1cxx . . $ atacMatch#iid1. = 0;
81 pos1cxx . . $ atacMatch#pos1. = 0;
82 len1cxx . . $ atacMatch#len1. = 0;
83 fwd1cxx . . $ atacMatch#fwd1. = 0;
84 iid2cxx . . $ atacMatch#iid2. = 0;
85 pos2cxx . . $ atacMatch#pos2. = 0;
86 len2cxx . . $ atacMatch#len2. = 0;
87 fwd2cxx . . $ atacMatch#fwd2. = 0;
88
89 splitToWordscxx . . $ splitToWords# Scxx . . $ splitToWords#splitToWords(fda57c8427c60377).(line);
90
91 iid1cxx . . $ atacMatch#iid1. = decodeAtacNamecxx . . $ decodeAtacName(fb80c8a16196665a).(S[cxx . . $ splitToWords#`operator[]`(f109d7e0a0ca42b3).4], 0L);
92 pos1cxx . . $ atacMatch#pos1. = strtouint32cxx . . $ `libutil/util.h:82:10`!(S[5], 0L);
93 len1cxx . . $ atacMatch#len1. = strtouint32cxx . . $ `libutil/util.h:82:10`!(S[6], 0L);
94 fwd1cxx . . $ atacMatch#fwd1. = (S[cxx . . $ splitToWords#`operator[]`(f109d7e0a0ca42b3).7][0] == '-') ? 0 : 1;
95 iid2cxx . . $ atacMatch#iid2. = decodeAtacNamecxx . . $ decodeAtacName(fb80c8a16196665a).(S[cxx . . $ splitToWords#`operator[]`(f109d7e0a0ca42b3).8], 0L);
96 pos2cxx . . $ atacMatch#pos2. = strtouint32cxx . . $ `libutil/util.h:82:10`!(S[9], 0L);
97 len2cxx . . $ atacMatch#len2. = strtouint32cxx . . $ `libutil/util.h:82:10`!(S[10], 0L);
98 fwd2cxx . . $ atacMatch#fwd2. = (S[cxx . . $ splitToWords#`operator[]`(f109d7e0a0ca42b3).11][0] == '-') ? 0 : 1;
99
100 strncpy(matchuidcxx . . $ atacMatch#matchuid., S[cxx . . $ splitToWords#`operator[]`(f109d7e0a0ca42b3).2], 16);
101 strncpy(parentuidcxx . . $ atacMatch#parentuid., S[cxx . . $ splitToWords#`operator[]`(f109d7e0a0ca42b3).3], 16);
102
103 matchuidcxx . . $ atacMatch#matchuid.[15] = 0;
104 parentuidcxx . . $ atacMatch#parentuid.[15] = 0;
105
106 matchiidcxx . . $ atacMatch#matchiid. = 0;
107
108 typecxx . . $ atacMatch#type.[0] = 0;
109 typecxx . . $ atacMatch#type.[1] = 0;
110 typecxx . . $ atacMatch#type.[2] = 0;
111 typecxx . . $ atacMatch#type.[3] = 0;
112
113 typecxx . . $ atacMatch#type.[0] = S[cxx . . $ splitToWords#`operator[]`(f109d7e0a0ca42b3).1][0];
114 typecxx . . $ atacMatch#type.[1] = S[cxx . . $ splitToWords#`operator[]`(f109d7e0a0ca42b3).1][1];
115 if (S[cxx . . $ splitToWords#`operator[]`(f109d7e0a0ca42b3).1][1])
116 typecxx . . $ atacMatch#type.[2] = S[cxx . . $ splitToWords#`operator[]`(f109d7e0a0ca42b3).1][2];
117 }
118
119
120 // Sanity check the match record -- make sure it's within the
121 // sequence itself.
122 //
123 bool
124 atacMatchcxx . . $ atacMatch#::sanitycxx . . $ atacMatch#sanity(58b65b0b3b0914b8).(seqCachecxx . . $ seqCache# *A, seqCachecxx . . $ seqCache# *B, char *inLine) {
125
126 bool matchOK = true;
127
128 if (A && B) {
129 if ((pos1cxx . . $ atacMatch#pos1.) > A->getSequenceLengthcxx . . $ seqCache#getSequenceLength(2141b656ce2cc063).(iid1cxx . . $ atacMatch#iid1.) || (pos1cxx . . $ atacMatch#pos1. + len1cxx . . $ atacMatch#len1.) > A->getSequenceLengthcxx . . $ seqCache#getSequenceLength(2141b656ce2cc063).(iid1cxx . . $ atacMatch#iid1.)) {
130 chompcxx . . $ `libutil/util.h:330:9`!(inLine);
131 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Match longer than sequence (by "uint32FMTcxx . . $ `libutil/util.h:65:10`!"bp) in 1: seqLen="uint32FMTWcxx . . $ `libutil/util.h:64:10`!(8)" %s\n",
132 pos1cxx . . $ atacMatch#pos1. + len1cxx . . $ atacMatch#len1. - A->getSequenceLengthcxx . . $ seqCache#getSequenceLength(2141b656ce2cc063).(iid1cxx . . $ atacMatch#iid1.),
133 A->getSequenceLengthcxx . . $ seqCache#getSequenceLength(2141b656ce2cc063).(iid1cxx . . $ atacMatch#iid1.), inLine);
134 matchOK = false;
135 }
136
137 if ((pos2cxx . . $ atacMatch#pos2.) > B->getSequenceLengthcxx . . $ seqCache#getSequenceLength(2141b656ce2cc063).(iid2cxx . . $ atacMatch#iid2.) || (pos2cxx . . $ atacMatch#pos2. + len2cxx . . $ atacMatch#len2.) > B->getSequenceLengthcxx . . $ seqCache#getSequenceLength(2141b656ce2cc063).(iid2cxx . . $ atacMatch#iid2.)) {
138 chompcxx . . $ `libutil/util.h:330:9`!(inLine);
139 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Match longer than sequence (by "uint32FMTcxx . . $ `libutil/util.h:65:10`!"bp) in 2: seqLen="uint32FMTWcxx . . $ `libutil/util.h:64:10`!(8)" %s\n",
140 pos2cxx . . $ atacMatch#pos2. + len2cxx . . $ atacMatch#len2. - B->getSequenceLengthcxx . . $ seqCache#getSequenceLength(2141b656ce2cc063).(iid2cxx . . $ atacMatch#iid2.),
141 B->getSequenceLengthcxx . . $ seqCache#getSequenceLength(2141b656ce2cc063).(iid2cxx . . $ atacMatch#iid2.), inLine);
142 matchOK = false;
143 }
144
145 if ((iid1cxx . . $ atacMatch#iid1. >= A->getNumberOfSequencescxx . . $ seqCache#getNumberOfSequences(db52760e79bf9054).()) || (iid2cxx . . $ atacMatch#iid2. >= B->getNumberOfSequencescxx . . $ seqCache#getNumberOfSequences(db52760e79bf9054).())) {
146 chompcxx . . $ `libutil/util.h:330:9`!(inLine);
147 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Match references invalid sequence iid: %s\n", inLine);
148 matchOK = false;
149 }
150 }
151
152 return(matchOK);
153 }
154