No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

98 líneas
2.5 KiB

  1. #ifndef HTSLIB_UTIL_H
  2. #define HTSLIB_UTIL_H
  3. #include "htslib/sam.h"
  4. #include "htslib/vcf.h"
  5. #include "htslib/khash.h"
  6. int hts_set_verbosity(int verbosity);
  7. int hts_get_verbosity(void);
  8. KHASH_MAP_INIT_STR(vdict, bcf_idinfo_t)
  9. typedef khash_t(vdict) vdict_t;
  10. KHASH_DECLARE(s2i, kh_cstr_t, int64_t)
  11. typedef khash_t(s2i) s2i_t;
  12. //////////////////////////////////////////////////////////////////
  13. //////////////////////////////////////////////////////////////////
  14. //////////////////////////////////////////////////////////////////
  15. // various helper functions
  16. //
  17. /*!
  18. @abstract Update the variable length data within a bam1_t entry
  19. Old data is deleted and the data within b are re-arranged to
  20. make place for new data.
  21. @discussion Return NULL on error, otherwise b is returned.
  22. @param b bam1_t data
  23. @param nbytes_old size of old data
  24. @param nbytes_new size of new data
  25. @param pos position of data
  26. */
  27. bam1_t * pysam_bam_update(bam1_t * b,
  28. const size_t nbytes_old,
  29. const size_t nbytes_new,
  30. uint8_t * pos);
  31. // translate a nucleotide character to binary code
  32. unsigned char pysam_translate_sequence(const unsigned char s);
  33. // return byte size of type
  34. int aux_type2size(uint8_t type);
  35. //-------------------------------------------------------
  36. // Wrapping accessor macros in sam.h
  37. static inline int pysam_bam_is_rev(bam1_t * b) {
  38. return bam_is_rev(b);};
  39. static inline int pysam_bam_is_mrev(bam1_t * b) {
  40. return bam_is_mrev(b);}
  41. static inline char * pysam_bam_get_qname(bam1_t * b) {
  42. return bam_get_qname(b);}
  43. static inline uint32_t * pysam_bam_get_cigar(bam1_t * b) {
  44. return bam_get_cigar(b);}
  45. static inline uint8_t * pysam_bam_get_seq(bam1_t * b) {
  46. return bam_get_seq(b);}
  47. static inline uint8_t * pysam_bam_get_qual(bam1_t * b) {
  48. return bam_get_qual(b);}
  49. static inline uint8_t * pysam_bam_get_aux(bam1_t * b) {
  50. return bam_get_aux(b);}
  51. static inline int pysam_bam_get_l_aux(bam1_t * b) {
  52. return bam_get_l_aux(b); }
  53. static inline char pysam_bam_seqi(uint8_t * s, int i) {
  54. return bam_seqi(s,i);}
  55. static inline uint8_t pysam_get_qual(bam1_t * b) {
  56. return b->core.qual;}
  57. static inline uint32_t pysam_get_n_cigar(bam1_t * b) {
  58. return b->core.n_cigar;}
  59. static inline void pysam_set_qual(bam1_t * b, uint8_t v) {
  60. b->core.qual=v;}
  61. static inline void pysam_set_n_cigar(bam1_t * b, uint32_t v) {
  62. b->core.n_cigar=v;}
  63. static inline void pysam_update_flag(bam1_t * b, uint16_t v, uint16_t flag) {
  64. if (v)
  65. b->core.flag |= flag;
  66. else
  67. b->core.flag &= ~flag;
  68. }
  69. #endif