| 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 | #ifndef ATAC_MATCH_H |
| 20 | #define ATAC_MATCH_H |
| 21 | |
| 22 | #include <string> |
| 23 | #include <map> |
| 24 | using namespace std; |
| 25 | |
| 26 | #include "bio++.H" |
| 27 | |
| 28 | #include "seqCache.H" |
| 29 | |
| 30 | class atacMatch { |
| 31 | public: |
| 32 | atacMatch() { |
| 33 | matchuid[0] = 0; |
| 34 | parentuid[0] = 0; |
| 35 | matchiid = 0; |
| 36 | type[0] = 0; |
| 37 | iid1 = pos1 = len1 = fwd1 = 0; |
| 38 | iid2 = pos2 = len2 = fwd2 = 0; |
| 39 | }; |
| 40 | atacMatch(char *line); |
| 41 | atacMatch(char *muid, |
| 42 | char *puid, |
| 43 | uint32 miid, |
| 44 | char *t, |
| 45 | uint32 i1, uint32 p1, uint32 l1, uint32 f1, |
| 46 | uint32 i2, uint32 p2, uint32 l2, uint32 f2); |
| 47 | |
| 48 | void decode(char *line); |
| 49 | |
| 50 | // Sanity check the match record -- make sure it's within the |
| 51 | // sequence itself. |
| 52 | // |
| 53 | bool sanity(seqCache *A, seqCache *B, char *inLine); |
| 54 | |
| 55 | |
| 56 | char matchuid[16]; // external id |
| 57 | char parentuid[16]; // external parent id |
| 58 | uint32 matchiid; // internal id, usually pointing to an entry in atacMatchList |
| 59 | char type[4]; // right now, only need one byte, but we keep things aligned |
| 60 | uint32 iid1, pos1, len1, fwd1; |
| 61 | uint32 iid2, pos2, len2, fwd2; |
| 62 | |
| 63 | void print(FILE *f, char const *label1, char const *label2) const { |
| 64 | fprintf(f, "M %s %s %s %s:"uint32FMT" "uint32FMT" "uint32FMT" %d %s:"uint32FMT" "uint32FMT" "uint32FMT" %d\n", |
| 65 | type, |
| 66 | matchuid, parentuid, |
| 67 | label1, iid1, pos1, len1, fwd1 ? 1 : -1, |
| 68 | label2, iid2, pos2, len2, fwd2 ? 1 : -1); |
| 69 | }; |
| 70 | }; |
| 71 | |
| 72 | #endif // ATAC_MATCH_H |