69 const string& commentID)
75 string(
"Structured comment for \"") +
77 "\" could not be matched to any input sequence.";
119 if (bioseq && !bioseq->
IsNa())
127 matchedCommentIds.
insert(comment.m_id);
133 auto id = comment.m_id;
134 if (!
id || matchedCommentIds.
find(
id) == matchedCommentIds.
end()) {
135 string commentId(
"[Unrecognized SeqID]");
136 if (
id && id->IsLocal() && id->GetLocal().IsStr()) {
137 commentId = comment.m_id->GetLocal().GetStr();
147 for (
const auto& new_desc : comments.m_descs)
149 bool append_desc =
true;
154 for (
auto& desc : descr.
Set())
156 if (!desc->IsUser())
continue;
158 auto& user = desc->SetUser();
167 for (
const auto& field : new_desc->GetUser().GetData())
169 user.SetFieldRef(field->GetLabel().GetStr())->SetValue(field->GetData().GetStr());
176 add_desc->Assign(*new_desc);
177 descr.
Set().push_back(add_desc);
183 CSeq_entry& entry,
const CStructComment& comments)
185 bool matchFound(
false);
191 if (comments.m_id.NotEmpty())
193 bool matched = false;
194 for (const auto& id : bioseq.GetId())
196 if (CStructuredCommentsReader::SeqIdMatchesCommentId(*id, *comments.m_id))
216 for (
auto& desc : comments.
m_descs) {
217 string prefix, suffix;
218 const auto& user = desc->GetUser();
219 for (
const auto&
data : user.GetData()) {
220 if (
data->IsSetLabel() &&
data->GetLabel().IsStr()) {
221 const string&
label =
data->GetLabel().GetStr();
222 if (
label ==
"StructuredCommentPrefix") {
223 prefix =
data->GetData().GetStr();
225 else if (
label ==
"StructuredCommentSuffix") {
226 suffix =
data->GetData().GetStr();
230 if (!prefix.empty() && suffix.empty()) {
231 desc->SetUser().AddField(
"StructuredCommentSuffix", prefix);
244 vector<CTempString> values;
246 vert = values.size()<=2;
User-defined methods of the data storage class.
static CLineErrorEx * Create(EProblem eProblem, EDiagSev eSeverity, int code, int subcode, const std::string &strSeqId, unsigned int uLine, const std::string &strErrorMessage=string(""), const std::string &strFeatureName=string(""), const std::string &strQualifierName=string(""), const std::string &strQualifierValue=string(""), const TVecOfLines &vecOfOtherLines=TVecOfLines())
Use this because the constructor is protected.
@Seq_descr.hpp User-defined methods of the data storage class.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
virtual bool PutError(const ILineError &)=0
Store error in the container, and return true if error was stored fine, and return false if the calle...
@ eProblem_GeneralParsingError
Abstract base class for lightweight line-by-line reading.
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
@ eDiag_Warning
Warning message.
CTempString GetCurrentLine(void) const
static CRef< ILineReader > New(const string &filename)
Return a new ILineReader object corresponding to the given filename, taking "-" (but not "....
virtual void UngetLine(void)=0
Unget current line, which must be valid.
virtual bool AtEOF(void) const =0
Indicates (negatively) whether there is any more input.
@ fParse_AnyLocal
Treat otherwise unidentified strings as local accessions as long as they don't resemble FASTA-style I...
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Test for equality of a substring with another string.
static const char label[]
void SetDescr(TDescr &value)
Assign a value to Descr data member.
Tdata & Set(void)
Assign a value to data member.
if(yy_accept[yy_current_state])
Lightweight interface for getting lines of data with minimal memory copying.
void VisitAllSeqDesc(objects::CSeq_entry &entry, bool skip_nucprot, _M m)
void VisitAllBioseqs(objects::CSeq_entry &entry, _M &&m)
static void sReportUnappliedStructuredComment(ILineErrorListener *pEC, const string &commentID)