Changeset 3303
- Timestamp:
- Aug 21, 2014, 5:55:50 AM (9 years ago)
- Location:
- branches/0.12-stable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.12-stable/configure.ac
r3293 r3303 383 383 # check if global variable bam_nt16_rev_table is available 384 384 YAT_BAM_NT16_REV_TABLE 385 # check if function bam_calend works. Result of this test can be 386 # overridden by setting variable 'yat_cv_func_bam_calend' 387 YAT_FUNC_BAM_CALEND([$srcdir/test/data/foo.sam]) 385 388 AC_PATH_PROG([SAMTOOLS], [samtools], [false]) 386 389 AC_ARG_VAR([SAMTOOLS], [Tools for alignment in the SAM format]) -
branches/0.12-stable/m4/yat_check_libbam.m4
r3130 r3303 1 1 ## $Id$ 2 2 # 3 # serial 4 (yat 0.11)3 # serial 5 (yat 0.12.1) 4 4 # 5 5 # 6 # Copyright (C) 2012, 2013 Peter Johansson6 # Copyright (C) 2012, 2013, 2014 Peter Johansson 7 7 # 8 8 # This file is part of the yat library, http://dev.thep.lu.se/yat … … 107 107 108 108 109 # YAT_FUNC_BAM_CALEND(SAM_FILE) 110 # =================== 111 # Check if there is a bam_calend that works 112 AC_DEFUN([YAT_FUNC_BAM_CALEND], 113 [ 114 AC_CACHE_CHECK([for working bam_calend], 115 [yat_cv_func_bam_calend], 116 [AC_RUN_IFELSE( 117 [AC_LANG_PROGRAM( 118 [_YAT_BAM_INCLUDES], 119 [ 120 samfile_t* samfile = samopen("$1", "r", NULL); 121 if (!samfile) 122 return 1; 123 bam1_t* read = bam_init1(); 124 while (samread(samfile, read) >= -1) { 125 bool have_match = false; 126 if (read->core.n_cigar < 1) 127 continue; 128 uint32_t end = bam_calend(&read->core, bam1_cigar(read)); 129 // replace BAM_CMATCH with BAM_CEQUAL in cigar 130 for (size_t k=0; k<read->core.n_cigar; ++k) { 131 uint32_t& element = bam1_cigar(read)@<:@k@:>@; 132 uint32_t op = element & BAM_CIGAR_MASK; 133 if (op == BAM_CMATCH) { 134 have_match = true; 135 uint32_t oplen = element >> BAM_CIGAR_SHIFT; 136 element = oplen<<BAM_CIGAR_SHIFT|BAM_CEQUAL; 137 } 138 } 139 // if no match element found, next read please 140 if (!have_match) 141 continue; 142 // bam_calend works on BAM_CEQUAL 143 if (bam_calend(&read->core, bam1_cigar(read)) == end) 144 return 0; 145 // bam_calend is not working as expected 146 return 2; 147 } 148 // end of data, fail 149 return 3; 150 ]) 151 ], 152 [yat_cv_func_bam_calend=yes], 153 [yat_cv_func_bam_calend=no], 154 [yat_cv_func_bam_calend="guessing no"]) 155 ]) 156 AS_IF([test x"$yat_cv_func_bam_calend" = x"yes"],[ 157 AC_DEFINE([HAVE_BAM_CALEND], [1], [Define to 1 if bam_calend is working]) 158 ]) 159 ]) 160 161 109 162 # _YAT_BAM_INCLUDES 110 163 # ================= … … 114 167 @%:@if YAT_HAVE_BAM_H 115 168 @%:@ include <bam.h> 169 @%:@ include <sam.h> 116 170 @%:@elif YAT_HAVE_BAM_BAM_H 117 171 @%:@ include <bam/bam.h> 172 @%:@ include <bam/sam.h> 118 173 @%:@elif YAT_HAVE_SAMTOOLS_BAM_H 119 174 @%:@ include <samtools/bam.h> 175 @%:@ include <samtools/sam.h> 120 176 @%:@endif 121 177 ]) # _YAT_BAM_HEADER
Note: See TracChangeset
for help on using the changeset viewer.