Changeset 2972 for branches/0.10-stable


Ignore:
Timestamp:
Jan 26, 2013, 7:53:56 AM (9 years ago)
Author:
Peter
Message:

refs #745. Implement a workaround when bam_nt16_rev_table is not
available in -lbam.

Location:
branches/0.10-stable
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/0.10-stable/configure.ac

    r2957 r2972  
    296296                              [Define to 1 if libbam is available])],
    297297    [YAT_MSG_ERROR([Library 'libbam' was not found])])
     298  # check if global variable bam_nt16_rev_table is available
     299  YAT_BAM_NT16_REV_TABLE
    298300  AC_PATH_PROG([SAMTOOLS], [samtools], [false])
    299301  AC_ARG_VAR([SAMTOOLS], [Tools for alignment in the SAM format])
  • branches/0.10-stable/m4/yat_check_libbam.m4

    r2928 r2972  
    11## $Id$
    22#
    3 # serial 1 (yat 0.10)
     3# serial 2 (yat 0.10.2)
    44#
    55#
    6 #   Copyright (C) 2012 Peter Johansson
     6#   Copyright (C) 2012, 2013 Peter Johansson
    77#
    88#   This file is part of the yat library, http://dev.thep.lu.se/yat
     
    7878LIBS=$save_LIBS
    7979]) # YAT_LINK_BAM_IFELSE
     80
     81# YAT_BAM_NT16_REV_TABLE
     82# ====================================================================
     83# Check if global variable bam_nt16_rev_table is available in
     84# -lbam. If found call AC_DEFINE(HAVE_BAM_NT16_REV_TABLE).
     85AC_DEFUN([YAT_BAM_NT16_REV_TABLE],
     86[
     87AC_MSG_CHECKING([for bam_nt16_rev_table])
     88AC_LINK_IFELSE([AC_LANG_PROGRAM(
     89                 [@%:@if HAVE_BAM_H
     90                  @%:@ include <bam.h>
     91                  @%:@elif HAVE_BAM_BAM_H
     92                  @%:@ include <bam/bam.h>
     93                  @%:@elif HAVE_SAMTOOLS_BAM_H
     94                  @%:@ include <samtools/bam.h>
     95                  @%:@endif
     96                 ],[
     97                  char c = bam_nt16_rev_table@<:@7@:>@;
     98                 ])
     99               ],[
     100                 AC_MSG_RESULT([yes])
     101                 AC_DEFINE([HAVE_BAM_NT16_REV_TABLE], [1],
     102                           [Define to 1 if libbam contains bam_nt16_rev_table])
     103               ],[
     104                 AC_MSG_RESULT([no])
     105               ])
     106]) # YAT_BAM_NT16_REV_TABLE
  • branches/0.10-stable/test/Makefile.am

    r2953 r2972  
    3939  test/averager3.test \
    4040  test/averager4.test \
     41  test/bam.test \
    4142  test/bam_pair_analyse test/bam_iterator test/bam_region_iterator \
    4243  test/bam_header \
  • branches/0.10-stable/yat/omic/BamRead.cc

    r2969 r2972  
    149149  std::string BamRead::sequence(void) const
    150150  {
    151     // FIXME bam_nt16_rev_table not available in old lbam
    152151    std::string result(sequence_length(), ' ');
     152#ifdef HAVE_BAM_NT16_REV_TABLE
    153153    for (size_t i=0; i<result.size(); ++i)
    154154      result[i] = bam_nt16_rev_table[sequence(i)];
     155#else
     156    std::string table = "=ACMGRSVTWYHKDBN";
     157    for (size_t i=0; i<result.size(); ++i)
     158      result[i] = table[sequence(i)];
     159#endif
    155160    return result;
    156161  }
Note: See TracChangeset for help on using the changeset viewer.