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

Search Toolkit Book for CFeature_table_reader

#include <objtools/readers/readfeat.hpp>

+ Inheritance diagram for CFeature_table_reader:
+ Collaboration diagram for CFeature_table_reader:

Public Types

enum  EFlags {
  fReportBadKey = (1<<0) , fKeepBadKey = (1<<1) , fTranslateBadKey = (1<<2) , fIgnoreWebComments = (1<<3) ,
  fCreateGenesFromCDSs = (1<<4) , fCDSsMustBeInTheirGenes = (1<<5) , fReportDiscouragedKey = (1<<6) , fLeaveProteinIds = (1<<7) ,
  fAllIdsAsLocal = (1<<8) , fPreferGenbankId = (1<<9) , fSuppressBadKeyWarning = (1<<10)
}
 Some flags that control feature table generation. More...
 
using TFlags = long
 binary OR of EFlags More...
 
using TAnnots = CReaderBase::TAnnots
 
- 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

 CFeature_table_reader (TReaderFlags fReaderFlags=0)
 
 CFeature_table_reader (ILineReader &lr, ILineErrorListener *pErrors=nullptr)
 
 ~CFeature_table_reader ()
 
CRef< CSerialObjectReadObject (ILineReader &lr, ILineErrorListener *pErrors) override
 Read an object from a given line reader, render it as the most appropriate Genbank object. More...
 
CRef< CSeq_annotReadSeqAnnot (ILineReader &lr, ILineErrorListener *pErrors) override
 Read an object from a given line reader, render it as a single Seq-annot, if possible. More...
 
CRef< CSeq_annotReadSequinFeatureTable (const TFlags flags=0, ITableFilter *filter=nullptr, const string &seqid_prefix=kEmptyStr)
 
- 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< 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
 

Static Public Member Functions

static void AddStringFlags (const list< string > &stringFlags, TFlags &baseFlags)
 
static CRef< CSeq_annotReadSequinFeatureTable (ILineReader &reader, const TFlags flags=0, ILineErrorListener *pMessageListener=nullptr, ITableFilter *filter=nullptr, const string &seqid_prefix=kEmptyStr)
 
static CRef< CSeq_annotReadSequinFeatureTable (CNcbiIstream &ifs, const TFlags flags=0, ILineErrorListener *pMessageListener=nullptr, ITableFilter *filter=nullptr)
 
static CRef< CSeq_annotReadSequinFeatureTable (ILineReader &reader, const string &seqid, const string &annotname, const TFlags flags=0, ILineErrorListener *pMessageListener=nullptr, ITableFilter *filter=nullptr)
 
static CRef< CSeq_annotReadSequinFeatureTable (CNcbiIstream &ifs, const string &seqid, const string &annotname, const TFlags flags=0, ILineErrorListener *pMessageListener=nullptr, ITableFilter *filter=nullptr)
 
static void ReadSequinFeatureTables (ILineReader &reader, CSeq_entry &entry, const TFlags flags=0, ILineErrorListener *pMessageListener=nullptr, ITableFilter *filter=nullptr)
 
static void ReadSequinFeatureTables (CNcbiIstream &ifs, CSeq_entry &entry, const TFlags flags=0, ILineErrorListener *pMessageListener=nullptr, ITableFilter *filter=nullptr)
 
static CRef< CSeq_featCreateSeqFeat (const string &feat, CSeq_loc &location, const TFlags flags=0, ILineErrorListener *pMessageListener=nullptr, unsigned int line=0, std::string *seq_id=nullptr, ITableFilter *filter=nullptr)
 
static void AddFeatQual (CRef< CSeq_feat > sfp, const string &feat_name, const string &qual, const string &val, const TFlags flags=0, ILineErrorListener *pMessageListener=nullptr, int line=0, const string &seq_id=std::string())
 
static bool ParseInitialFeatureLine (const CTempString &line_arg, CTempStringEx &out_seqid, CTempStringEx &out_annotname)
 If line_arg is a feature line (e.g. More...
 
- 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...
 

Static Private Member Functions

static CRef< CSeq_annotx_ReadFeatureTable (CFeatureTableReader_Imp &reader, const CTempString &seqid, const CTempString &annot_name, const TFlags flags, ITableFilter *filter)
 
static CRef< CSeq_annotx_ReadFeatureTable (CFeatureTableReader_Imp &reader, const TFlags flags, ITableFilter *filter, const string &seqid_prefix=kEmptyStr)
 

Private Attributes

unique_ptr< CFeatureTableReader_Impm_pImpl
 

Additional Inherited Members

- Public Attributes inherited from CReaderBase
unsigned int mLine
 
string mData
 
- 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 xGetData (ILineReader &, TReaderData &)
 
virtual void xProcessData (const TReaderData &, CSeq_annot &)
 
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 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 &)
 
