1 /*
2     Copyright (C) 2016 Genome Research Ltd.
3 
4     Author: Petr Danecek <pd3@sanger.ac.uk>
5 
6     Permission is hereby granted, free of charge, to any person obtaining a copy
7     of this software and associated documentation files (the "Software"), to deal
8     in the Software without restriction, including without limitation the rights
9     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10     copies of the Software, and to permit persons to whom the Software is
11     furnished to do so, subject to the following conditions:
12 
13     The above copyright notice and this permission notice shall be included in
14     all copies or substantial portions of the Software.
15 
16     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22     THE SOFTWARE.
23 */
24 /*
25     Parse --samples and --samples-file
26 */
27 
28 #ifndef __SMPL_ILIST_H__
29 #define __SMPL_ILIST_H__
30 
31 #include <htslib/vcf.h>
32 
33 #define SMPL_NONE     0   // flexible error recovery
34 #define SMPL_STRICT   1   // samples must exist
35 #define SMPL_SINGLE   2   // single sample expected
36 #define SMPL_PAIR1    4   // two samples expected, the first is from the bcf hdr
37 #define SMPL_PAIR2    8   // two samples expected, the second is from the bcf hdr
38 #define SMPL_VERBOSE 16   // print warnings
39 
40 typedef struct
41 {
42     char **pair;    // the other sample in the pair
43     int *idx;       // index to bcf_hdr_t.samples; the first (SMPL_SINGLE|SMPL_PAIR1) or second sample (SMPL_PAIR2)
44     int n;
45 }
46 smpl_ilist_t;
47 
48 smpl_ilist_t *smpl_ilist_init(bcf_hdr_t *hdr, char *sample_list, int is_file, int flags);
49 smpl_ilist_t *smpl_ilist_map(bcf_hdr_t *hdr_a, bcf_hdr_t *hdr_b, int flags);
50 void smpl_ilist_destroy(smpl_ilist_t *smpl);
51 
52 #endif
53