1 /* @include ensslice ********************************************************** 2 ** 3 ** Ensembl Slice functions 4 ** 5 ** @author Copyright (C) 1999 Ensembl Developers 6 ** @author Copyright (C) 2006 Michael K. Schuster 7 ** @version $Revision: 1.28 $ 8 ** @modified 2009 by Alan Bleasby for incorporation into EMBOSS core 9 ** @modified $Date: 2012/02/20 22:15:10 $ by $Author: mks $ 10 ** @@ 11 ** 12 ** This library is free software; you can redistribute it and/or 13 ** modify it under the terms of the GNU Lesser General Public 14 ** License as published by the Free Software Foundation; either 15 ** version 2.1 of the License, or (at your option) any later version. 16 ** 17 ** This library is distributed in the hope that it will be useful, 18 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 19 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 ** Lesser General Public License for more details. 21 ** 22 ** You should have received a copy of the GNU Lesser General Public 23 ** License along with this library; if not, write to the Free Software 24 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 25 ** MA 02110-1301, USA. 26 ** 27 ******************************************************************************/ 28 29 #ifndef ENSSLICE_H 30 #define ENSSLICE_H 31 32 /* ========================================================================= */ 33 /* ============================= include files ============================= */ 34 /* ========================================================================= */ 35 36 #include "ensseqregion.h" 37 38 AJ_BEGIN_DECLS 39 40 41 42 43 /* ========================================================================= */ 44 /* =============================== constants =============================== */ 45 /* ========================================================================= */ 46 47 /* @enum EnsERepeatMaskType *************************************************** 48 ** 49 ** Ensembl Repeat Mask Type enumeration 50 ** 51 ** @value ensERepeatMaskTypeNULL Null 52 ** @value ensERepeatMaskTypeNone None 53 ** @value ensERepeatMaskTypeSoft Soft-masking 54 ** @value ensERepeatMaskTypeHard Hard-masking 55 ** @@ 56 ******************************************************************************/ 57 58 typedef enum EnsORepeatMaskType 59 { 60 ensERepeatMaskTypeNULL, 61 ensERepeatMaskTypeNone, 62 ensERepeatMaskTypeSoft, 63 ensERepeatMaskTypeHard 64 } EnsERepeatMaskType; 65 66 67 68 69 /* ========================================================================= */ 70 /* ============================== public data ============================== */ 71 /* ========================================================================= */ 72 73 /* @data EnsPRepeatmaskedslice ************************************************ 74 ** 75 ** Ensembl Repeat-Masked Slice. 76 ** 77 ** Holds information about a masked genome sequence slice. 78 ** 79 ** @alias EnsSRepeatmaskedslice 80 ** @alias EnsORepeatmaskedslice 81 ** 82 ** @attr Slice [EnsPSlice] Ensembl Slice. 83 ** @attr Analysisnames [AjPList] AJAX List of AJAX String objects 84 ** (Ensembl Analysis names) 85 ** @attr Masking [AjPTable] AJAX Table of Repeat Consensus types, classes or 86 ** names and sequence masking types 87 ** @attr Use [ajuint] Use counter 88 ** @attr Padding [ajuint] Padding to alignment boundary 89 ** @@ 90 ******************************************************************************/ 91 92 typedef struct EnsSRepeatmaskedslice 93 { 94 EnsPSlice Slice; 95 AjPList Analysisnames; 96 AjPTable Masking; 97 ajuint Use; 98 ajuint Padding; 99 } EnsORepeatmaskedslice; 100 101 #define EnsPRepeatmaskedslice EnsORepeatmaskedslice* 102 103 104 105 106 /* ========================================================================= */ 107 /* =========================== public functions ============================ */ 108 /* ========================================================================= */ 109 110 /* 111 ** Prototype definitions 112 */ 113 114 /* Ensembl Slice */ 115 116 EnsPSlice ensSliceNewCpy(const EnsPSlice slice); 117 118 EnsPSlice ensSliceNewIni(EnsPSliceadaptor sla, 119 EnsPSeqregion sr, 120 ajint start, 121 ajint end, 122 ajint strand); 123 124 EnsPSlice ensSliceNewRef(EnsPSlice slice); 125 126 EnsPSlice ensSliceNewSeq(EnsPSliceadaptor sla, 127 EnsPSeqregion sr, 128 ajint start, 129 ajint end, 130 ajint strand, 131 AjPStr sequence); 132 133 void ensSliceDel(EnsPSlice *Pslice); 134 135 EnsPSliceadaptor ensSliceGetAdaptor(const EnsPSlice slice); 136 137 ajint ensSliceGetEnd(const EnsPSlice slice); 138 139 EnsPSeqregion ensSliceGetSeqregion(const EnsPSlice slice); 140 141 const AjPStr ensSliceGetSequence(const EnsPSlice slice); 142 143 ajint ensSliceGetStart(const EnsPSlice slice); 144 145 ajint ensSliceGetStrand(const EnsPSlice slice); 146 147 EnsESliceTopology ensSliceLoadTopology(EnsPSlice slice); 148 149 AjBool ensSliceSetAdaptor(EnsPSlice slice, EnsPSliceadaptor sla); 150 151 AjBool ensSliceSetSequence(EnsPSlice slice, AjPStr sequence); 152 153 AjBool ensSliceSetTopology(EnsPSlice slice, EnsESliceTopology sltp); 154 155 AjBool ensSliceTrace(const EnsPSlice slice, ajuint level); 156 157 const AjPStr ensSliceGetCoordsystemName(const EnsPSlice slice); 158 159 EnsPCoordsystem ensSliceGetCoordsystemObject(const EnsPSlice slice); 160 161 const AjPStr ensSliceGetCoordsystemVersion(const EnsPSlice slice); 162 163 ajuint ensSliceGetSeqregionIdentifier(const EnsPSlice slice); 164 165 ajint ensSliceGetSeqregionLength(const EnsPSlice slice); 166 167 const AjPStr ensSliceGetSeqregionName(const EnsPSlice slice); 168 169 const AjPTrn ensSliceGetTranslation(EnsPSlice slice); 170 171 ajint ensSliceCalculateCentrepoint(EnsPSlice slice); 172 173 ajuint ensSliceCalculateLength(EnsPSlice slice); 174 175 size_t ensSliceCalculateMemsize(const EnsPSlice slice); 176 177 ajuint ensSliceCalculateRegion(EnsPSlice slice, ajint start, ajint end); 178 179 AjBool ensSliceFetchAllAttributes(EnsPSlice slice, 180 const AjPStr code, 181 AjPList attributes); 182 183 AjBool ensSliceFetchAllRepeatfeatures(EnsPSlice slice, 184 const AjPStr anname, 185 const AjPStr rctype, 186 const AjPStr rcclass, 187 const AjPStr rcname, 188 AjPList rfs); 189 190 AjBool ensSliceFetchAllSequenceedits(EnsPSlice slice, 191 AjPList ses); 192 193 AjBool ensSliceFetchName(const EnsPSlice slice, AjPStr *Pname); 194 195 AjBool ensSliceFetchSequenceAllSeq(EnsPSlice slice, AjPSeq *Psequence); 196 197 AjBool ensSliceFetchSequenceAllStr(EnsPSlice slice, AjPStr *Psequence); 198 199 AjBool ensSliceFetchSequenceSubSeq(EnsPSlice slice, 200 ajint start, 201 ajint end, 202 ajint strand, 203 AjPSeq *Psequence); 204 205 AjBool ensSliceFetchSequenceSubStr(EnsPSlice slice, 206 ajint start, 207 ajint end, 208 ajint strand, 209 AjPStr *Psequence); 210 211 AjBool ensSliceFetchSliceinverted(EnsPSlice slice, 212 EnsPSlice *Pslice); 213 214 AjBool ensSliceFetchSlicesub(EnsPSlice slice, 215 ajint start, 216 ajint end, 217 ajint strand, 218 EnsPSlice *Pslice); 219 220 AjBool ensSliceFetchSliceexpanded(EnsPSlice slice, 221 ajint five, 222 ajint three, 223 AjBool force, 224 ajint *Pfshift, 225 ajint *Ptshift, 226 EnsPSlice *Pslice); 227 228 int ensSliceCompareIdentifierAscending(const EnsPSlice slice1, 229 const EnsPSlice slice2); 230 231 AjBool ensSliceMatch(const EnsPSlice slice1, const EnsPSlice slice2); 232 233 AjBool ensSliceSimilarity(const EnsPSlice slice1, const EnsPSlice slice2); 234 235 AjBool ensSliceIsCircular(EnsPSlice slice, AjBool *Presult); 236 237 AjBool ensSliceIsNonreference(EnsPSlice slice, AjBool *Presult); 238 239 AjBool ensSliceIsToplevel(EnsPSlice slice, AjBool *Presult); 240 241 AjBool ensSliceProject(EnsPSlice slice, 242 const AjPStr csname, 243 const AjPStr csversion, 244 AjPList pss); 245 246 AjBool ensSliceProjectslice(EnsPSlice srcslice, 247 EnsPSlice trgslice, 248 AjPList pss); 249 250 EnsESliceType ensSliceTypeFromSeqregion(EnsPSeqregion sr); 251 252 EnsESliceType ensSliceTypeFromStr(const AjPStr type); 253 254 const char *ensSliceTypeToChar(EnsESliceType ste); 255 256 AjBool ensListSliceRemoveDuplications(AjPList slices); 257 258 AjBool ensListSliceSortIdentifierAscending(AjPList slices); 259 260 AjBool ensListSliceSortIdentifierDescending(AjPList slices); 261 262 AjBool ensListSliceSortNameAscending(AjPList slices); 263 264 AjBool ensListSliceSortNameDescending(AjPList slices); 265 266 /* Ensembl Slice Adaptor */ 267 268 EnsPSliceadaptor ensRegistryGetSliceadaptor( 269 EnsPDatabaseadaptor dba); 270 271 EnsPSliceadaptor ensSliceadaptorNew( 272 EnsPDatabaseadaptor dba); 273 274 void ensSliceadaptorDel(EnsPSliceadaptor *Psla); 275 276 EnsPDatabaseadaptor ensSliceadaptorGetDatabaseadaptor( 277 EnsPSliceadaptor sla); 278 279 AjBool ensSliceadaptorCacheInsert(EnsPSliceadaptor sla, EnsPSlice *Pslice); 280 281 AjBool ensSliceadaptorFetchAll(EnsPSliceadaptor sla, 282 const AjPStr csname, 283 const AjPStr csversion, 284 AjBool nonreference, 285 AjBool duplicates, 286 AjBool lrg, 287 AjPList slices); 288 289 AjBool ensSliceadaptorFetchAllbyRegionunique(EnsPSliceadaptor sla, 290 const AjPStr csname, 291 const AjPStr csversion, 292 const AjPStr srname, 293 ajint srstart, 294 ajint srend, 295 ajint srstrand, 296 AjPList slices); 297 298 AjBool ensSliceadaptorFetchByFeature(EnsPSliceadaptor sla, 299 const EnsPFeature feature, 300 ajint flank, 301 EnsPSlice *Pslice); 302 303 AjBool ensSliceadaptorFetchByLocation(EnsPSliceadaptor sla, 304 const AjPStr location, 305 EnsPSlice *Pslice); 306 307 AjBool ensSliceadaptorFetchByMapperresult(EnsPSliceadaptor sla, 308 const EnsPMapperresult mr, 309 EnsPSlice *Pslice); 310 311 AjBool ensSliceadaptorFetchByName(EnsPSliceadaptor sla, 312 const AjPStr name, 313 EnsPSlice *Pslice); 314 315 AjBool ensSliceadaptorFetchByRegion(EnsPSliceadaptor sla, 316 const AjPStr csname, 317 const AjPStr csversion, 318 const AjPStr srname, 319 ajint srstart, 320 ajint srend, 321 ajint srstrand, 322 EnsPSlice *Pslice); 323 324 AjBool ensSliceadaptorFetchBySeqregionIdentifier(EnsPSliceadaptor sla, 325 ajuint srid, 326 ajint srstart, 327 ajint srend, 328 ajint srstrand, 329 EnsPSlice *Pslice); 330 331 AjBool ensSliceadaptorFetchBySeqregionName(EnsPSliceadaptor sla, 332 const AjPStr csname, 333 const AjPStr csversion, 334 const AjPStr srname, 335 EnsPSlice *Pslice); 336 337 AjBool ensSliceadaptorFetchBySlice(EnsPSliceadaptor sla, 338 EnsPSlice slice, 339 ajint start, 340 ajint end, 341 ajint strand, 342 EnsPSlice *Pslice); 343 344 AjBool ensSliceadaptorRetrieveNormalisedprojection(EnsPSliceadaptor sla, 345 EnsPSlice slice, 346 AjPList pss); 347 348 /* Ensembl Repeat-Masked Slice */ 349 350 EnsPRepeatmaskedslice ensRepeatmaskedsliceNewCpy( 351 const EnsPRepeatmaskedslice rmslice); 352 353 EnsPRepeatmaskedslice ensRepeatmaskedsliceNewIni(EnsPSlice slice, 354 AjPList annames, 355 AjPTable masking); 356 357 EnsPRepeatmaskedslice ensRepeatmaskedsliceNewRef( 358 EnsPRepeatmaskedslice rmslice); 359 360 void ensRepeatmaskedsliceDel(EnsPRepeatmaskedslice *Prmslice); 361 362 AjBool ensRepeatmaskedsliceTrace(const EnsPRepeatmaskedslice rmslice, 363 ajuint level); 364 365 AjBool ensRepeatmaskedsliceFetchSequenceSeq(EnsPRepeatmaskedslice rmslice, 366 EnsERepeatMaskType mtype, 367 AjPSeq *Psequence); 368 369 AjBool ensRepeatmaskedsliceFetchSequenceStr(EnsPRepeatmaskedslice rmslice, 370 EnsERepeatMaskType mtype, 371 AjPStr *Psequence); 372 373 /* 374 ** End of prototype definitions 375 */ 376 377 378 379 380 AJ_END_DECLS 381 382 #endif /* !ENSSLICE_H */ 383