- Static Protected Member Functions inherited from CReaderBase
static void xAddStringFlagsWithMap (const list< string > &stringFlags, const map< string, TReaderFlags > flagMap, TReaderFlags &baseFlags)
 
- 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
 

Detailed Description

Definition at line 58 of file readfeat.hpp.

Member Typedef Documentation

◆ TAnnots

Definition at line 92 of file readfeat.hpp.

◆ TFlags

binary OR of EFlags

Definition at line 79 of file readfeat.hpp.

Member Enumeration Documentation

◆ EFlags

Some flags that control feature table generation.

Note that "bad key" could mean many different conditions, from unrecognized feature name to qualifier without a feature, and so on.

Enumerator
fReportBadKey 

= 0x01 (Report bad keys into the error container)

fKeepBadKey 

= 0x02 (As much as possible, try to use bad keys as if they were acceptable)

fTranslateBadKey 

= 0x04 (yields misc_feature /standard_name="...")

fIgnoreWebComments 

= 0x08 (ignore web comment lines such as lines that start with " INFO:", or consist of many equals signs)

fCreateGenesFromCDSs 

= 0x10 (If a CDS has a gene xref, create a gene with the same intervals if one doesn't already exist.)

fCDSsMustBeInTheirGenes 

= 0x20 (If a CDS has a gene xref, it *must* be inside of that gene)

fReportDiscouragedKey 

= 0x40 (Report discouraged keys into the error container)

fLeaveProteinIds 

= 0x80 (Leave all protein_id as a qualifiers)

fAllIdsAsLocal 

= 0x100 (Do not attempt to parse accessions)

fPreferGenbankId 

= 0x200 (Prefer Genbank accession ids)

fSuppressBadKeyWarning 

= 0x400 (Suppress 'bad key' errors; Not recommended.)

Definition at line 64 of file readfeat.hpp.

Constructor & Destructor Documentation

◆ CFeature_table_reader() [1/2]

CFeature_table_reader::CFeature_table_reader ( TReaderFlags  fReaderFlags = 0)

Definition at line 3582 of file readfeat.cpp.

◆ CFeature_table_reader() [2/2]

CFeature_table_reader::CFeature_table_reader ( ILineReader lr,
ILineErrorListener pErrors = nullptr 
)

Definition at line 3588 of file readfeat.cpp.

◆ ~CFeature_table_reader()

CFeature_table_reader::~CFeature_table_reader ( )

Definition at line 3856 of file readfeat.cpp.

Member Function Documentation

◆ AddFeatQual()

void CFeature_table_reader::AddFeatQual ( CRef< CSeq_feat sfp,
const string feat_name,
const string qual,
const string val,
const TFlags  flags = 0,
ILineErrorListener pMessageListener = nullptr,
int  line = 0,
const string seq_id = std::string() 
)
static

Definition at line 3830 of file readfeat.cpp.

References flags, and val.

Referenced by CGFFReader::x_ParseFeatRecord().

◆ AddStringFlags()

void CFeature_table_reader::AddStringFlags ( const list< string > &  stringFlags,
TFlags baseFlags 
)
static

◆ CreateSeqFeat()

CRef< CSeq_feat > CFeature_table_reader::CreateSeqFeat ( const string feat,
CSeq_loc location,
const TFlags  flags = 0,
ILineErrorListener pMessageListener = nullptr,
unsigned int  line = 0,
std::string seq_id = nullptr,
ITableFilter filter = nullptr 
)
static

Definition at line 3815 of file readfeat.cpp.

References flags, and location.

Referenced by CGFFReader::x_ParseFeatRecord().

◆ ParseInitialFeatureLine()

bool CFeature_table_reader::ParseInitialFeatureLine ( const CTempString line_arg,
CTempStringEx out_seqid,
CTempStringEx out_annotname 
)
static

If line_arg is a feature line (e.g.

">Feature lcl|seq1"), then it will parse it and return true.

Parameters
line_argThe input line that will be parsed.
out_seqidIf returning true, this will hold the seqid of line_arg (or empty if there is none)
out_annotnameIf returning true, this will hold the annotname of line_arg (or empty if there is none)
Returns
True if it is a feature line and false if it's not.

Definition at line 3847 of file readfeat.cpp.

References CFeatureTableReader_Imp::ParseInitialFeatureLine().

Referenced by x_ReadFeatureTable().

◆ ReadObject()

CRef< CSerialObject > CFeature_table_reader::ReadObject ( ILineReader lr,
ILineErrorListener pErrors 
)
overridevirtual

Read an object from a given line reader, render it as the most appropriate Genbank object.

This will be Seq-annot by default but may be something else (Bioseq, Seq-entry, ...) in derived classes. This is the only function that does not come with a default implementation. That is, an implementation must be provided in the derived class.

Parameters
lrline reader to read from.
pErrorspointer to optional error container object.

Reimplemented from CReaderBase.

Definition at line 3596 of file readfeat.cpp.

References ReadSeqAnnot().

◆ ReadSeqAnnot()

CRef< CSeq_annot > CFeature_table_reader::ReadSeqAnnot ( ILineReader lr,
ILineErrorListener pErrors 
)
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 3606 of file readfeat.cpp.

References CReaderBase::m_iFlags, and ReadSequinFeatureTable().

Referenced by ReadObject(), sRunTest(), sUpdateCase(), and CMultiReaderApp::xProcess5ColFeatTable().

◆ ReadSequinFeatureTable() [1/5]

CRef< CSeq_annot > CFeature_table_reader::ReadSequinFeatureTable ( CNcbiIstream ifs,
const string seqid,
const string annotname,
const TFlags  flags = 0,
ILineErrorListener pMessageListener = nullptr,
ITableFilter filter = nullptr 
)
static

Definition at line 3613 of file readfeat.cpp.

References flags, and ReadSequinFeatureTable().

◆ ReadSequinFeatureTable() [2/5]

CRef< CSeq_annot > CFeature_table_reader::ReadSequinFeatureTable ( CNcbiIstream ifs,
const TFlags  flags = 0,
ILineErrorListener pMessageListener = nullptr,
ITableFilter filter = nullptr 
)
static

Definition at line 3650 of file readfeat.cpp.

References flags, and ReadSequinFeatureTable().

◆ ReadSequinFeatureTable() [3/5]

CRef< CSeq_annot > CFeature_table_reader::ReadSequinFeatureTable ( const TFlags  flags = 0,
ITableFilter filter = nullptr,
const string seqid_prefix = kEmptyStr 
)

◆ ReadSequinFeatureTable() [4/5]

CRef< CSeq_annot > CFeature_table_reader::ReadSequinFeatureTable ( ILineReader reader,
const string seqid,
const string annotname,
const TFlags  flags = 0,
ILineErrorListener pMessageListener = nullptr,
ITableFilter filter = nullptr 
)
static

Definition at line 3626 of file readfeat.cpp.

References flags.

◆ ReadSequinFeatureTable() [5/5]

CRef< CSeq_annot > CFeature_table_reader::ReadSequinFeatureTable ( ILineReader reader,
const TFlags  flags = 0,
ILineErrorListener pMessageListener = nullptr,
ITableFilter filter = nullptr,
const string seqid_prefix = kEmptyStr 
)
static

Definition at line 3702 of file readfeat.cpp.

References flags, and x_ReadFeatureTable().

◆ ReadSequinFeatureTables() [1/2]

void CFeature_table_reader::ReadSequinFeatureTables ( CNcbiIstream ifs,
CSeq_entry entry,
const TFlags  flags = 0,
ILineErrorListener pMessageListener = nullptr,
ITableFilter filter = nullptr 
)
static

Definition at line 3725 of file readfeat.cpp.

References flags, and ReadSequinFeatureTables().

◆ ReadSequinFeatureTables() [2/2]

void CFeature_table_reader::ReadSequinFeatureTables ( ILineReader reader,
CSeq_entry entry,
const TFlags  flags = 0,
ILineErrorListener pMessageListener = nullptr,
ITableFilter filter = nullptr 
)
static

◆ x_ReadFeatureTable() [1/2]

CRef< CSeq_annot > CFeature_table_reader::x_ReadFeatureTable ( CFeatureTableReader_Imp reader,
const CTempString seqid,
const CTempString annot_name,
const TFlags  flags,
ITableFilter filter 
)
staticprivate

◆ x_ReadFeatureTable() [2/2]

CRef< CSeq_annot > CFeature_table_reader::x_ReadFeatureTable ( CFeatureTableReader_Imp reader,
const TFlags  flags,
ITableFilter filter,
const string seqid_prefix = kEmptyStr 
)
staticprivate

Member Data Documentation

◆ m_pImpl

unique_ptr<CFeatureTableReader_Imp> CFeature_table_reader::m_pImpl
private

Definition at line 191 of file readfeat.hpp.

Referenced by ReadSequinFeatureTable().


The documentation for this class was generated from the following files:
Modified on Wed Apr 24 14:20:18 2024 by modify_doxy.py rev. 669887