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

Search Toolkit Book for CSrcWriter

Used to generate tables showing qualifier-field entries occuring in the BioSources of instances of Bioseq and Seq-entry. More...

#include <objtools/writers/src_writer.hpp>

+ Inheritance diagram for CSrcWriter:
+ Collaboration diagram for CSrcWriter:

Public Types

typedef map< string, size_t > COLUMNMAP
 
typedef map< string, stringNAMEMAP
 
typedef list< stringNAMELIST
 
typedef vector< stringFIELDS
 
typedef bool(CSrcWriter::* HANDLER) (const CBioSource &, const string &, ILineErrorListener *)
 
typedef map< string, CSrcWriter::HANDLERHANDLERMAP
 
- Public Types inherited from CObject
enum  EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern }
 Control filling of newly allocated memory. More...
 
typedef CObjectCounterLocker TLockerType
 Default locker type for CRef. More...
 
typedef atomic< Uint8TCounter
 Counter type is CAtomiCounter. More...
 
typedef Uint8 TCount
 Alias for value type of counter. More...
 

Public Member Functions

 CSrcWriter (unsigned int flags=0)
 
virtual ~CSrcWriter ()
 
virtual bool WriteBioseqHandle (CBioseq_Handle, const FIELDS &, CNcbiOstream &)
 Write a table of the specified qualifier-field entries found in the BioSource of a given Bioseq. More...
 
virtual bool WriteBioseqHandles (const vector< pair< string, CBioseq_Handle > > &, const FIELDS &, CNcbiOstream &, ILineErrorListener *=nullptr)
 Write a table of the specified qualifier-field entries found in the BioSources of a vector of Bioseqs. More...
 
void SetDelimiter (const string &delimiter)
 Set the column delimiter for the output table. More...
 
virtual bool WriteSeqEntry (const CSeq_entry &, CScope &, CNcbiOstream &, bool=false)
 Write a table of all qualifier-field entries occurring in the BioSources for a given Seq-entry, with columns appearing in a canonical order. More...
 
- Public Member Functions inherited from CObject
 CObject (void)
 Constructor. More...
 
 CObject (const CObject &src)
 Copy constructor. More...
 
virtual ~CObject (void)
 Destructor. More...
 
CObjectoperator= (const CObject &src) THROWS_NONE
 Assignment operator. More...
 
bool CanBeDeleted (void) const THROWS_NONE
 Check if object can be deleted. More...
 
bool IsAllocatedInPool (void) const THROWS_NONE
 Check if object is allocated in memory pool (not system heap) More...
 
bool Referenced (void) const THROWS_NONE
 Check if object is referenced. More...
 
bool ReferencedOnlyOnce (void) const THROWS_NONE
 Check if object is referenced only once. More...
 
void AddReference (void) const
 Add reference to object. More...
 
void RemoveReference (void) const
 Remove reference to object. More...
 
void ReleaseReference (void) const
 Remove reference without deleting object. More...
 
virtual void DoNotDeleteThisObject (void)
 Mark this object as not allocated in heap – do not delete this object. More...
 
virtual void DoDeleteThisObject (void)
 Mark this object as allocated in heap – object can be deleted. More...
 
void * operator new (size_t size)
 Define new operator for memory allocation. More...
 
void * operator new[] (size_t size)
 Define new[] operator for 'array' memory allocation. More...
 
void operator delete (void *ptr)
 Define delete operator for memory deallocation. More...
 
void operator delete[] (void *ptr)
 Define delete[] operator for memory deallocation. More...
 
void * operator new (size_t size, void *place)
 Define new operator. More...
 
void operator delete (void *ptr, void *place)
 Define delete operator. More...
 
void * operator new (size_t size, CObjectMemoryPool *place)
 Define new operator using memory pool. More...
 
void operator delete (void *ptr, CObjectMemoryPool *place)
 Define delete operator. More...
 
virtual void DebugDump (CDebugDumpContext ddc, unsigned int depth) const
 Define method for dumping debug information. More...
 
- Public Member Functions inherited from CDebugDumpable
 CDebugDumpable (void)
 
virtual ~CDebugDumpable (void)
 
void DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const
 
void DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const
 
void DumpToConsole (void) const
 

Static Public Member Functions

static bool ValidateFields (const FIELDS &fields, ILineErrorListener *=nullptr)
 Verify that each string in fields is a valid qualifier name. More...
 
