1 2 /****************************************************************************** 3 * 4 * This file is part of canu, a software program that assembles whole-genome 5 * sequencing reads into contigs. 6 * 7 * This software is based on: 8 * 'Celera Assembler' r4587 (http://wgs-assembler.sourceforge.net) 9 * the 'kmer package' r1994 (http://kmer.sourceforge.net) 10 * 11 * Except as indicated otherwise, this is a 'United States Government Work', 12 * and is released in the public domain. 13 * 14 * File 'README.licenses' in the root directory of this distribution 15 * contains full conditions and disclaimers. 16 */ 17 18 #ifndef AS_UTL_GFA_H 19 #define AS_UTL_GFA_H 20 21 #include "runtime.H" 22 #include "strings.H" 23 24 #include <vector> 25 26 27 // Features assumed to hold only the length, and we don't use it. 28 29 class gfaSequence { 30 public: 31 gfaSequence(); 32 gfaSequence(char *inLine); 33 gfaSequence(char *name, uint32 id, uint32 len); 34 ~gfaSequence(); 35 36 void load(char *inLine); 37 void save(FILE *outFile); 38 39 public: 40 char *_name; 41 uint32 _id; 42 char *_sequence; 43 char *_features; 44 45 uint32 _length; 46 }; 47 48 49 50 51 class gfaLink { 52 public: 53 gfaLink(); 54 gfaLink(char *inLine); 55 gfaLink(char *Aname, uint32 Aid, bool Afwd, 56 char *Bname, uint32 Bid, bool Bfwd, char *cigar); 57 ~gfaLink(); 58 59 void load(char *inLine); 60 void save(FILE *outFile); 61 62 void alignmentLength(int32 &queryLen, int32 &refceLen, int32 &alignLen); 63 64 public: 65 char *_Aname; 66 uint32 _Aid; // Canu specific. 67 bool _Afwd; 68 69 char *_Bname; 70 uint32 _Bid; // Canu specific. 71 bool _Bfwd; 72 73 char *_cigar; 74 75 char *_features; 76 }; 77 78 79 80 81 class gfaFile { 82 public: 83 gfaFile(); 84 gfaFile(char const *inName); 85 ~gfaFile(); 86 87 bool loadFile(char const *inName); 88 bool saveFile(char const *outName); 89 90 public: 91 char *_header; 92 93 std::vector<gfaSequence *> _sequences; 94 std::vector<gfaLink *> _links; 95 }; 96 97 98 99 100 #endif // AS_UTL_GFA_H 101