選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

79 行
2.5 KiB

  1. /* The MIT License
  2. Copyright (c) 2021 Genome Research Ltd.
  3. Author: Petr Danecek <pd3@sanger.ac.uk>
  4. Permission is hereby granted, free of charge, to any person obtaining a copy
  5. of this software and associated documentation files (the "Software"), to deal
  6. in the Software without restriction, including without limitation the rights
  7. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. copies of the Software, and to permit persons to whom the Software is
  9. furnished to do so, subject to the following conditions:
  10. The above copyright notice and this permission notice shall be included in
  11. all copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18. THE SOFTWARE.
  19. */
  20. /*
  21. Atomize/deatomize complex variants
  22. */
  23. #ifndef __ABUF_H__
  24. #define __ABUF_H__
  25. #include <htslib/vcf.h>
  26. typedef struct _abuf_t abuf_t;
  27. // Modes of operation
  28. typedef enum
  29. {
  30. NONE,
  31. // mode of operation, to be passed to abuf_init
  32. SPLIT,
  33. JOIN,
  34. BCF_HDR, // should the records be annotated, a writable bcf header is required
  35. INFO_TAG, // set BCF_HDR first
  36. STAR_ALLELE // 1: use STAR allele (the default), 0: set overlaps to missing
  37. }
  38. abuf_opt_t;
  39. #define abuf_set_opt(buf,type,key,value) { type tmp = value; abuf_set(buf, key, (void*)&tmp); }
  40. void abuf_set(abuf_t *buf, abuf_opt_t key, void *value);
  41. /*
  42. * abuf_init() - init buffer
  43. * @win: number of sites (>0) or bp (<0)
  44. */
  45. abuf_t *abuf_init(const bcf_hdr_t *hdr, abuf_opt_t mode);
  46. void abuf_destroy(abuf_t *buf);
  47. /*
  48. * abuf_push() - Push a new site for analysis
  49. */
  50. void abuf_push(abuf_t *buf, bcf1_t *rec);
  51. /*
  52. * abuf_flush() - Return next buffered record
  53. * @flush_all: Set to 1 if no more overlapping records are coming (e.g. end of chromosome or end of file),
  54. * the buffer can be emptied.
  55. * return: The next atomized/deatomized VCF record or NULL if no record is ready. The returned
  56. * structure will be cleaned by abuf.
  57. */
  58. bcf1_t *abuf_flush(abuf_t *buf, int flush_all);
  59. #endif