NCBI C++ ToolKit
|
Search Toolkit Book for CVcfReader
#include <objtools/readers/vcf_reader.hpp>
Public Types | |
enum | { fNormal = 0 , fUseSetFormat = 1<<8 } |
Public Types inherited from CReaderBase | |
enum | EFlags { fNormal = 0 , fNumericIdsAsLocal = 1<<0 , fAllIdsAsLocal = 1<<1 , fNextInLine = 1<<2 , fAsRaw = 1<<3 } |
Customization flags that are relevant to all CReaderBase derived readers. More... | |
enum | ObjectType { OT_UNKNOWN , OT_SEQANNOT , OT_SEQENTRY } |
using | TReaderLine = struct SReaderLine { SReaderLine(unsigned int line, string data):mLine(line), mData(data) {} |
using | TReaderData = vector< TReaderLine > |
using | TReaderFlags = long |
typedef list< CRef< CSeq_annot > > | TAnnotList |
typedef TAnnotList | TAnnots |
typedef TAnnots::iterator | TAnnotIt |
typedef TAnnots::const_iterator | TAnnotCit |
using | SeqIdResolver = CRef< CSeq_id >(*)(const string &, long, bool) |
Public Member Functions | |
CVcfReader (int=0, CReaderListener *=nullptr) | |
virtual | ~CVcfReader () |
CRef< CSeq_annot > | ReadSeqAnnot (ILineReader &, ILineErrorListener *=nullptr) override |
Read an object from a given line reader, render it as a single Seq-annot, if possible. More... | |
Public Member Functions inherited from CReaderBase | |
virtual | ~CReaderBase () |
virtual CRef< CSerialObject > | ReadObject (CNcbiIstream &istr, ILineErrorListener *pErrors=nullptr) |
Read an object from a given input stream, render it as the most appropriate Genbank object. More... | |
virtual CRef< CSerialObject > | ReadObject (ILineReader &lr, ILineErrorListener *pErrors=nullptr) |
Read an object from a given line reader, render it as the most appropriate Genbank object. More... | |
virtual CRef< CSeq_annot > | ReadSeqAnnot (CNcbiIstream &istr, ILineErrorListener *pErrors=nullptr) |
Read an object from a given input stream, render it as a single Seq-annot. More... | |
virtual void | ReadSeqAnnots (TAnnots &annots, CNcbiIstream &istr, ILineErrorListener *pErrors=nullptr) |
Read all objects from given insput stream, returning them as a vector of Seq-annots. More... | |
virtual void | ReadSeqAnnots (TAnnots &annots, ILineReader &lr, ILineErrorListener *pErrors=nullptr) |
Read all objects from given insput stream, returning them as a vector of Seq-annots. More... | |
virtual CRef< CSeq_entry > | ReadSeqEntry (CNcbiIstream &istr, ILineErrorListener *pErrors=nullptr) |
Read an object from a given input stream, render it as a single Seq-entry, if possible. More... | |
virtual CRef< CSeq_entry > | ReadSeqEntry (ILineReader &lr, ILineErrorListener *pErrors=nullptr) |
Read an object from a given line reader, render it as a single Seq-entry, if possible. More... | |
void | SetProgressReportInterval (unsigned int intv) |
void | SetCanceler (ICanceled *=nullptr) |
bool | IsCanceled () const |
Protected Attributes | |
double | mActualVersion |
CRef< CAnnotdesc > | m_Meta |
map< string, CVcfInfoSpec > | m_InfoSpecs |
map< string, CVcfFormatSpec > | m_FormatSpecs |
map< string, CVcfFilterSpec > | m_FilterSpecs |
vector< string > | m_MetaDirectives |
vector< string > | m_GenotypeHeaders |
CMessageListenerLenient | m_ErrorsPrivate |
bool | m_MetaHandled |
Protected Attributes inherited from CReaderBase | |
unsigned int | m_uLineNumber |
unsigned int | m_uDataCount = 0 |
unsigned int | m_uProgressReportInterval |
unsigned int | m_uNextProgressReport |
TReaderFlags | m_iFlags |
string | m_AnnotName |
string | m_AnnotTitle |
string | m_PendingLine |
unique_ptr< CTrackData > | m_pTrackDefaults |
ILineReader * | m_pReader |
ICanceled * | m_pCanceler |
SeqIdResolver | mSeqIdResolve |
unique_ptr< CReaderMessageHandler > | m_pMessageHandler |
Static Protected Attributes | |
static const double | mMaxSupportedVersion = 4.1 |
Private Member Functions | |
bool | xAssigndbSNPTag (const vector< string > &ids, CRef< CDbtag > pDbtag) const |
Additional Inherited Members | |
Static Public Member Functions inherited from CReaderBase | |
static CReaderBase * | GetReader (CFormatGuess::EFormat format, TReaderFlags flags=0, CReaderListener *=nullptr) |
Allocate a CReaderBase derived reader object based on the given file format. More... | |
Public Attributes inherited from CReaderBase | |
unsigned int | mLine |
string | mData |
Static Protected Member Functions inherited from CReaderBase | |
static void | xAddStringFlagsWithMap (const list< string > &stringFlags, const map< string, TReaderFlags > flagMap, TReaderFlags &baseFlags) |
Definition at line 142 of file vcf_reader.hpp.
anonymous enum |
Enumerator | |
---|---|
fNormal | |
fUseSetFormat |
Definition at line 150 of file vcf_reader.hpp.
CVcfReader::CVcfReader | ( | int | flags = 0 , |
CReaderListener * | pRL = nullptr |
||
) |
Definition at line 162 of file vcf_reader.cpp.
|
virtual |
Definition at line 174 of file vcf_reader.cpp.
|
overridevirtual |
Read an object from a given line reader, render it as a single Seq-annot, if possible.
Return empty Seq-annot otherwise.
lr | line reader to read from. |
pErrors | pointer to optional error container object. |
Reimplemented from CReaderBase.
Definition at line 181 of file vcf_reader.cpp.
References lr(), m_Meta, CReaderBase::ReadSeqAnnot(), CRef< C, Locker >::Reset(), CUser_object_Base::SetType(), CAnnotdesc_Base::SetUser(), CReaderBase::xAssignTrackData(), and xAssignVcfMeta().
Referenced by CVcfObjectLoader::Execute().
|
private |
Definition at line 1296 of file vcf_reader.cpp.
References NStr::StartsWith(), and NStr::StringToInt().
Referenced by xAssignVariantSource(), and xAssignVariationIds().
|
protectedvirtual |
Definition at line 1101 of file vcf_reader.cpp.
References CReadUtil::AsSeqId(), data, CReaderBase::m_iFlags, CSeq_feat_Base::SetLocation(), CVcfData::ST_ALL_DEL, CVcfData::ST_ALL_INS, CVcfData::ST_ALL_MNV, and CVcfData::ST_ALL_SNV.
Referenced by xProcessDataLine().
|
protectedvirtual |
Definition at line 796 of file vcf_reader.cpp.
References s_AddDeleteDeltaItem(), and CSeq_feat_Base::SetData().
Referenced by xAssignVariationAlleleSet().
|
protectedvirtual |
Definition at line 850 of file vcf_reader.cpp.
References data, CVariation_inst_Base::eType_delins, CVariation_inst_Base::eType_snv, s_AddDeleteDeltaItem(), CSeq_feat_Base::SetData(), CVariation_inst_Base::SetDelta(), CSeq_literal_Base::SetLength(), CSeq_literal_Base::SetSeq_data(), and CVariation_inst_Base::SetType().
Referenced by xAssignVariationAlleleSet().
|
protectedvirtual |
Definition at line 819 of file vcf_reader.cpp.
References data, CDelta_item_Base::eAction_ins_before, CVariation_inst_Base::eType_ins, CSeq_feat_Base::SetData(), CVariation_inst_Base::SetDelta(), CSeq_literal_Base::SetLength(), CSeq_literal_Base::SetSeq_data(), and CVariation_inst_Base::SetType().
Referenced by xAssignVariationAlleleSet().
|
protectedvirtual |
Definition at line 761 of file vcf_reader.cpp.
References data, CVariation_ref::eSeqType_na, and CSeq_feat_Base::SetData().
Referenced by xAssignVariationAlleleSet().
Definition at line 1385 of file vcf_reader.cpp.
References data, eDiag_Warning, CVariantProperties_Base::eGene_location_utr_3, map_checker< Container >::end(), map_checker< Container >::erase(), map_checker< Container >::find(), CReaderBase::m_pMessageHandler, CReaderBase::m_uLineNumber, CSeq_feat_Base::SetData(), CDbtag_Base::SetDb(), CSeq_feat_Base::SetDbxref(), CDbtag_Base::SetTag(), NStr::SplitInTwo(), NStr::StringToDouble(), NStr::StringToInt(), tag, weight, and xAssignVariantSource().
Referenced by xProcessInfo().
|
protectedvirtual |
Definition at line 740 of file vcf_reader.cpp.
References data, CVariation_ref::eSeqType_na, and CSeq_feat_Base::SetData().
Referenced by xAssignVariationAlleleSet().
Definition at line 1651 of file vcf_reader.cpp.
References data, eDiag_Warning, map_checker< Container >::end(), NStr::Equal(), map_checker< Container >::erase(), map_checker< Container >::find(), CReaderBase::m_pMessageHandler, CReaderBase::m_uLineNumber, CSeq_feat_Base::SetDbxref(), and xAssigndbSNPTag().
Referenced by xAssignVariantProps().
|
protectedvirtual |
Definition at line 662 of file vcf_reader.cpp.
References data, CVariation_inst_Base::eObservation_reference, CVariation_inst_Base::eObservation_variant, NStr::Equal(), CVariation_ref::eSeqType_na, CVariation_inst_Base::eType_identity, i, CSeq_feat_Base::SetData(), CVariation_inst_Base::SetObservation(), CVariation_inst_Base::SetType(), CVcfData::ST_ALL_DEL, CVcfData::ST_ALL_INS, CVcfData::ST_ALL_MNV, CVcfData::ST_ALL_SNV, xAssignVariantDel(), xAssignVariantDelins(), xAssignVariantIns(), xAssignVariantMnv(), and xAssignVariantSnv().
Referenced by xProcessDataLine().
|
protectedvirtual |
Definition at line 1322 of file vcf_reader.cpp.
References data, NStr::Equal(), CRef< C, Locker >::GetNCObject(), i, Ref(), CSeq_feat_Base::SetData(), NStr::StartsWith(), NStr::ToLower(), and xAssigndbSNPTag().
Referenced by xProcessDataLine().
|
protectedvirtual |
Definition at line 588 of file vcf_reader.cpp.
References CAnnotdesc_Base::GetUser(), CUser_object_Base::IsSetData(), CSeq_annot_Base::IsSetDesc(), CAnnotdesc_Base::IsUser(), m_Meta, and CSeq_annot_Base::SetDesc().
Referenced by ReadSeqAnnot().
|
overrideprotectedvirtual |
Reimplemented from CReaderBase.
Definition at line 200 of file vcf_reader.cpp.
References CSeq_annot_Base::SetData(), and CReaderBase::xCreateSeqAnnot().
|
overrideprotectedvirtual |
Reimplemented from CReaderBase.
Definition at line 210 of file vcf_reader.cpp.
References lr(), CReaderBase::m_uDataCount, CReaderBase::m_uLineNumber, CReaderBase::xGetLine(), CReaderBase::xIsTrackLine(), and CReaderBase::xUngetLine().
|
overrideprotectedvirtual |
Reimplemented from CReaderBase.
Definition at line 1683 of file vcf_reader.cpp.
References NStr::StartsWith(), and CReaderBase::xIsCommentLine().
|
protectedvirtual |
Definition at line 1026 of file vcf_reader.cpp.
References CObjReaderLineException::Create(), data, eDiag_Error, ILineError::eProblem_GeneralParsingError, CReaderBase::ProcessError(), and NStr::StartsWith().
Referenced by xParseData().
|
protectedvirtual |
Definition at line 895 of file vcf_reader.cpp.
References columns, CObjReaderLineException::Create(), data, eDiag_Error, ILineError::eProblem_GeneralParsingError, NStr::fSplit_MergeDelimiters, NStr::fSplit_Truncate, ncbi::grid::netcache::search::fields::key, m_GenotypeHeaders, CReaderBase::ProcessError(), NStr::Split(), NStr::SplitInTwo(), CVcfData::ST_ALL_DEL, CVcfData::ST_ALL_INS, CVcfData::ST_ALL_MNV, CVcfData::ST_ALL_SNV, CVcfData::ST_MIXED, NStr::StartsWith(), NStr::StringToDouble(), NStr::StringToInt(), rapidjson::value, and xNormalizeData().
Referenced by xProcessDataLine().
|
overrideprotectedvirtual |
Reimplemented from CReaderBase.
Definition at line 229 of file vcf_reader.cpp.
References eDiag_Warning, CReaderBase::m_pMessageHandler, CReaderBase::m_uDataCount, CReaderBase::m_uLineNumber, mActualVersion, CReaderBase::xParseBrowserLine(), xProcessDataLine(), xProcessHeaderLine(), xProcessMetaLine(), xProcessTrackLine(), and xSetFileFormat().
|
protectedvirtual |
Definition at line 611 of file vcf_reader.cpp.
References data, CUser_object_Base::GetData(), CSeq_feat_Base::GetExt(), CSeq_feat_Base::ResetExt(), CSeq_annot_Base::SetData(), CSeq_feat_Base::SetData(), CSeq_feat_Base::SetExt(), CUser_object_Base::SetType(), NStr::StartsWith(), xAssignFeatureLocationSet(), xAssignVariationAlleleSet(), xAssignVariationIds(), xParseData(), xProcessFilter(), xProcessFormat(), xProcessInfo(), and xProcessScore().
Referenced by xProcessData().
Definition at line 1193 of file vcf_reader.cpp.
References CUser_object::AddField(), data, NStr::Equal(), and CSeq_feat_Base::SetExt().
Referenced by xProcessDataLine().
Definition at line 1271 of file vcf_reader.cpp.
References CUser_object::AddField(), CUser_field::AddField(), data, CUser_object_Base::SetData(), CSeq_feat_Base::SetExt(), and CUser_field_Base::SetLabel().
Referenced by xProcessDataLine().
|
protectedvirtual |
Definition at line 551 of file vcf_reader.cpp.
References CUser_object::AddField(), NStr::fSplit_MergeDelimiters, NStr::fSplit_Truncate, m_GenotypeHeaders, m_Meta, CAnnotdesc_Base::SetUser(), NStr::Split(), and NStr::StartsWith().
Referenced by xProcessData().
Definition at line 1207 of file vcf_reader.cpp.
References CUser_object::AddField(), data, NStr::Join(), ncbi::grid::netcache::search::fields::key, CSeq_feat_Base::SetExt(), rapidjson::value, and xAssignVariantProps().
Referenced by xProcessDataLine().
|
protectedvirtual |
Definition at line 276 of file vcf_reader.cpp.
References CUser_object::AddField(), m_Meta, m_MetaDirectives, m_MetaHandled, CAnnotdesc_Base::SetUser(), NStr::StartsWith(), xProcessMetaLineFilter(), xProcessMetaLineFormat(), and xProcessMetaLineInfo().
Referenced by xProcessData().
|
protectedvirtual |
Definition at line 432 of file vcf_reader.cpp.
References CObjReaderLineException::Create(), eDiag_Error, NStr::EndsWith(), ILineError::eProblem_BadFilterLine, info, ncbi::grid::netcache::search::fields::key, m_FilterSpecs, CReaderBase::ProcessError(), NStr::Split(), NStr::SplitInTwo(), and NStr::StartsWith().
Referenced by xProcessMetaLine().
|
protectedvirtual |
Definition at line 480 of file vcf_reader.cpp.
References CObjReaderLineException::Create(), eDiag_Error, NStr::EndsWith(), ILineError::eProblem_BadFormatLine, info, ncbi::grid::netcache::search::fields::key, m_FormatSpecs, CReaderBase::ProcessError(), NStr::Split(), NStr::SplitInTwo(), NStr::StartsWith(), and type.
Referenced by xProcessMetaLine().
|
protectedvirtual |
Definition at line 364 of file vcf_reader.cpp.
References CObjReaderLineException::Create(), eDiag_Error, NStr::EndsWith(), ILineError::eProblem_BadInfoLine, info, ncbi::grid::netcache::search::fields::key, m_InfoSpecs, CReaderBase::ProcessError(), NStr::Split(), NStr::SplitInTwo(), NStr::StartsWith(), and type.
Referenced by xProcessMetaLine().
Definition at line 1179 of file vcf_reader.cpp.
References CUser_object::AddField(), data, and CSeq_feat_Base::SetExt().
Referenced by xProcessDataLine().
|
protectedvirtual |
Definition at line 1239 of file vcf_reader.cpp.
References eDiag_Warning, CReaderBase::m_pMessageHandler, CReaderBase::m_uLineNumber, CReadUtil::Tokenize(), CReaderBase::xIsTrackLine(), and CReaderBase::xParseTrackLine().
Referenced by xProcessData().
|
protectedvirtual |
Definition at line 304 of file vcf_reader.cpp.
References NStr::DoubleToString(), eDiag_Warning, CReaderBase::m_pMessageHandler, CReaderBase::m_uLineNumber, mActualVersion, mMaxSupportedVersion, NStr::StartsWith(), and NStr::StringToDouble().
Referenced by xProcessData().
|
protected |
Definition at line 335 of file vcf_reader.hpp.
|
protected |
Definition at line 332 of file vcf_reader.hpp.
Referenced by xProcessMetaLineFilter().
|
protected |
Definition at line 331 of file vcf_reader.hpp.
Referenced by xProcessMetaLineFormat().
|
protected |
Definition at line 334 of file vcf_reader.hpp.
Referenced by xParseData(), and xProcessHeaderLine().
|
protected |
Definition at line 330 of file vcf_reader.hpp.
Referenced by xProcessMetaLineInfo().
|
protected |
Definition at line 329 of file vcf_reader.hpp.
Referenced by ReadSeqAnnot(), xAssignVcfMeta(), xProcessHeaderLine(), and xProcessMetaLine().
|
protected |
Definition at line 333 of file vcf_reader.hpp.
Referenced by xProcessMetaLine().
|
protected |
Definition at line 336 of file vcf_reader.hpp.
Referenced by xProcessMetaLine().
|
protected |
Definition at line 328 of file vcf_reader.hpp.
Referenced by xProcessData(), and xSetFileFormat().
|
staticprotected |
Definition at line 327 of file vcf_reader.hpp.
Referenced by xSetFileFormat().