// // Copyright 2009 Illumina, Inc. // // This software is covered by the "Illumina Genome Analyzer Software // License Agreement" and the "Illumina Source Code License Agreement", // and certain third party copyright/licenses, and any user of this // source file is bound by the terms therein (see accompanying files // Illumina_Genome_Analyzer_Software_License_Agreement.pdf and // Illumina_Source_Code_License_Agreement.pdf and third party // copyright/license notices). // // /// \file /// \author Ivan Mikoulitch /// #ifndef __SAMREADER_H #define __SAMREADER_H #include "SamMD2Export/stdafx.h" #include "export.h" class SamReader { public: SamReader(const string& fileName); ~SamReader(void); bool Open(); void Close(); bool GetNextSamLine(); bool WriteExportLine(const Export& ex); void WriteInfo(const string& str); void WriteWarning(const string& str); void WriteError(const string& str); bool WriteWarningErrorSummary(); void WriteFailedRead(const string& message, const string& read); char* BUFFER; private: string sam_file_name_; string export_file_name_; string export_log_file_name_; ifstream sam_ifs_; ofstream export_ofs_; ofstream export_log_; static const int BUFFER_SIZE = 1024; bool has_data_; static const int MAX_EXPORT_LINE_COUNT=100000; int export_line_count; string export_buffer; int num_invalid_reads_; void ReadHeader(); void Flush(); }; #endif