Ignore:
Timestamp:
Jan 13, 2014, 8:08:30 AM (8 years ago)
Author:
Peter
Message:

closes #775

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/omic/BamFile.cc

    r3080 r3160  
    22
    33/*
    4   Copyright (C) 2012, 2013 Peter Johansson
     4  Copyright (C) 2012, 2013, 2014 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    132132
    133133
     134  OutBamFile::OutBamFile(const std::string& fn, const BamHeader& header,
     135                         unsigned int c)
     136  {
     137    open(fn, header, c);
     138  }
     139
     140
    134141  void OutBamFile::open(const std::string& fn, const BamHeader& h)
    135142  {
    136143    open_base(fn, "wb", h.header_);
     144  }
     145
     146
     147  void OutBamFile::open(const std::string& fn, const BamHeader& h,
     148                        unsigned int compression)
     149  {
     150    std::string mode("wb");
     151    if (compression > 9) {
     152      std::stringstream oss;
     153      oss << "OutBamFile::open( " << fn << ", <header>, " << compression
     154          << "): incorrect compression level\n";
     155      throw std::invalid_argument(oss.str());
     156    }
     157    mode.push_back('0'+compression);
     158    open_base(fn, mode, h.header_);
    137159  }
    138160
Note: See TracChangeset for help on using the changeset viewer.