- Static Public Member Functions inherited from CObject
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (void)
 Define method to throw null pointer exception. More...
 
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (const type_info &type)
 
static EAllocFillMode GetAllocFillMode (void)
 
static void SetAllocFillMode (EAllocFillMode mode)
 
static void SetAllocFillMode (const string &value)
 Set mode from configuration parameter value. More...
 
- Static Public Member Functions inherited from CDebugDumpable
static void EnableDebugDump (bool on)
 

Static Public Attributes

static const FIELDS sDefaultSrcCheckFields
 Default fields processed by srcchk application, in their canonical order. More...
 
static const FIELDS sAllSrcCheckFields
 All possible fields processed by srchck application, in their canonical order. More...
 
- Static Public Attributes inherited from CObject
static const TCount eCounterBitsCanBeDeleted = 1 << 0
 Define possible object states. More...
 
static const TCount eCounterBitsInPlainHeap = 1 << 1
 Heap signature was found. More...
 
static const TCount eCounterBitsPlaceMask
 Mask for 'in heap' state flags. More...
 
static const int eCounterStep = 1 << 2
 Skip over the "in heap" bits. More...
 
static const TCount eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2)
 Minimal value for valid objects (reference counter is zero) Must be a single bit value. More...
 
static const TCount eCounterStateMask
 Valid object, and object in heap. More...
 

Protected Member Functions

void xInit ()
 
virtual bool xGather (CBioseq_Handle, string id, const FIELDS &, ILineErrorListener *=nullptr)
 
virtual bool xGatherId (CBioseq_Handle, ILineErrorListener *=nullptr)
 
virtual bool xGatherGi (CBioseq_Handle, ILineErrorListener *=nullptr)
 
virtual bool xGatherLocalId (CBioseq_Handle, ILineErrorListener *=nullptr)
 
virtual bool xGatherBankitId (CBioseq_Handle, ILineErrorListener *=nullptr)
 
virtual bool xGatherDefline (CBioseq_Handle, ILineErrorListener *=nullptr)
 
virtual bool xTryDefaultId (const string &id, ILineErrorListener *=nullptr)
 
virtual bool xHandleSourceField (const CBioSource &, const string &, ILineErrorListener *=nullptr)
 
virtual bool xGatherTaxname (const CBioSource &, const string &, ILineErrorListener *=nullptr)
 
virtual bool xGatherDivision (const CBioSource &, const string &, ILineErrorListener *=nullptr)
 
virtual bool xGatherGenome (const CBioSource &, const string &, ILineErrorListener *=nullptr)
 
virtual bool xGatherOrigin (const CBioSource &, const string &, ILineErrorListener *=nullptr)
 
virtual bool xGatherSubtypeFeat (const CBioSource &, const string &, ILineErrorListener *=nullptr)
 
virtual bool xGatherOrgModFeat (const CBioSource &, const string &, ILineErrorListener *=nullptr)
 
virtual bool xGatherOrgCommon (const CBioSource &, const string &, ILineErrorListener *=nullptr)
 
virtual bool xGatherOrgnameLineage (const CBioSource &, const string &, ILineErrorListener *=nullptr)
 
virtual bool xGatherPcrPrimers (const CBioSource &, const string &, ILineErrorListener *=nullptr)
 
virtual bool xGatherDb (const CBioSource &, const string &, ILineErrorListener *=nullptr)
 
virtual bool xGatherTaxonId (const CBioSource &, const string &, ILineErrorListener *=nullptr)
 
virtual bool xFormatTabDelimited (const FIELDS &, CNcbiOstream &)
 
void xPrepareTableColumn (const string &, const string &, const string &="")
 
void xAppendColumnValue (const string &, const string &)
 
bool xValueNeedsQuoting (const string &)
 
string xDequotedValue (const string &)
 
string xGetColStub (const string &)
 
string xGetOriginalId (const CBioseq_Handle &) const
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 

Static Protected Member Functions

static FIELDS xGetOrderedFieldNames (const FIELDS &)
 
static HANDLER xGetHandler (const string &)
 
static string xPrimerSetNames (const CPCRPrimerSet &)
 
static string xPrimerSetSequences (const CPCRPrimerSet &)
 
static bool xIsSubsourceTypeSuppressed (CSubSource::TSubtype)
 
