Changeset 3357
- Timestamp:
- Nov 23, 2014, 2:54:44 AM (8 years ago)
- Location:
- trunk/yat/omic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/omic/BamFile.cc
r3353 r3357 88 88 { 89 89 #if YAT_HAVE_HTSLIB 90 assert(0 && "FIXME"); 90 open_base(fn, "rb", NULL); 91 header_.header_ = sam_hdr_read(sf_); 91 92 #else 92 93 open_base(fn, "rb", NULL); … … 165 166 { 166 167 #if YAT_HAVE_HTSLIB 167 assert(0 && "FIXME"); 168 open_base(fn, "wb", NULL); 169 sam_hdr_write(sf_, h.header_); 168 170 #else 169 171 open_base(fn, "wb", h.header_); … … 183 185 } 184 186 #if YAT_HAVE_HTSLIB 185 assert(0 && "FIXME"); 187 if (compression) 188 mode.push_back('0'+compression); 189 else 190 mode = "wu"; 191 open_base(fn, mode, NULL); 192 sam_hdr_write(sf_, h.header_); 186 193 #else 187 194 mode.push_back('0'+compression); … … 194 201 { 195 202 #if YAT_HAVE_HTSLIB 196 if (bam_write1(sf_->fp.bgzf, read.bam_) ) {203 if (bam_write1(sf_->fp.bgzf, read.bam_)<=0) { 197 204 #else 198 205 if (samwrite(sf_, read.bam_)<=0) { -
trunk/yat/omic/BamFile.h
r3353 r3357 79 79 80 80 \see samopen 81 */ 82 #ifndef YAT_HAVE_HTSLIB 81 82 \note \a aux is ignored when compiling against htslib 83 */ 83 84 void open_base(const std::string& fn, const std::string& mode, 84 85 const void* aux); 85 #endif86 86 87 87 #ifndef YAT_HAVE_HTSLIB … … 308 308 { 309 309 #if YAT_HAVE_HTSLIB 310 // FIXME, check that sam_close returns 0 (for success) 311 sam_close(sf_); 310 if (sf_==NULL) 311 return; 312 if (sam_close(sf_)) 313 throw utility::IO_error("BamFile::close() failed"); 312 314 #else 313 315 samclose(sf_); … … 324 326 325 327 326 #ifndef YAT_HAVE_HTSLIB327 328 template<class Derived> 328 329 void BamFile<Derived>::open_base(const std::string& fn, … … 332 333 filename_ = fn; 333 334 YAT_ASSERT(!sf_); 335 #if YAT_HAVE_HTSLIB 336 YAT_ASSERT(aux==NULL); // aux is ignored in htslib mode 337 sf_ = sam_open(fn.c_str(), mode.c_str()); 338 #else 334 339 sf_ = samopen(fn.c_str(), mode.c_str(), aux); 340 #endif 335 341 if (!sf_) { 336 342 std::ostringstream ss; … … 339 345 } 340 346 } 341 #endif342 347 343 348 }}}
Note: See TracChangeset
for help on using the changeset viewer.