// ---------------------------------------------------------------------------- bool CVcfReader::x_ProcessMetaLineFilter( const string& line, CRef<CSeq_annot> pAnnot ) // ---------------------------------------------------------------------------- { const string prefix = "##FILTER=<"; const string postfix = ">"; if ( ! NStr::StartsWith( line, prefix ) || ! NStr::EndsWith( line, postfix ) ) { return false; } try { vector<string> fields; string key, id, description; string info = line.substr( prefix.length(), line.length() - prefix.length() - postfix.length() ); NStr::Tokenize( info, ",", fields ); NStr::SplitInTwo( fields[0], "=", key, id ); if ( key != "ID" ) { throw "Unexpected --- ##FILTER: bad ID key!"; } NStr::SplitInTwo( fields[1], "=", key, description ); if ( key != "Description" ) { throw "Unexpected --- ##FILTER: bad description key!"; } m_FilterSpecs[id] = CVcfFilterSpec( id, description ); } catch ( ... ) { return true; } return true; }
// ---------------------------------------------------------------------------- bool CVcfReader::xProcessMetaLineFilter( const string& line, CRef<CSeq_annot> pAnnot, IMessageListener* pEC) // ---------------------------------------------------------------------------- { const string prefix = "##FILTER=<"; const string postfix = ">"; if ( ! NStr::StartsWith( line, prefix ) || ! NStr::EndsWith( line, postfix ) ) { return false; } try { vector<string> fields; string key, id, description; string info = line.substr( prefix.length(), line.length() - prefix.length() - postfix.length() ); NStr::Tokenize( info, ",", fields ); NStr::SplitInTwo( fields[0], "=", key, id ); if ( key != "ID" ) { AutoPtr<CObjReaderLineException> pErr( CObjReaderLineException::Create( eDiag_Error, 0, "CVcfReader::xProcessMetaLineInfo: ##FILTER with bad or missing \"ID\".", ILineError::eProblem_BadFilterLine) ); pErr->Throw(); } NStr::SplitInTwo( fields[1], "=", key, description ); if ( key != "Description" ) { AutoPtr<CObjReaderLineException> pErr( CObjReaderLineException::Create( eDiag_Error, 0, "CVcfReader::xProcessMetaLineInfo: ##FILTER with bad or missing \"Description\".", ILineError::eProblem_BadFilterLine) ); pErr->Throw(); } m_FilterSpecs[id] = CVcfFilterSpec( id, description ); } catch (CObjReaderLineException& err) { ProcessError(err, pEC); } return true; }