X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fapi%2Finternal%2FSamFormatPrinter_p.cpp;h=1e670b0155be479d88d9ed6d21b1c406600313af;hb=cdf4bbcb19025398d429035fe672661a8c8d1a80;hp=69c78df26399fbe2daa4fa96f1e4cc39806f7e96;hpb=9cf50963514decd5c272f52a0a019c6289d43c63;p=bamtools.git diff --git a/src/api/internal/SamFormatPrinter_p.cpp b/src/api/internal/SamFormatPrinter_p.cpp index 69c78df..1e670b0 100644 --- a/src/api/internal/SamFormatPrinter_p.cpp +++ b/src/api/internal/SamFormatPrinter_p.cpp @@ -3,7 +3,7 @@ // Marth Lab, Department of Biology, Boston College // All rights reserved. // --------------------------------------------------------------------------- -// Last modified: 21 March 2011 (DB) +// Last modified: 19 April 2011 (DB) // --------------------------------------------------------------------------- // Provides functionality for printing formatted SAM header to string // *************************************************************************** @@ -88,14 +88,14 @@ void SamFormatPrinter::PrintSQ(std::stringstream& out) const { if ( seq.HasChecksum() ) out << FormatTag(Constants::SAM_SQ_CHECKSUM_TAG, seq.Checksum); - // UR: - if ( seq.HasURI() ) - out << FormatTag(Constants::SAM_SQ_URI_TAG, seq.URI); - // SP: if ( seq.HasSpecies() ) out << FormatTag(Constants::SAM_SQ_SPECIES_TAG, seq.Species); + // UR: + if ( seq.HasURI() ) + out << FormatTag(Constants::SAM_SQ_URI_TAG, seq.URI); + // newline out << endl; } @@ -109,39 +109,54 @@ void SamFormatPrinter::PrintRG(std::stringstream& out) const { for ( ; rgIter != rgEnd; ++rgIter ) { const SamReadGroup& rg = (*rgIter); - // @RG ID: SM: + // @RG ID: out << Constants::SAM_RG_BEGIN_TOKEN - << FormatTag(Constants::SAM_RG_ID_TAG, rg.ID) - << FormatTag(Constants::SAM_RG_SAMPLE_TAG, rg.Sample); + << FormatTag(Constants::SAM_RG_ID_TAG, rg.ID); - // LB: - if ( rg.HasLibrary() ) - out << FormatTag(Constants::SAM_RG_LIBRARY_TAG, rg.Library); + // CN: + if ( rg.HasSequencingCenter() ) + out << FormatTag(Constants::SAM_RG_SEQCENTER_TAG, rg.SequencingCenter); // DS: if ( rg.HasDescription() ) out << FormatTag(Constants::SAM_RG_DESCRIPTION_TAG, rg.Description); - // PU: - if ( rg.HasPlatformUnit() ) - out << FormatTag(Constants::SAM_RG_PLATFORMUNIT_TAG, rg.PlatformUnit); + // DT: + if ( rg.HasProductionDate() ) + out << FormatTag(Constants::SAM_RG_PRODUCTIONDATE_TAG, rg.ProductionDate); + + // FO: + if ( rg.HasFlowOrder() ) + out << FormatTag(Constants::SAM_RG_FLOWORDER_TAG, rg.FlowOrder); + + // KS: + if ( rg.HasKeySequence() ) + out << FormatTag(Constants::SAM_RG_KEYSEQUENCE_TAG, rg.KeySequence); + + // LB: + if ( rg.HasLibrary() ) + out << FormatTag(Constants::SAM_RG_LIBRARY_TAG, rg.Library); + + // PG: + if ( rg.HasProgram() ) + out << FormatTag(Constants::SAM_RG_PROGRAM_TAG, rg.Program); // PI: if ( rg.HasPredictedInsertSize() ) out << FormatTag(Constants::SAM_RG_PREDICTEDINSERTSIZE_TAG, rg.PredictedInsertSize); - // CN: - if ( rg.HasSequencingCenter() ) - out << FormatTag(Constants::SAM_RG_SEQCENTER_TAG, rg.SequencingCenter); - - // DT: - if ( rg.HasProductionDate() ) - out << FormatTag(Constants::SAM_RG_PRODUCTIONDATE_TAG, rg.ProductionDate); - // PL: if ( rg.HasSequencingTechnology() ) out << FormatTag(Constants::SAM_RG_SEQTECHNOLOGY_TAG, rg.SequencingTechnology); + // PU: + if ( rg.HasPlatformUnit() ) + out << FormatTag(Constants::SAM_RG_PLATFORMUNIT_TAG, rg.PlatformUnit); + + // SM: + if ( rg.HasSample() ) + out << FormatTag(Constants::SAM_RG_SAMPLE_TAG, rg.Sample); + // newline out << endl; } @@ -149,20 +164,31 @@ void SamFormatPrinter::PrintRG(std::stringstream& out) const { void SamFormatPrinter::PrintPG(std::stringstream& out) const { - // if header has @PG data - if ( m_header.HasProgramName() ) { + // iterate over program record entries + SamProgramConstIterator pgIter = m_header.Programs.ConstBegin(); + SamProgramConstIterator pgEnd = m_header.Programs.ConstEnd(); + for ( ; pgIter != pgEnd; ++pgIter ) { + const SamProgram& pg = (*pgIter); - // @PG ID: + // @PG ID: out << Constants::SAM_PG_BEGIN_TOKEN - << FormatTag(Constants::SAM_PG_NAME_TAG, m_header.ProgramName); + << FormatTag(Constants::SAM_PG_ID_TAG, pg.ID); + + // PN: + if ( pg.HasName() ) + out << FormatTag(Constants::SAM_PG_NAME_TAG, pg.Name); + + // CL: + if ( pg.HasCommandLine() ) + out << FormatTag(Constants::SAM_PG_COMMANDLINE_TAG, pg.CommandLine); - // VN: - if ( m_header.HasProgramVersion() ) - out << FormatTag(Constants::SAM_PG_VERSION_TAG, m_header.ProgramVersion); + // PP: + if ( pg.HasPreviousProgramID() ) + out << FormatTag(Constants::SAM_PG_PREVIOUSPROGRAM_TAG, pg.PreviousProgramID); - // CL: - if ( m_header.HasProgramCommandLine() ) - out << FormatTag(Constants::SAM_PG_COMMANDLINE_TAG, m_header.ProgramCommandLine); + // VN: + if ( pg.HasVersion() ) + out << FormatTag(Constants::SAM_PG_VERSION_TAG, pg.Version); // newline out << endl;