static bool xIsOrgmodTypeSuppressed (COrgMod::TSubtype)
 
static NAMELIST xGetOrgModSubtypeNames ()
 
static NAMELIST xGetSubSourceSubtypeNames ()
 
static string xCompressFieldName (const string &)
 
static FIELDS xProcessFieldNames (const FIELDS &)
 

Protected Attributes

CRef< CSeq_tablemSrcTable
 
COLUMNMAP mColnameToIndex
 
unsigned int mFlags
 
string mDelimiter
 

Static Protected Attributes

static const FIELDS sDefaultSeqEntryFields
 
static const FIELDS sAllSeqEntryFields
 
static HANDLERMAP sHandlerMap
 
static NAMEMAP sFieldnameToColname
 

Detailed Description

Used to generate tables showing qualifier-field entries occuring in the BioSources of instances of Bioseq and Seq-entry.

Definition at line 70 of file src_writer.hpp.

Member Typedef Documentation

◆ COLUMNMAP

typedef map<string, size_t> CSrcWriter::COLUMNMAP

Definition at line 75 of file src_writer.hpp.

◆ FIELDS

typedef vector<string> CSrcWriter::FIELDS

Definition at line 78 of file src_writer.hpp.

◆ HANDLER

typedef bool(CSrcWriter::* CSrcWriter::HANDLER) (const CBioSource &, const string &, ILineErrorListener *)

Definition at line 79 of file src_writer.hpp.

◆ HANDLERMAP

Definition at line 80 of file src_writer.hpp.

◆ NAMELIST

Definition at line 77 of file src_writer.hpp.

◆ NAMEMAP

Definition at line 76 of file src_writer.hpp.

Constructor & Destructor Documentation

◆ CSrcWriter()

CSrcWriter::CSrcWriter ( unsigned int  flags = 0)
inline

Definition at line 83 of file src_writer.hpp.

References xInit().

◆ ~CSrcWriter()

virtual CSrcWriter::~CSrcWriter ( )
inlinevirtual

Definition at line 90 of file src_writer.hpp.

Member Function Documentation

◆ SetDelimiter()

void CSrcWriter::SetDelimiter ( const string delimiter)
inline

Set the column delimiter for the output table.

Definition at line 111 of file src_writer.hpp.

References delimiter, and mDelimiter.

Referenced by sRunTest(), sUpdateCase(), and CSrcChkApp::xInitWriter().

◆ ValidateFields()

bool CSrcWriter::ValidateFields ( const FIELDS fields,
ILineErrorListener = nullptr 
)
static

◆ WriteBioseqHandle()

bool CSrcWriter::WriteBioseqHandle ( CBioseq_Handle  ,
const FIELDS ,
CNcbiOstream  
)
virtual

Write a table of the specified qualifier-field entries found in the BioSource of a given Bioseq.

Definition at line 146 of file src_writer.cpp.

References out(), xFormatTabDelimited(), xGather(), and xProcessFieldNames().

◆ WriteBioseqHandles()

bool CSrcWriter::WriteBioseqHandles ( const vector< pair< string, CBioseq_Handle > > &  ,
const FIELDS ,
CNcbiOstream ,
ILineErrorListener = nullptr 
)
virtual

Write a table of the specified qualifier-field entries found in the BioSources of a vector of Bioseqs.

Definition at line 165 of file src_writer.cpp.

References out(), xFormatTabDelimited(), xGather(), and xProcessFieldNames().

Referenced by sRunTest(), sUpdateCase(), WriteSeqEntry(), and CSrcChkApp::xTryProcessIdFile().

◆ WriteSeqEntry()

bool CSrcWriter::WriteSeqEntry ( const CSeq_entry seqEntry,
CScope scope,
CNcbiOstream out,
bool  nucsOnly = false 
)
virtual

Write a table of all qualifier-field entries occurring in the BioSources for a given Seq-entry, with columns appearing in a canonical order.

Definition at line 189 of file src_writer.cpp.

References CScope::AddTopLevelSeqEntry(), out(), sAllSeqEntryFields, and WriteBioseqHandles().

Referenced by sRunTest(), sUpdateCase(), and CSrcChkApp::xTryProcessSeqEntry().

◆ xAppendColumnValue()

void CSrcWriter::xAppendColumnValue ( const string colName,
const string colValue 
)
protected

◆ xCompressFieldName()

