| 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_FEATURE_H |
| 20 | #define ATAC_FEATURE_H |
| 21 | |
| 22 | #include <string> |
| 23 | #include <map> |
| 24 | using namespace std; |
| 25 | |
| 26 | #include "bio++.H" |
| 27 | |
| 28 | #include "seqCache.H" |
| 29 | |
| 30 | // A barebones feature. |
| 31 | // |
| 32 | // F type featureuid parentuid LABEL:IID POS |
| 33 | // |
| 34 | // The idea is to mark some region as containing some feature. You |
| 35 | // can use the featureiid to map to a chunk of non-atac data, e.g., a |
| 36 | // strucure containing information about the feature. |
| 37 | // |
| 38 | // An EST feature could be represented as: |
| 39 | // F est est4 . B35:3 423551 10421 |
| 40 | // F exon exon7 est4 B35:3 423551 346 |
| 41 | // F exon exon8 est4 B35:3 425931 146 |
| 42 | // F exon exon9 est4 B35:3 433426 546 |
| 43 | // |
| 44 | // There is nothing there that immediately links these atac features |
| 45 | // to their respective est/exon data structures. This is a Good |
| 46 | // Thing (tm) because usually we don't have any form of ID with those |
| 47 | // data structures, so we'd be using an offset or something, which |
| 48 | // would change if the features are filtered. |
| 49 | // |
| 50 | class atacFeature { |
| 51 | public: |
| 52 | atacFeature() {}; |
| 53 | atacFeature(char *line); |
| 54 | atacFeature(char *fuid, |
| 55 | char *puid, |
| 56 | uint32 fiid, |
| 57 | char *t, |
| 58 | uint32 i, uint32 p, uint32 l); |
| 59 | |
| 60 | void decode(char *line); |
| 61 | |
| 62 | bool sanity(seqCache *A, char *inLine); |
| 63 | |
| 64 | char featureuid[16]; |
| 65 | char parentuid[16]; |
| 66 | uint32 featureiid; |
| 67 | char type[4]; |
| 68 | uint32 iid, pos, len; |
| 69 | |
| 70 | void print(FILE *f, char const *label) const { |
| 71 | fprintf(f, "F %s %s %s %s:"uint32FMT" "uint32FMT" "uint32FMT"\n", |
| 72 | type, |
| 73 | featureuid, parentuid, |
| 74 | label, iid, pos, len); |
| 75 | }; |
| 76 | }; |
| 77 | |
| 78 | #endif // ATAC_FEATURE_H |