| 1 | /* vcmp.h -- reference allele utility functions. |
| 2 | |
| 3 | Copyright (C) 2013-2015 Genome Research Ltd. |
| 4 | |
| 5 | Author: Petr Danecek <[email protected]> |
| 6 | |
| 7 | Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | of this software and associated documentation files (the "Software"), to deal |
| 9 | in the Software without restriction, including without limitation the rights |
| 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | copies of the Software, and to permit persons to whom the Software is |
| 12 | furnished to do so, subject to the following conditions: |
| 13 | |
| 14 | The above copyright notice and this permission notice shall be included in |
| 15 | all copies or substantial portions of the Software. |
| 16 | |
| 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 23 | THE SOFTWARE. */ |
| 24 | |
| 25 | #ifndef __VCMP_H__ |
| 26 | #define __VCMP_H__ |
| 27 | |
| 28 | typedef struct _vcmp_t vcmp_t; |
| 29 | |
| 30 | vcmp_t *vcmp_init(void); |
| 31 | void vcmp_destroy(vcmp_t *vcmp); |
| 32 | |
| 33 | /* |
| 34 | * vcmp_set_ref() - sets and compares reference alleles |
| 35 | * Returns 0 on success or -1 if alleles not compatible |
| 36 | */ |
| 37 | int vcmp_set_ref(vcmp_t *vcmp, char *ref1, char *ref2); |
| 38 | |
| 39 | /* |
| 40 | * vcmp_find_allele() |
| 41 | * @param als1: alternate alleles to ref1 above |
| 42 | * @param al2: alternate allele to ref2 above |
| 43 | * Returns -1 if not found or 0-based index to als1 of matching allele |
| 44 | */ |
| 45 | int vcmp_find_allele(vcmp_t *vcmp, char **als1, int nals1, char *al2); |
| 46 | |
| 47 | /* |
| 48 | * vcmp_map_ARvalues() - Create mapping for Number=A,R tag values |
| 49 | * @param number: nals2 for Number=R, nals2-1 for Number=A |
| 50 | * @param nals1: number of alleles |
| 51 | * @param als1: alleles |
| 52 | * |
| 53 | * Returns pointer to an array of size nals2 with mapping from als2 |
| 54 | * to als1 or NULL if REFs (als1[0] and als2[0]) are not compatible. |
| 55 | * If i is the index of an allele in als2, ret[i] is the index of matching |
| 56 | * allele in als1 or -1 if als2 does not have a matching allele. |
| 57 | * The caller must not free the array. |
| 58 | */ |
| 59 | int *vcmp_map_ARvalues(vcmp_t *vcmp, int number, int nals1, char **als1, int nals2, char **als2); |
| 60 | |
| 61 | int *vcmp_map_dipGvalues(vcmp_t *vcmp, int *nmap); |
| 62 | |
| 63 | #endif |