string CSrcWriter::xCompressFieldName ( const string fieldName)
staticprotected

◆ xDequotedValue()

string CSrcWriter::xDequotedValue ( const string value)
protected

Definition at line 1438 of file src_writer.cpp.

References NStr::Replace(), and value.

Referenced by xFormatTabDelimited().

◆ xFormatTabDelimited()

bool CSrcWriter::xFormatTabDelimited ( const FIELDS ,
CNcbiOstream  
)
protectedvirtual

◆ xGather()

bool CSrcWriter::xGather ( CBioseq_Handle  ,
string  id,
const FIELDS ,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xGatherBankitId()

bool CSrcWriter::xGatherBankitId ( CBioseq_Handle  bsh,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xGatherDb()

bool CSrcWriter::xGatherDb ( const CBioSource src,
const string colName,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xGatherDefline()

bool CSrcWriter::xGatherDefline ( CBioseq_Handle  bsh,
ILineErrorListener = nullptr 
)
protectedvirtual

Definition at line 871 of file src_writer.cpp.

References rapidjson::defaultValue, label, xAppendColumnValue(), and xPrepareTableColumn().

Referenced by xGather().

◆ xGatherDivision()

bool CSrcWriter::xGatherDivision ( const CBioSource src,
const string colName,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xGatherGenome()

bool CSrcWriter::xGatherGenome ( const CBioSource src,
const string colName,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xGatherGi()

bool CSrcWriter::xGatherGi ( CBioseq_Handle  bsh,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xGatherId()

bool CSrcWriter::xGatherId ( CBioseq_Handle  bsh,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xGatherLocalId()

bool CSrcWriter::xGatherLocalId ( CBioseq_Handle  bsh,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xGatherOrgCommon()

bool CSrcWriter::xGatherOrgCommon ( const CBioSource src,
const string colName,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xGatherOrgModFeat()

bool CSrcWriter::xGatherOrgModFeat ( const CBioSource src,
const string colName,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xGatherOrgnameLineage()

bool CSrcWriter::xGatherOrgnameLineage ( const CBioSource src,
const string colName,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xGatherOrigin()

bool CSrcWriter::xGatherOrigin ( const CBioSource src,
const string colName,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xGatherPcrPrimers()

bool CSrcWriter::xGatherPcrPrimers ( const CBioSource src,
const string colName,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xGatherSubtypeFeat()

bool CSrcWriter::xGatherSubtypeFeat ( const CBioSource src,
const string colName,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xGatherTaxname()

bool CSrcWriter::xGatherTaxname ( const CBioSource src,
const string colName,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xGatherTaxonId()

bool CSrcWriter::xGatherTaxonId ( const CBioSource src,
const string colName,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xGetColStub()

string CSrcWriter::xGetColStub ( const string colName)
protected

Definition at line 1376 of file src_writer.cpp.

References NStr::Find(), and NPOS.

Referenced by xFormatTabDelimited().

◆ xGetHandler()

CSrcWriter::HANDLER CSrcWriter::xGetHandler ( const string fieldName)
staticprotected

Definition at line 501 of file src_writer.cpp.

References sHandlerMap.

Referenced by xHandleSourceField().

◆ xGetOrderedFieldNames()

CSrcWriter::FIELDS CSrcWriter::xGetOrderedFieldNames ( const FIELDS )
staticprotected

◆ xGetOrgModSubtypeNames()

CSrcWriter::NAMELIST CSrcWriter::xGetOrgModSubtypeNames ( )
staticprotected

Definition at line 424 of file src_writer.cpp.

References ENUM_METHOD_NAME.

Referenced by xGetOrderedFieldNames(), and xInit().

◆ xGetOriginalId()

string CSrcWriter::xGetOriginalId ( const CBioseq_Handle bsh) const
protected

◆ xGetSubSourceSubtypeNames()

CSrcWriter::NAMELIST CSrcWriter::xGetSubSourceSubtypeNames ( )
staticprotected

Definition at line 441 of file src_writer.cpp.

References ENUM_METHOD_NAME.

Referenced by xGetOrderedFieldNames(), and xInit().

◆ xHandleSourceField()

bool CSrcWriter::xHandleSourceField ( const CBioSource src,
const string fieldName,
ILineErrorListener pEC = nullptr 
)
protectedvirtual

Definition at line 510 of file src_writer.cpp.

References CSrcError::Create(), eDiag_Error, ILineErrorListener::PutError(), and xGetHandler().

Referenced by xGather().

◆ xInit()

void CSrcWriter::xInit ( )
protected

◆ xIsOrgmodTypeSuppressed()

bool CSrcWriter::xIsOrgmodTypeSuppressed ( COrgMod::TSubtype  subtype)
staticprotected

Definition at line 486 of file src_writer.cpp.

References COrgMod_Base::eSubtype_old_name, and COrgMod::IsDiscouraged().

Referenced by xGatherOrgModFeat().

◆ xIsSubsourceTypeSuppressed()

bool CSrcWriter::xIsSubsourceTypeSuppressed ( CSubSource::TSubtype  subtype)
staticprotected

Definition at line 474 of file src_writer.cpp.

References CSubSource::IsDiscouraged().

Referenced by xGatherSubtypeFeat().

◆ xPrepareTableColumn()

void CSrcWriter::xPrepareTableColumn ( const string colName,
const string colTitle,
const string colDefault = "" 
)
protected

◆ xPrimerSetNames()

string CSrcWriter::xPrimerSetNames ( const CPCRPrimerSet pset)
staticprotected

◆ xPrimerSetSequences()

string CSrcWriter::xPrimerSetSequences ( const CPCRPrimerSet pset)
staticprotected

◆ xProcessFieldNames()

CSrcWriter::FIELDS CSrcWriter::xProcessFieldNames ( const FIELDS )
staticprotected

◆ xTryDefaultId()

bool CSrcWriter::xTryDefaultId ( const string id,
ILineErrorListener = nullptr 
)
protectedvirtual

◆ xValueNeedsQuoting()

bool CSrcWriter::xValueNeedsQuoting ( const string value)
protected

Definition at line 1429 of file src_writer.cpp.

References mDelimiter, and value.

Referenced by xFormatTabDelimited().

Member Data Documentation

◆ mColnameToIndex

COLUMNMAP CSrcWriter::mColnameToIndex
protected

Definition at line 187 of file src_writer.hpp.

Referenced by xAppendColumnValue(), xFormatTabDelimited(), and xPrepareTableColumn().

◆ mDelimiter

string CSrcWriter::mDelimiter
protected

Definition at line 189 of file src_writer.hpp.

Referenced by SetDelimiter(), xFormatTabDelimited(), and xValueNeedsQuoting().

◆ mFlags

unsigned int CSrcWriter::mFlags
protected

Definition at line 188 of file src_writer.hpp.

◆ mSrcTable

CRef<CSeq_table> CSrcWriter::mSrcTable
protected

◆ sAllSeqEntryFields

const CSrcWriter::FIELDS CSrcWriter::sAllSeqEntryFields
staticprotected

Definition at line 183 of file src_writer.hpp.

Referenced by WriteSeqEntry().

◆ sAllSrcCheckFields

const CSrcWriter::FIELDS CSrcWriter::sAllSrcCheckFields
static

All possible fields processed by srchck application, in their canonical order.

Definition at line 179 of file src_writer.hpp.

Referenced by CSrcChkApp::Run(), sRunTest(), sUpdateCase(), and CSrcChkApp::xGetDesiredFields().

◆ sDefaultSeqEntryFields

const CSrcWriter::FIELDS CSrcWriter::sDefaultSeqEntryFields
staticprotected

Definition at line 182 of file src_writer.hpp.

◆ sDefaultSrcCheckFields

const CSrcWriter::FIELDS CSrcWriter::sDefaultSrcCheckFields
static

Default fields processed by srcchk application, in their canonical order.

Definition at line 178 of file src_writer.hpp.

Referenced by CSrcChkApp::xGetDesiredFields().

◆ sFieldnameToColname

CSrcWriter::NAMEMAP CSrcWriter::sFieldnameToColname
staticprotected

Definition at line 185 of file src_writer.hpp.

Referenced by ValidateFields(), xInit(), and xProcessFieldNames().

◆ sHandlerMap

CSrcWriter::HANDLERMAP CSrcWriter::sHandlerMap
staticprotected

Definition at line 184 of file src_writer.hpp.

Referenced by xGetHandler(), and xInit().


The documentation for this class was generated from the following files:
Modified on Sat Dec 02 09:24:03 2023 by modify_doxy.py rev. 669887