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

Search Toolkit Book for CWiggleReader

#include <objtools/readers/wiggle_reader.hpp>

+ Inheritance diagram for CWiggleReader:
+ Collaboration diagram for CWiggleReader:

Public Types

enum  EWiggleFlags {
  fDefaults = 0 , fJoinSame = 1<<8 , fAsByte = 1<<9 , fAsGraph = 1<<10 ,
  fDumpStats = 1<<11 , fAsRaw = 1<<12
}
 
typedef vector< SValueInfoTValues
 
typedef int TFlags
 
- 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

 CWiggleReader (int=fDefaults, const string &="", const string &="", CReaderListener *=nullptr)
 
virtual ~CWiggleReader ()
 
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...
 
virtual bool ReadTrackData (ILineReader &, CRawWiggleTrack &, ILineErrorListener *=nullptr)
 
- 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 Types

enum  ETrackType { eTrackType_invalid , eTrackType_wiggle_0 , eTrackType_bedGraph }
 

Protected Member Functions

void xGetData (ILineReader &, TReaderData &) override
 
void xProcessData (const TReaderData &, CSeq_annot &) override
 
void xPostProcessAnnot (CSeq_annot &) override
 
bool xParseBrowserLine (const string &, CSeq_annot &) override
 
bool xParseTrackLine (const string &) override
 
bool xProcessFixedStepData (TReaderData::const_iterator &, const TReaderData &)
 
void xGetFixedStepInfo (const string &, SFixedStepInfo &)
 
void xReadFixedStepData (const SFixedStepInfo &, TReaderData::const_iterator &, const TReaderData &)
 
bool xReadFixedStepDataRaw (const SFixedStepInfo &, TReaderData::const_iterator &, const TReaderData &, CRawWiggleTrack &)
 
bool xProcessVariableStepData (TReaderData::const_iterator &, const TReaderData &)
 
bool xProcessBedData (TReaderData::const_iterator &, const TReaderData &)
 
void xGetVariableStepInfo (const string &, SVarStepInfo &)
 
void xReadVariableStepData (const SVarStepInfo &, TReaderData::const_iterator &, const TReaderData &)
 
bool xReadVariableStepDataRaw (const SVarStepInfo &, TReaderData::const_iterator &, const TReaderData &, CRawWiggleTrack &)
 
string xGetWord (string &)
 
bool xSkipWS (string &)
 
string xGetParamName (string &)
 
string xGetParamValue (string &)
 
void xGetPos (string &, TSeqPos &v)
 
bool xTryGetDoubleSimple (string &, double &v)
 
void xGetDouble (string &line, double &v)
 
CRef< CSeq_idxMakeChromId ()
 
CRef< CSeq_tablexMakeTable ()
 
CRef< CSeq_graphxMakeGraph ()
 
void xPreprocessValues (SWiggleStat &)
 
void xAddValue (const SValueInfo &value)
 
double xEstimateSize (size_t rows, bool fixed_span) const
 
void xSetTotalLoc (CSeq_loc &loc, CSeq_id &chrom_id)
 
void xDumpChromValues ()
 
void xSetChrom (const string &chrom)
 
bool xValuesAreFromSingleSequence () const
 
- 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 CRef< CSeq_annotxCreateSeqAnnot ()
 
virtual void xValidateAnnot (const CSeq_annot &)
 
virtual bool xGetLine (ILineReader &, string &)
 
virtual bool xUngetLine (ILineReader &)
 
virtual bool xIsCommentLine (const CTempString &)
 
virtual bool xIsTrackLine (const CTempString &)
 
virtual bool xIsBrowserLine (const CTempString &)
 
virtual bool xIsTrackTerminator (const CTempString &)
 
virtual void xAssignTrackData (CSeq_annot &)
 
virtual void xSetBrowserRegion (const string &, CAnnot_descr &)
 
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

string m_ChromId
 
TValues m_Values
 
double m_GapValue
 
bool m_SingleAnnot
 
bool m_OmitZeros
 
ETrackType m_TrackType
 
CRef< CSeq_annotm_Annot
 
- 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
 

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 238 of file wiggle_reader.hpp.

Member Typedef Documentation

◆ TFlags

Definition at line 266 of file wiggle_reader.hpp.

◆ TValues

Definition at line 243 of file wiggle_reader.hpp.

Member Enumeration Documentation

◆ ETrackType

