| 1 | // =============================================================== // |
|---|
| 2 | // // |
|---|
| 3 | // File : RNA3D_StructureData.hxx // |
|---|
| 4 | // Purpose : // |
|---|
| 5 | // // |
|---|
| 6 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 7 | // http://www.arb-home.de/ // |
|---|
| 8 | // // |
|---|
| 9 | // =============================================================== // |
|---|
| 10 | |
|---|
| 11 | #ifndef RNA3D_STRUCTUREDATA_HXX |
|---|
| 12 | #define RNA3D_STRUCTUREDATA_HXX |
|---|
| 13 | |
|---|
| 14 | #ifndef ARBDB_H |
|---|
| 15 | #include <arbdb.h> |
|---|
| 16 | #endif |
|---|
| 17 | |
|---|
| 18 | #define SAI 0 |
|---|
| 19 | #define SEARCH 1 |
|---|
| 20 | |
|---|
| 21 | #define SSU_16S 1 |
|---|
| 22 | #define LSU_23S 2 |
|---|
| 23 | #define LSU_5S 3 |
|---|
| 24 | |
|---|
| 25 | #define _1PNU 1 |
|---|
| 26 | #define _1VOR 2 |
|---|
| 27 | #define _1C2W 3 |
|---|
| 28 | |
|---|
| 29 | // DisplayLists |
|---|
| 30 | enum { |
|---|
| 31 | STRUCTURE_BACKBONE = 300, |
|---|
| 32 | STRUCTURE_BACKBONE_CLR, |
|---|
| 33 | HELIX_NUMBERS, |
|---|
| 34 | HELIX_NUMBERS_POINTS, |
|---|
| 35 | HELIX_A, HELIX_G, HELIX_C, HELIX_U, |
|---|
| 36 | UNPAIRED_HELIX_A, UNPAIRED_HELIX_G, UNPAIRED_HELIX_C, UNPAIRED_HELIX_U, |
|---|
| 37 | NON_HELIX_A, NON_HELIX_G, NON_HELIX_C, NON_HELIX_U, |
|---|
| 38 | STRUCTURE_POS, |
|---|
| 39 | STRUCTURE_POS_ANCHOR, |
|---|
| 40 | MAP_SPECIES_BASE_DIFFERENCE, |
|---|
| 41 | MAP_SPECIES_BASE_DIFFERENCE_POS, MAP_SPECIES_BASE_DIFFERENCE_POS_ANCHOR, |
|---|
| 42 | MAP_SPECIES_BASE_A, MAP_SPECIES_BASE_G, MAP_SPECIES_BASE_C, MAP_SPECIES_BASE_U, |
|---|
| 43 | MAP_SPECIES_DELETION, MAP_SPECIES_MISSING, |
|---|
| 44 | MAP_SPECIES_INSERTION_POINTS, MAP_SPECIES_INSERTION_BASES, MAP_SPECIES_INSERTION_BASES_ANCHOR, |
|---|
| 45 | MAP_SAI_TO_STRUCTURE, |
|---|
| 46 | MAP_SEARCH_STRINGS_TO_STRUCTURE, MAP_SEARCH_STRINGS_BACKBONE, |
|---|
| 47 | ECOLI_CURSOR_POSITION, |
|---|
| 48 | ECOLI_TERTIARY_INTRACTION_PSEUDOKNOTS, |
|---|
| 49 | ECOLI_TERTIARY_INTRACTION_TRIPLE_BASES |
|---|
| 50 | }; |
|---|
| 51 | |
|---|
| 52 | struct Struct2Dplus3D { |
|---|
| 53 | char base; |
|---|
| 54 | char mask; |
|---|
| 55 | char code; |
|---|
| 56 | int pos; |
|---|
| 57 | int helixNr; |
|---|
| 58 | float x; |
|---|
| 59 | float y; |
|---|
| 60 | float z; |
|---|
| 61 | struct Struct2Dplus3D *next; |
|---|
| 62 | }; |
|---|
| 63 | |
|---|
| 64 | struct Struct2Dinfo { |
|---|
| 65 | char base; // Nucleotide |
|---|
| 66 | char mask; // Helix mask [..<<<..>>>] |
|---|
| 67 | char code; // Helix code (H)elix (N)on-helix (S)tart (E)nd |
|---|
| 68 | int pos; // Base Position |
|---|
| 69 | int helixNr; // Helix Number |
|---|
| 70 | struct Struct2Dinfo *next; |
|---|
| 71 | }; |
|---|
| 72 | |
|---|
| 73 | struct Struct3Dinfo { |
|---|
| 74 | float x; |
|---|
| 75 | float y; |
|---|
| 76 | float z; |
|---|
| 77 | char base; |
|---|
| 78 | int pos; |
|---|
| 79 | struct Struct3Dinfo *next; |
|---|
| 80 | }; |
|---|
| 81 | |
|---|
| 82 | struct HelixNrInfo { |
|---|
| 83 | float x, y, z; |
|---|
| 84 | int helixNr; |
|---|
| 85 | struct HelixNrInfo *next; |
|---|
| 86 | }; |
|---|
| 87 | |
|---|
| 88 | struct CurrSpecies { |
|---|
| 89 | float x; |
|---|
| 90 | float y; |
|---|
| 91 | float z; |
|---|
| 92 | int pos; |
|---|
| 93 | char base; |
|---|
| 94 | struct CurrSpecies *next; |
|---|
| 95 | }; |
|---|
| 96 | |
|---|
| 97 | struct Insertions { |
|---|
| 98 | int pos; |
|---|
| 99 | char base; |
|---|
| 100 | struct Insertions *next; |
|---|
| 101 | }; |
|---|
| 102 | |
|---|
| 103 | struct Vector3; |
|---|
| 104 | |
|---|
| 105 | class ED4_sequence_terminal; |
|---|
| 106 | class BI_ecoli_ref; |
|---|
| 107 | struct ED4_plugin_host; |
|---|
| 108 | |
|---|
| 109 | struct Structure3D : virtual Noncopyable { |
|---|
| 110 | Vector3 *strCen; |
|---|
| 111 | |
|---|
| 112 | int iInterval; |
|---|
| 113 | int iMapSAI; |
|---|
| 114 | int iMapSearch; |
|---|
| 115 | int iMapEnable; |
|---|
| 116 | int iStartPos, iEndPos; |
|---|
| 117 | int iEColiStartPos, iEColiEndPos; |
|---|
| 118 | int iTotalSubs, iTotalDels, iTotalIns; |
|---|
| 119 | int LSU_molID; |
|---|
| 120 | int HelixBase; // to create display lists storing helix information |
|---|
| 121 | |
|---|
| 122 | static GBDATA *gb_main; |
|---|
| 123 | BI_ecoli_ref *EColiRef; |
|---|
| 124 | ED4_plugin_host& Host; |
|---|
| 125 | |
|---|
| 126 | OpenGLGraphics *GRAPHICS; // not really a good place - it better should be passed from callers |
|---|
| 127 | |
|---|
| 128 | Structure3D(ED4_plugin_host& host_); |
|---|
| 129 | ~Structure3D(); |
|---|
| 130 | |
|---|
| 131 | void ReadCoOrdinateFile(); |
|---|
| 132 | void StoreCoordinates(float x, float y, float z, char base, unsigned int pos); |
|---|
| 133 | |
|---|
| 134 | void GetSecondaryStructureInfo(); |
|---|
| 135 | void Store2Dinfo(char *info, int pos, int helixNr); |
|---|
| 136 | |
|---|
| 137 | void Combine2Dand3DstructureInfo(); |
|---|
| 138 | void Store2D3Dinfo(Struct2Dinfo *s2D, Struct3Dinfo *s3D); |
|---|
| 139 | |
|---|
| 140 | static int FindTypeOfRNA(); |
|---|
| 141 | void DeleteOldMoleculeData(); |
|---|
| 142 | |
|---|
| 143 | void GenerateMoleculeSkeleton(); |
|---|
| 144 | void ComputeBasePositions(); |
|---|
| 145 | |
|---|
| 146 | void PositionsToCoordinatesDispList(int listID, int *pos, int len); |
|---|
| 147 | void PointsToQuads(float x, float y, float z); |
|---|
| 148 | void StoreHelixNrInfo(float x, float y, float z, int helixNr); |
|---|
| 149 | |
|---|
| 150 | void GenerateDisplayLists(); |
|---|
| 151 | void GenerateHelixDispLists(int HELIX_NR_ID, int HELIX_NR); |
|---|
| 152 | void GenerateHelixNrDispList(int startHx, int endHx); |
|---|
| 153 | void GenerateSecStructureHelixRegions(); |
|---|
| 154 | void GenerateSecStructureNonHelixRegions(); |
|---|
| 155 | void GenerateSecStructureUnpairedHelixRegions(); |
|---|
| 156 | |
|---|
| 157 | void GenerateTertiaryInteractionsDispLists(); |
|---|
| 158 | |
|---|
| 159 | void MapCurrentSpeciesToEcoliTemplate(AW_root *awr); |
|---|
| 160 | void StoreCurrSpeciesDifference(char base, int pos); |
|---|
| 161 | void DeleteOldSpeciesData(); |
|---|
| 162 | void BuildDisplayList(int listID, int *pos, int len); |
|---|
| 163 | void GenerateBaseDifferenceDisplayList(); |
|---|
| 164 | void GenerateBaseDifferencePositionDisplayList(); |
|---|
| 165 | void StoreInsertions(char base, int pos); |
|---|
| 166 | void DeleteOldInsertionData(); |
|---|
| 167 | void GenerateInsertionDisplayList(); |
|---|
| 168 | |
|---|
| 169 | void GenerateCursorPositionDispList(long pos); |
|---|
| 170 | |
|---|
| 171 | void MapSaiToEcoliTemplate(); |
|---|
| 172 | void MapSearchStringsToEcoliTemplate(AW_root *awr); |
|---|
| 173 | |
|---|
| 174 | int calc_helix_count() { |
|---|
| 175 | int NoOfHelices = 0; |
|---|
| 176 | switch (FindTypeOfRNA()) { |
|---|
| 177 | case LSU_23S: NoOfHelices = 101; break; |
|---|
| 178 | case SSU_16S: NoOfHelices = 50; break; |
|---|
| 179 | case LSU_5S: NoOfHelices = 5; break; |
|---|
| 180 | } |
|---|
| 181 | arb_assert(NoOfHelices); |
|---|
| 182 | return NoOfHelices; |
|---|
| 183 | } |
|---|
| 184 | }; |
|---|
| 185 | |
|---|
| 186 | #else |
|---|
| 187 | #error RNA3D_StructureData.hxx included twice |
|---|
| 188 | #endif |
|---|