| 1 | /* str_finder.c -- Short Tandem Repeat finder. |
| 2 | Originally from Crumble (https://github.com/jkbonfield/crumble) |
| 3 | |
| 4 | Copyright (C) 2015-2016, 2021, 2023 Genome Research Ltd. |
| 5 | |
| 6 | Author: James Bonfield <[email protected]> |
| 7 | |
| 8 | Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 | of this software and associated documentation files (the "Software"), to deal |
| 10 | in the Software without restriction, including without limitation the rights |
| 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 | copies of the Software, and to permit persons to whom the Software is |
| 13 | furnished to do so, subject to the following conditions: |
| 14 | |
| 15 | The above copyright notice and this permission notice shall be included in |
| 16 | all copies or substantial portions of the Software. |
| 17 | |
| 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 21 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 24 | DEALINGS IN THE SOFTWARE. */ |
| 25 | |
| 26 | #ifndef _STR_FINDER_H_ |
| 27 | #define _STR_FINDER_H_ |
| 28 | |
| 29 | #include "utlist.h" |
| 30 | |
| 31 | typedef struct rep_ele { |
| 32 | int start, end, rep_len; |
| 33 | struct rep_ele *prev; |
| 34 | struct rep_ele *next; |
| 35 | } rep_ele; |
| 36 | |
| 37 | /* |
| 38 | * Finds repeated homopolymers up to 8-mers. |
| 39 | * |
| 40 | * If lower_only is true then it only adds STRs for regions that |
| 41 | * contain at least one lower-case base. This can be used as a marker |
| 42 | * for looking for specific types of repeats. |
| 43 | * (One use for this is to only mark STRs that overlap a heterozygous |
| 44 | * indel region.) |
| 45 | * |
| 46 | * Returns a list of rep_ele structs holding the start,end tuples of repeats; |
| 47 | * NULL on failure. |
| 48 | */ |
| 49 | rep_ele *find_STR(char *cons, int len, int lower_only); |
| 50 | |
| 51 | /* As above, but use a longer hash with longer STR elements found */ |
| 52 | rep_ele *find_STR64(char *cons, int len, int lower_only); |
| 53 | |
| 54 | /* |
| 55 | * Returns an array of STR vs no-STR values. |
| 56 | * 0 => non repetitive. |
| 57 | * 1+ => repeat with consecutive bit-number for repeat size. |
| 58 | * |
| 59 | * Eg: AGGGGAGGAGAAGAC |
| 60 | * 1111 1111 |
| 61 | * 2222222 |
| 62 | * 444444 |
| 63 | * => 011331137754440 |
| 64 | */ |
| 65 | char *cons_mark_STR(char *cons, int len, int lower_only); |
| 66 | |
| 67 | #endif /* _STR_FINDER_H_ */ |