NCBI C++ ToolKit
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | List of all members
CVcfReader Class Reference

Search Toolkit Book for CVcfReader

#include <objtools/readers/vcf_reader.hpp>

+ Inheritance diagram for CVcfReader:
+ Collaboration diagram for CVcfReader:

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_annotReadSeqAnnot (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< CSerialObjectReadObject (CNcbiIstream &istr, ILineErrorListener *pErrors=nullptr)
 Read an object from a given input stream, render it as the most appropriate Genbank object. More...
 
virtual CRef< CSerialObjectReadObject (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_annotReadSeqAnnot (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_entryReadSeqEntry (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_entryReadSeqEntry (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 Member Functions

CRef< CSeq_annotxCreateSeqAnnot () override
 
void xGetData (ILineReader &, TReaderData &) override
 
void xProcessData (const TReaderData &, CSeq_annot &) override
 
bool xIsCommentLine (const CTempString &) override
 
virtual bool xProcessTrackLine (const string &, CSeq_annot &)
 
virtual bool xProcessMetaLine (const string &, CSeq_annot &)
 
virtual void xSetFileFormat (const string &, CSeq_annot &, bool &)
 
virtual bool xProcessMetaLineInfo (const string &, CSeq_annot &)
 
virtual bool xProcessMetaLineFilter (const string &, CSeq_annot &)
 
virtual bool xProcessMetaLineFormat (const string &, CSeq_annot &)
 
virtual bool xProcessHeaderLine (const string &, CSeq_annot &)
 
virtual bool xProcessDataLine (const string &, CSeq_annot &)
 
virtual bool xAssignVcfMeta (CSeq_annot &)
 
virtual bool xAssignVariationAlleleSet (const CVcfData &, CRef< CSeq_feat >)
 
virtual bool xAssignFeatureLocationSet (const CVcfData &, CRef< CSeq_feat >)
 
virtual bool xAssignVariationIds (CVcfData &, CRef< CSeq_feat >)
 
virtual bool xAssignVariantSnv (const CVcfData &, unsigned int, CRef< CSeq_feat >)
 
virtual bool xAssignVariantMnv (const CVcfData &, unsigned int, CRef< CSeq_feat >)
 
virtual bool xAssignVariantDel (const CVcfData &, unsigned int, CRef< CSeq_feat >)
 
virtual bool xAssignVariantIns (const CVcfData &, unsigned int, CRef< CSeq_feat >)
 
virtual bool xAssignVariantDelins (const CVcfData &, unsigned int, CRef< CSeq_feat >)
 
virtual bool xAssignVariantProps (CVcfData &, CRef< CSeq_feat >)
 
void xAssignVariantSource (CVcfData &, CRef< CSeq_feat >)
 
virtual bool xProcessScore (CVcfData &, CRef< CSeq_feat >)
 
virtual bool xProcessFilter (CVcfData &, CRef< CSeq_feat >)
 
virtual bool xProcessInfo (CVcfData &, CRef< CSeq_feat >)
 
virtual bool xProcessFormat (CVcfData &, CRef< CSeq_feat >)
 
virtual bool xParseData (const string &, CVcfData &, ILineErrorListener *=nullptr)
 
virtual bool xNormalizeData (CVcfData &, ILineErrorListener *=nullptr)
 
- Protected Member Functions inherited from CReaderBase
 CReaderBase (TReaderFlags flags=0, const string &name="", const string &title="", SeqIdResolver seqresolver=CReadUtil::AsSeqId, CReaderListener *pListener=nullptr)
 Protected constructor. Use GetReader() to get an actual reader object. More...
 
 CReaderBase (const CReaderBase &)=delete
 
 CReaderBase (CReaderBase &&)=delete
 
void xGuardedGetData (ILineReader &, TReaderData &, ILineErrorListener *)
 
virtual void xGuardedProcessData (const TReaderData &, CSeq_annot &, ILineErrorListener *)
 
virtual void xValidateAnnot (const CSeq_annot &)
 
virtual bool xGetLine (ILineReader &, string &)
 
virtual bool xUngetLine (ILineReader &)
 
virtual bool xIsTrackLine (const CTempString &)
 
virtual bool xIsBrowserLine (const CTempString &)
 
virtual bool xIsTrackTerminator (const CTempString &)
 
virtual void xAssignTrackData (CSeq_annot &)
 
virtual bool xParseBrowserLine (const string &, CSeq_annot &)
 
virtual bool xParseTrackLine (const string &)
 
virtual void xSetBrowserRegion (const string &, CAnnot_descr &)
 
virtual void xPostProcessAnnot (CSeq_annot &)
 
virtual void xAddConversionInfo (CSeq_annot &, ILineErrorListener *)
 
bool xParseComment (const CTempString &, CRef< CSeq_annot > &)
 
virtual bool xReadInit ()
 
virtual bool xProgressInit (ILineReader &istr)
 
bool xIsReportingProgress () const
 
bool xIsOperationCanceled () const
 
void xReportProgress (ILineErrorListener *=nullptr)
 
void ProcessError (CObjReaderLineException &, ILineErrorListener *)
 
void ProcessError (CLineError &, ILineErrorListener *)
 
void ProcessWarning (CObjReaderLineException &, ILineErrorListener *)
 
void ProcessWarning (CLineError &, ILineErrorListener *)
 
void xProcessReaderMessage (CReaderMessage &, ILineErrorListener *)
 
void xProcessLineError (const ILineError &, ILineErrorListener *)
 
void xProcessUnknownException (const CException &)
 

Protected Attributes

double mActualVersion
 
CRef< CAnnotdescm_Meta
 
map< string, CVcfInfoSpecm_InfoSpecs
 
map< string, CVcfFormatSpecm_FormatSpecs
 
map< string, CVcfFilterSpecm_FilterSpecs
 
vector< stringm_MetaDirectives
 
vector< stringm_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< CTrackDatam_pTrackDefaults
 
ILineReaderm_pReader
 
ICanceledm_pCanceler
 
SeqIdResolver mSeqIdResolve
 
unique_ptr< CReaderMessageHandlerm_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 CReaderBaseGetReader (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)
 

Detailed Description

Definition at line 142 of file vcf_reader.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
fNormal 
fUseSetFormat 

Definition at line 150 of file vcf_reader.hpp.

Constructor & Destructor Documentation

◆ CVcfReader()

CVcfReader::CVcfReader ( int  flags = 0,
CReaderListener pRL = nullptr 
)

Definition at line 162 of file vcf_reader.cpp.

◆ ~CVcfReader()

CVcfReader::~CVcfReader ( )
virtual

Definition at line 174 of file vcf_reader.cpp.

Member Function Documentation

◆ ReadSeqAnnot()

CRef< CSeq_annot > CVcfReader::ReadSeqAnnot ( ILineReader lr,
ILineErrorListener pErrors = nullptr 
)
overridevirtual

Read an object from a given line reader, render it as a single Seq-annot, if possible.

Return empty Seq-annot otherwise.

Parameters
lrline reader to read from.
pErrorspointer 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().

◆ xAssigndbSNPTag()

bool CVcfReader::xAssigndbSNPTag ( const vector< string > &  ids,
CRef< CDbtag pDbtag 
) const
private

Definition at line 1296 of file vcf_reader.cpp.

References NStr::StartsWith(), and NStr::StringToInt().

Referenced by xAssignVariantSource(), and xAssignVariationIds().

◆ xAssignFeatureLocationSet()

bool CVcfReader::xAssignFeatureLocationSet ( const CVcfData data,
CRef< CSeq_feat pFeat 
)
protectedvirtual

◆ xAssignVariantDel()

bool CVcfReader::xAssignVariantDel ( const CVcfData data,
unsigned int  index,
CRef< CSeq_feat pFeature 
)
protectedvirtual

Definition at line 796 of file vcf_reader.cpp.

References s_AddDeleteDeltaItem(), and CSeq_feat_Base::SetData().

Referenced by xAssignVariationAlleleSet().

◆ xAssignVariantDelins()

bool CVcfReader::xAssignVariantDelins ( const CVcfData data,
unsigned int  index,
CRef< CSeq_feat pFeature 
)
protectedvirtual

◆ xAssignVariantIns()

bool CVcfReader::xAssignVariantIns ( const CVcfData data,
unsigned int  index,
CRef< CSeq_feat pFeature 
)
protectedvirtual

◆ xAssignVariantMnv()

bool CVcfReader::xAssignVariantMnv ( const CVcfData data,
unsigned int  index,
CRef< CSeq_feat pFeature 
)
protectedvirtual

Definition at line 761 of file vcf_reader.cpp.

References data, CVariation_ref::eSeqType_na, and CSeq_feat_Base::SetData().

Referenced by xAssignVariationAlleleSet().

◆ xAssignVariantProps()

bool CVcfReader::xAssignVariantProps ( CVcfData data,
CRef< CSeq_feat pFeat 
)
protectedvirtual

◆ xAssignVariantSnv()

bool CVcfReader::xAssignVariantSnv ( const CVcfData data,
unsigned int  index,
CRef< CSeq_feat pFeature 
)
protectedvirtual

Definition at line 740 of file vcf_reader.cpp.

References data, CVariation_ref::eSeqType_na, and CSeq_feat_Base::SetData().

Referenced by xAssignVariationAlleleSet().

◆ xAssignVariantSource()

void CVcfReader::xAssignVariantSource ( CVcfData data,
CRef< CSeq_feat pFeat 
)
protected

◆ xAssignVariationAlleleSet()

bool CVcfReader::xAssignVariationAlleleSet ( const CVcfData data,
CRef< CSeq_feat pFeature 
)
protectedvirtual

◆ xAssignVariationIds()

bool CVcfReader::xAssignVariationIds ( CVcfData data,
CRef< CSeq_feat pFeature 
)
protectedvirtual

◆ xAssignVcfMeta()

bool CVcfReader::xAssignVcfMeta ( CSeq_annot annot)
protectedvirtual

◆ xCreateSeqAnnot()

CRef< CSeq_annot > CVcfReader::xCreateSeqAnnot ( )
overrideprotectedvirtual

Reimplemented from CReaderBase.

Definition at line 200 of file vcf_reader.cpp.

References CSeq_annot_Base::SetData(), and CReaderBase::xCreateSeqAnnot().

◆ xGetData()

void CVcfReader::xGetData ( ILineReader lr,
TReaderData readerData 
)
overrideprotectedvirtual

◆ xIsCommentLine()

bool CVcfReader::xIsCommentLine ( const CTempString strLine)
overrideprotectedvirtual

Reimplemented from CReaderBase.

Definition at line 1683 of file vcf_reader.cpp.

References NStr::StartsWith(), and CReaderBase::xIsCommentLine().

◆ xNormalizeData()

bool CVcfReader::xNormalizeData ( CVcfData data,
ILineErrorListener pEC = nullptr 
)
protectedvirtual

◆ xParseData()

bool CVcfReader::xParseData ( const string line,
CVcfData data,
ILineErrorListener pEC = nullptr 
)
protectedvirtual

◆ xProcessData()

void CVcfReader::xProcessData ( const TReaderData readerData,
CSeq_annot annot 
)
overrideprotectedvirtual

◆ xProcessDataLine()

bool CVcfReader::xProcessDataLine ( const string line,
CSeq_annot annot 
)
protectedvirtual

◆ xProcessFilter()

bool CVcfReader::xProcessFilter ( CVcfData data,
CRef< CSeq_feat pFeature 
)
protectedvirtual

Definition at line 1193 of file vcf_reader.cpp.

References CUser_object::AddField(), data, NStr::Equal(), and CSeq_feat_Base::SetExt().

Referenced by xProcessDataLine().

◆ xProcessFormat()

bool CVcfReader::xProcessFormat ( CVcfData data,
CRef< CSeq_feat pFeature 
)
protectedvirtual

◆ xProcessHeaderLine()

bool CVcfReader::xProcessHeaderLine ( const string line,
CSeq_annot annot 
)
protectedvirtual

◆ xProcessInfo()

bool CVcfReader::xProcessInfo ( CVcfData data,
CRef< CSeq_feat pFeature 
)
protectedvirtual

◆ xProcessMetaLine()

bool CVcfReader::xProcessMetaLine ( const string line,
CSeq_annot annot 
)
protectedvirtual

◆ xProcessMetaLineFilter()

bool CVcfReader::xProcessMetaLineFilter ( const string line,
CSeq_annot annot 
)
protectedvirtual

◆ xProcessMetaLineFormat()

bool CVcfReader::xProcessMetaLineFormat ( const string line,
CSeq_annot annot 
)
protectedvirtual

◆ xProcessMetaLineInfo()

bool CVcfReader::xProcessMetaLineInfo ( const string line,
CSeq_annot annot 
)
protectedvirtual

◆ xProcessScore()

bool CVcfReader::xProcessScore ( CVcfData data,
CRef< CSeq_feat pFeature 
)
protectedvirtual

Definition at line 1179 of file vcf_reader.cpp.

References CUser_object::AddField(), data, and CSeq_feat_Base::SetExt().

Referenced by xProcessDataLine().

◆ xProcessTrackLine()

bool CVcfReader::xProcessTrackLine ( const string strLine,
CSeq_annot current 
)
protectedvirtual

◆ xSetFileFormat()

void CVcfReader::xSetFileFormat ( const string line,
CSeq_annot annot,
bool lineContainsVersion 
)
protectedvirtual

Member Data Documentation

◆ m_ErrorsPrivate

CMessageListenerLenient CVcfReader::m_ErrorsPrivate
protected

Definition at line 335 of file vcf_reader.hpp.

◆ m_FilterSpecs

map<string,CVcfFilterSpec> CVcfReader::m_FilterSpecs
protected

Definition at line 332 of file vcf_reader.hpp.

Referenced by xProcessMetaLineFilter().

◆ m_FormatSpecs

map<string,CVcfFormatSpec> CVcfReader::m_FormatSpecs
protected

Definition at line 331 of file vcf_reader.hpp.

Referenced by xProcessMetaLineFormat().

◆ m_GenotypeHeaders

vector<string> CVcfReader::m_GenotypeHeaders
protected

Definition at line 334 of file vcf_reader.hpp.

Referenced by xParseData(), and xProcessHeaderLine().

◆ m_InfoSpecs

map<string,CVcfInfoSpec> CVcfReader::m_InfoSpecs
protected

Definition at line 330 of file vcf_reader.hpp.

Referenced by xProcessMetaLineInfo().

◆ m_Meta

CRef< CAnnotdesc > CVcfReader::m_Meta
protected

Definition at line 329 of file vcf_reader.hpp.

Referenced by ReadSeqAnnot(), xAssignVcfMeta(), xProcessHeaderLine(), and xProcessMetaLine().

◆ m_MetaDirectives

vector<string> CVcfReader::m_MetaDirectives
protected

Definition at line 333 of file vcf_reader.hpp.

Referenced by xProcessMetaLine().

◆ m_MetaHandled

bool CVcfReader::m_MetaHandled
protected

Definition at line 336 of file vcf_reader.hpp.

Referenced by xProcessMetaLine().

◆ mActualVersion

double CVcfReader::mActualVersion
protected

Definition at line 328 of file vcf_reader.hpp.

Referenced by xProcessData(), and xSetFileFormat().

◆ mMaxSupportedVersion

const double CVcfReader::mMaxSupportedVersion = 4.1
staticprotected

Definition at line 327 of file vcf_reader.hpp.

Referenced by xSetFileFormat().


The documentation for this class was generated from the following files:
Modified on Fri Sep 20 14:57:42 2024 by modify_doxy.py rev. 669887