Changeset 3201


Ignore:
Timestamp:
May 3, 2014, 2:57:59 PM (7 years ago)
Author:
Peter
Message:

add #define YAT_HAVE_LIBBAM to API and replace HAVE_LIBBAM accordingly.

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r3198 r3201  
    369369  # try link against libbam
    370370  YAT_CHECK_LIBBAM([LIBS="$BAM_LIBS $LIBS"
    371                     AC_DEFINE([HAVE_LIBBAM], [1],
     371                    AC_DEFINE([YAT_HAVE_LIBBAM], [1],
    372372                              [Define to 1 if libbam is available])],
    373373    [AC_MSG_FAILURE([library 'libbam' was not found])])
  • trunk/test/Suite.cc

    r2919 r3201  
    4141namespace test {
    4242
    43   Suite::Suite(int argc, char* argv[])
     43  Suite::Suite(int argc, char* argv[], bool require_bam)
    4444    : known_issues_(0), ok_(true)
    4545  {
     46    if (require_bam) {
     47#ifndef YAT_HAVE_LIBBAM
     48      out() << "no libbam\n";
     49      return EXIT_SKIP;
     50#endif
     51#ifndef HAVE_SAMTOOLS
     52      out() << "no samtools\n";
     53      return EXIT_SKIP;
     54#endif
     55    }
    4656    std::string test_dir = "test/testSubDir/" + utility::basename(argv[0]);
    4757    utility::mkdir_p(test_dir);
  • trunk/test/Suite.h

    r3149 r3201  
    5656  {
    5757  public:
    58     Suite(int argc, char* argv[]);
     58    Suite(int argc, char* argv[], bool require_bam=false);
    5959
    6060    /**
     
    114114    */
    115115    std::ostream& out(void) const;
    116    
     116
    117117    /**
    118118       In verbose mode a final message is sent to std::cout.
  • trunk/test/bam.cc

    r3162 r3201  
    2020#include "Suite.h"
    2121
    22 #ifdef HAVE_LIBBAM
     22#ifdef YAT_HAVE_LIBBAM
    2323#include "yat/omic/BamFile.h"
    2424#include "yat/omic/BamRead.h"
     
    3434int main(int argc, char* argv[])
    3535{
    36   test::Suite suite(argc, argv);
    37 #ifndef HAVE_LIBBAM
    38   suite.out() << "no libbam\n";
    39   return EXIT_SKIP;
    40 #endif
    41 #ifndef HAVE_SAMTOOLS
    42   suite.out() << "no samtools\n";
    43   return EXIT_SKIP;
    44 #endif
    45 #ifdef HAVE_LIBBAM
     36  test::Suite suite(argc, argv, true);
     37#ifdef YAT_HAVE_LIBBAM
    4638  test1(suite);
    4739#endif
     
    4941}
    5042
    51 #ifdef HAVE_LIBBAM
     43#ifdef YAT_HAVE_LIBBAM
    5244using namespace omic;
    5345
  • trunk/test/bam_header.cc

    r2999 r3201  
    2020#include "Suite.h"
    2121
    22 #ifdef HAVE_LIBBAM
     22#ifdef YAT_HAVE_LIBBAM
    2323#include "yat/omic/BamFile.h"
    2424#include "yat/omic/BamHeader.h"
     
    3131int main(int argc, char* argv[])
    3232{
    33 #ifdef SKIP_BAM_TEST
    34   return EXIT_SKIP;
    35 #endif
    36   test::Suite suite(argc, argv);
     33  test::Suite suite(argc, argv, true);
    3734  try {
    3835    test1(suite);
     
    4845void test1(test::Suite& suite)
    4946{
    50 #ifdef HAVE_LIBBAM
     47#ifdef YAT_HAVE_LIBBAM
    5148  using namespace omic;
    5249  std::string file = "../../data/foo.sorted.bam";
  • trunk/test/bam_header2.cc

    r3144 r3201  
    2020#include "Suite.h"
    2121
    22 #ifdef HAVE_LIBBAM
     22#ifdef YAT_HAVE_LIBBAM
    2323#include "yat/omic/BamFile.h"
    2424#include "yat/omic/BamHeader.h"
     
    2727using namespace theplu::yat;
    2828
    29 #ifdef SKIP_BAM_TEST
     29#ifndef YAT_HAVE_LIBBAM
    3030void do_main(test::Suite& suite) {}
    3131#else
     
    3535int main(int argc, char* argv[])
    3636{
    37 #ifdef SKIP_BAM_TEST
    38   return EXIT_SKIP;
    39 #endif
    40   test::Suite suite(argc, argv);
     37  test::Suite suite(argc, argv, true);
    4138  try {
    4239    do_main(suite);
     
    5047}
    5148
    52 #ifdef HAVE_LIBBAM
     49#ifdef YAT_HAVE_LIBBAM
    5350void do_main(test::Suite& suite)
    5451{
  • trunk/test/bam_iterator.cc

    r3150 r3201  
    2020#include "Suite.h"
    2121
    22 #ifdef HAVE_LIBBAM
     22#ifdef YAT_HAVE_LIBBAM
    2323#include "yat/omic/BamFile.h"
    2424#include "yat/omic/BamRead.h"
     
    3838int main(int argc, char* argv[])
    3939{
    40   test::Suite suite(argc, argv);
    41 #ifndef HAVE_LIBBAM
    42   suite.out() << "no libbam\n";
    43   return EXIT_SKIP;
    44 #endif
    45 #ifndef HAVE_SAMTOOLS
    46   suite.out() << "no samtools\n";
    47   return EXIT_SKIP;
    48 #endif
     40  test::Suite suite(argc, argv, true);
    4941  try {
    5042    test1(suite);
     
    5749}
    5850
    59 #ifdef HAVE_LIBBAM
     51#ifdef YAT_HAVE_LIBBAM
    6052using namespace omic;
    6153
  • trunk/test/bam_pair_analyse.cc

    r3175 r3201  
    2222using namespace theplu::yat;
    2323
    24 #if HAVE_LIBBAM
     24#if YAT_HAVE_LIBBAM
    2525#include "yat/omic/algorithm.h"
    2626#include "yat/omic/BamRead.h"
     
    3232int main(int argc, char* argv[])
    3333{
    34   test::Suite suite(argc, argv);
    35 #ifndef HAVE_LIBBAM
    36   suite.out() << "no libbam\n";
    37   return EXIT_SKIP;
    38 #endif
    39 #ifndef HAVE_SAMTOOLS
    40   suite.out() << "no samtools available\n";
    41   return EXIT_SKIP;
    42 #endif
     34  test::Suite suite(argc, argv, true);
    4335
    44 #ifdef HAVE_LIBBAM
     36#ifdef YAT_HAVE_LIBBAM
    4537  test1(suite);
    4638#endif
     
    4941
    5042
    51 #ifdef HAVE_LIBBAM
     43#ifdef YAT_HAVE_LIBBAM
    5244using namespace omic;
    5345
  • trunk/test/bam_pair_iterator.cc

    r3197 r3201  
    2020#include "Suite.h"
    2121
    22 #ifdef HAVE_LIBBAM
     22#ifdef YAT_HAVE_LIBBAM
    2323#include "yat/omic/BamFile.h"
    2424#include "yat/omic/BamPairIterator.h"
     
    3939int main(int argc, char* argv[])
    4040{
    41   test::Suite suite(argc, argv);
    42 #ifndef HAVE_LIBBAM
    43   suite.out() << "no libbam\n";
    44   return EXIT_SKIP;
    45 #endif
    46 #ifndef HAVE_SAMTOOLS
    47   suite.out() << "no samtools\n";
    48   return EXIT_SKIP;
    49 #endif
     41  test::Suite suite(argc, argv, true);
    5042  try {
    5143    test1(suite);
     
    5850}
    5951
    60 #ifdef HAVE_LIBBAM
    6152using namespace omic;
    6253
    6354void test1(test::Suite& suite)
    6455{
     56#ifdef YAT_HAVE_LIBBAM
    6557  std::string file = "../../data/foo.sorted.bam";
    6658
     
    9385
    9486  // suite.test_input_iterator(piter);
     87#endif
    9588}
    96 #endif
  • trunk/test/bam_read_filter.cc

    r2994 r3201  
    2020#include "Suite.h"
    2121
    22 #ifdef HAVE_LIBBAM
     22#ifdef YAT_HAVE_LIBBAM
    2323#include "yat/omic/BamFile.h"
    2424#include "yat/omic/BamRead.h"
     
    4040int main(int argc, char* argv[])
    4141{
    42   test::Suite suite(argc, argv);
    43 #ifndef HAVE_LIBBAM
    44   suite.out() << "no libbam\n";
    45   return EXIT_SKIP;
    46 #endif
    47 #ifndef HAVE_SAMTOOLS
    48   suite.out() << "no samtools\n";
    49   return EXIT_SKIP;
    50 #endif
    51 #ifdef HAVE_LIBBAM
     42  test::Suite suite(argc, argv, true);
     43#ifdef YAT_HAVE_LIBBAM
    5244  test1(suite);
    5345#endif
     
    5547}
    5648
    57 #ifdef HAVE_LIBBAM
     49#ifdef YAT_HAVE_LIBBAM
    5850using namespace omic;
    5951
  • trunk/test/bam_region_iterator.cc

    r3056 r3201  
    2020#include "Suite.h"
    2121
    22 #ifdef HAVE_LIBBAM
     22#ifdef YAT_HAVE_LIBBAM
    2323#include "yat/omic/BamReadIterator.h"
    2424#include "yat/omic/BamWriteIterator.h"
     
    4343int main(int argc, char* argv[])
    4444{
    45   test::Suite suite(argc, argv);
    46 #ifndef HAVE_LIBBAM
    47   suite.out() << "no libbam\n";
    48   return EXIT_SKIP;
    49 #endif
    50 #ifndef HAVE_SAMTOOLS
    51   suite.out() << "no samtools\n";
    52   return EXIT_SKIP;
    53 #endif
     45  test::Suite suite(argc, argv, true);
    5446
    5547  try {
     
    6658void test1(test::Suite& suite)
    6759{
    68 #ifdef HAVE_LIBBAM
     60#ifdef YAT_HAVE_LIBBAM
    6961  using namespace omic;
    7062  std::string file = "../../data/foo.sorted.bam";
  • trunk/test/cigar.cc

    r3200 r3201  
    7878  }
    7979
    80   suite.add(cig.op(0)==0);
    81   suite.add(cig.opchr(0)=='M');
    82   suite.add(cig.oplen(0)==10);
     80  if (!suite.add(cig.op(0)==0))
     81    suite.err() << "error: cig.op(0): " << cig.op(0) << " expected 0\n";
     82  suite.out() << cig << "\n";
     83  if (!suite.add(cig.opchr(0)=='M'))
     84    suite.err() << "error: cig.opchr(0): " << cig.opchr(0) << " expected M\n";
     85  if (!suite.add(cig.oplen(0)==10))
     86    suite.err() << "error: cig.oplen(0): " << cig.oplen(0) << " expected 10\n";
    8387  cig.pop_front(2);
    84   suite.add(cig.oplen(0)==8);
     88  suite.out() << cig << "\n";
     89  if (!suite.add(cig.oplen(0)==8))
     90    suite.err() << "error: cig.oplen(0): " << cig.oplen(0) << " expected 8\n";
     91
    8592  cig.pop_front(9);
    86   suite.add(cig.oplen(0)==6);
     93  suite.out() << cig << "\n";
     94  if (!suite.add(cig.oplen(0)==6))
     95    suite.err() << "error: cig.oplen(1): " << cig.oplen(1) << " expected 6\n";
     96
    8797  cig.push_back(3);
     98  suite.out() << cig << "\n";
    8899  cig.pop_back(1);
    89   suite.add(cig.oplen(0)==6);
     100  suite.out() << cig << "\n";
     101
     102  if (!suite.add(cig.oplen(0)==6))
     103    suite.err() << "error: cig.oplen(1): " << cig.oplen(1) << " expected 6\n";
     104
    90105  cig[0];
    91106  suite.out() << "size: " << cig.size() << "\n";
  • trunk/yat/utility/Aligner.cc

    r3200 r3201  
    229229  {
    230230    if (cigar_.empty() || this->op(size()-1)!=op)
    231       cigar_.push_front(bam_cigar_gen(len, op));
     231      cigar_.push_back(bam_cigar_gen(len, op));
    232232    else
    233233      cigar_[size()-1] += (len<<BAM_CIGAR_SHIFT);
  • trunk/yat/utility/config_public.h.in

    r3198 r3201  
    3737#undef YAT_HAVE_SAMTOOLS_BAM_H
    3838
     39/// Define to 1 if libbam is available
     40#undef YAT_HAVE_LIBBAM
     41
    3942/// Define if compiler supports deprecated attribute, as in g++ 4.0
    4043#undef YAT_HAVE_GCC_DEPRECATED
Note: See TracChangeset for help on using the changeset viewer.