enum CWiggleReader::ETrackType
protected
Enumerator
eTrackType_invalid 
eTrackType_wiggle_0 
eTrackType_bedGraph 

Definition at line 435 of file wiggle_reader.hpp.

◆ EWiggleFlags

Enumerator
fDefaults 
fJoinSame 
fAsByte 
fAsGraph 
fDumpStats 
fAsRaw 

Definition at line 258 of file wiggle_reader.hpp.

Constructor & Destructor Documentation

◆ CWiggleReader()

CWiggleReader::CWiggleReader ( int  iFlags = fDefaults,
const string name = "",
const string title = "",
CReaderListener pRl = nullptr 
)

Definition at line 70 of file wiggle_reader.cpp.

References m_GapValue, and CReaderBase::m_uLineNumber.

◆ ~CWiggleReader()

CWiggleReader::~CWiggleReader ( )
virtual

Definition at line 85 of file wiggle_reader.cpp.

Member Function Documentation

◆ ReadSeqAnnot()

CRef< CSeq_annot > CWiggleReader::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 92 of file wiggle_reader.cpp.

References fAsGraph, lr(), m_ChromId, CReaderBase::m_iFlags, CReaderBase::m_uDataCount, m_Values, CRef< C, Locker >::Reset(), CReaderBase::xCreateSeqAnnot(), CReaderBase::xGuardedGetData(), CReaderBase::xGuardedProcessData(), xParseTrackLine(), xPostProcessAnnot(), and CReaderBase::xProgressInit().

◆ ReadTrackData()

bool CWiggleReader::ReadTrackData ( ILineReader lr,
CRawWiggleTrack rawdata,
ILineErrorListener pMessageListener = nullptr 
)
virtual

◆ xAddValue()

void CWiggleReader::xAddValue ( const SValueInfo value)
inlineprotected

◆ xDumpChromValues()

void CWiggleReader::xDumpChromValues ( void  )
protected

◆ xEstimateSize()

double CWiggleReader::xEstimateSize ( size_t  rows,
bool  fixed_span 
) const
protected

Definition at line 267 of file wiggle_reader.cpp.

Referenced by xPreprocessValues().

◆ xGetData()

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

◆ xGetDouble()

void CWiggleReader::xGetDouble ( string line,
double &  v 
)
inlineprotected

◆ xGetFixedStepInfo()

void CWiggleReader::xGetFixedStepInfo ( const string directive,
SFixedStepInfo fixedStepInfo 
)
protected

◆ xGetParamName()

string CWiggleReader::xGetParamName ( string line)
protected

Definition at line 591 of file wiggle_reader.cpp.

References eDiag_Error, len, and CReaderBase::m_uLineNumber.

Referenced by xGetFixedStepInfo(), and xGetVariableStepInfo().

◆ xGetParamValue()

string CWiggleReader::xGetParamValue ( string line)
protected

◆ xGetPos()

void CWiggleReader::xGetPos ( string line,
TSeqPos v 
)
protected

◆ xGetVariableStepInfo()

void CWiggleReader::xGetVariableStepInfo ( const string directive,
SVarStepInfo varStepInfo 
)
protected

◆ xGetWord()

string CWiggleReader::xGetWord ( string line)
protected

Definition at line 567 of file wiggle_reader.cpp.

References eDiag_Error, len, and CReaderBase::m_uLineNumber.

Referenced by xGetParamValue(), and xProcessBedData().

◆ xMakeChromId()

CRef< CSeq_id > CWiggleReader::xMakeChromId ( )
protected

Definition at line 354 of file wiggle_reader.cpp.

References CReadUtil::AsSeqId(), m_ChromId, and CReaderBase::m_iFlags.

Referenced by xMakeGraph(), and xMakeTable().

◆ xMakeGraph()

CRef< CSeq_graph > CWiggleReader::xMakeGraph ( )
protected

◆ xMakeTable()

CRef< CSeq_table > CWiggleReader::xMakeTable ( )
protected

◆ xParseBrowserLine()

bool CWiggleReader::xParseBrowserLine ( const string line,
CSeq_annot  
)
overrideprotectedvirtual

Reimplemented from CReaderBase.

Definition at line 815 of file wiggle_reader.cpp.

References NStr::StartsWith().

Referenced by xProcessData().

◆ xParseTrackLine()

bool CWiggleReader::xParseTrackLine ( const string line)
overrideprotectedvirtual

◆ xPostProcessAnnot()

void CWiggleReader::xPostProcessAnnot ( CSeq_annot annot)
overrideprotectedvirtual

◆ xPreprocessValues()

void CWiggleReader::xPreprocessValues ( SWiggleStat stat)
protected

◆ xProcessBedData()

bool CWiggleReader::xProcessBedData ( TReaderData::const_iterator &  curIt,
const TReaderData readerData 
)
protected

Definition at line 1051 of file wiggle_reader.cpp.

References rapidjson::value, xAddValue(), xGetDouble(), xGetPos(), xGetWord(), xSetChrom(), and xSkipWS().

Referenced by xProcessData().

◆ xProcessData()

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

◆ xProcessFixedStepData()

bool CWiggleReader::xProcessFixedStepData ( TReaderData::const_iterator &  curIt,
const TReaderData readerData 
)
protected

Definition at line 853 of file wiggle_reader.cpp.

References NStr::StartsWith(), xGetFixedStepInfo(), and xReadFixedStepData().

Referenced by xProcessData().

◆ xProcessVariableStepData()

bool CWiggleReader::xProcessVariableStepData ( TReaderData::const_iterator &  curIt,
const TReaderData readerData 
)
protected

Definition at line 873 of file wiggle_reader.cpp.

References NStr::StartsWith(), xGetVariableStepInfo(), and xReadVariableStepData().

Referenced by xProcessData().

◆ xReadFixedStepData()

void CWiggleReader::xReadFixedStepData ( const SFixedStepInfo fixedStepInfo,
TReaderData::const_iterator &  curIt,
const TReaderData readerData 
)
protected

◆ xReadFixedStepDataRaw()

bool CWiggleReader::xReadFixedStepDataRaw ( const SFixedStepInfo fixedStepInfo,
TReaderData::const_iterator &  curIt,
const TReaderData readerData,
CRawWiggleTrack rawdata 
)
protected

◆ xReadVariableStepData()

void CWiggleReader::xReadVariableStepData ( const SVarStepInfo varStepInfo,
TReaderData::const_iterator &  curIt,
const TReaderData readerData 
)
protected

◆ xReadVariableStepDataRaw()

bool CWiggleReader::xReadVariableStepDataRaw ( const SVarStepInfo varStepInfo,
TReaderData::const_iterator &  curIt,
const TReaderData readerData,
CRawWiggleTrack rawdata 
)
protected

◆ xSetChrom()

void CWiggleReader::xSetChrom ( const string chrom)
protected

◆ xSetTotalLoc()

void CWiggleReader::xSetTotalLoc ( CSeq_loc loc,
CSeq_id chrom_id 
)
protected

◆ xSkipWS()

bool CWiggleReader::xSkipWS ( string line)
protected

◆ xTryGetDoubleSimple()

bool CWiggleReader::xTryGetDoubleSimple ( string line,
double &  v 
)
protected

Definition at line 673 of file wiggle_reader.cpp.

Referenced by xGetDouble().

◆ xValuesAreFromSingleSequence()

bool CWiggleReader::xValuesAreFromSingleSequence ( ) const
protected

Definition at line 53 of file wiggle_reader.cpp.

References first(), and m_Values.

Referenced by xMakeTable().

Member Data Documentation

◆ m_Annot

CRef<CSeq_annot> CWiggleReader::m_Annot
protected

Definition at line 441 of file wiggle_reader.hpp.

Referenced by xDumpChromValues().

◆ m_ChromId

string CWiggleReader::m_ChromId
protected

◆ m_GapValue

double CWiggleReader::m_GapValue
protected

Definition at line 431 of file wiggle_reader.hpp.

Referenced by CWiggleReader(), xMakeGraph(), xMakeTable(), and xPreprocessValues().

◆ m_OmitZeros

bool CWiggleReader::m_OmitZeros
protected

Definition at line 433 of file wiggle_reader.hpp.

Referenced by xAddValue().

◆ m_SingleAnnot

bool CWiggleReader::m_SingleAnnot
protected

Definition at line 432 of file wiggle_reader.hpp.

◆ m_TrackType

ETrackType CWiggleReader::m_TrackType
protected

Definition at line 440 of file wiggle_reader.hpp.

Referenced by xGetFixedStepInfo(), xGetVariableStepInfo(), and xParseTrackLine().

◆ m_Values

TValues CWiggleReader::m_Values
protected

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