135 int textComparison = 0;
141 const SIZE_TYPE min_length =
min( str1.length(), str2.length() );
142 for( ; pos < min_length; ++pos ) {
144 if( textComparison != 0 ) {
148 if( 0 == textComparison ) {
150 textComparison = str1.length() - str2.length();
154 if( textComparison < 0 ) {
156 }
else if( textComparison > 0 ) {
166 }
else if( 0 == pmid2 ) {
169 return pmid1 < pmid2;
178 return id.IsGenbank() ||
id.IsEmbl() ||
id.IsDdbj() ||
179 id.IsOther() ||
id.IsPatent() ||
180 id.IsTpg() ||
id.IsTpe() ||
id.IsTpd() ||
186 const string &s1,
const string &s2,
189 if( s1.empty() || s2.empty() ) {
190 return s1.empty() && s2.empty();
194 size_t s1_len = s1.length();
195 if( s1[s1_len-1] ==
'.' ) {
198 size_t s2_len = s2.length();
199 if( s2[s2_len-1] ==
'.' ) {
203 if( s1_len != s2_len ) {
209 for(
size_t ii = 0; ii < s1_len ; ++ii ) {
223 if ( !
ctx.Config().CheckCDSProductId() ) {
231 if ( !pseudo && !
ctx.IsEMBL() && !
ctx.IsDDBJ() ) {
242 if (! pseudo && grp) {
247 bool just_stop =
false;
255 if ( pseudo || just_stop ) {
274 if (tsip && tsip->IsSetAccession() &&
282 if (
ctx.Config().IsModeRelease()) {
293 if (tsip && tsip->IsSetAccession() &&
303 "rearrangement required for product") !=
NPOS) {
317 if ((*it)->Matches(feat.
GetCit())) {
346 if (
ctx.IsRefSeq() &&
368 (!gene.
GetSyn().empty() && !gene.
GetSyn().front().empty()) ) {
400 return ! feat.
GetNamedQual(
"estimated_length").empty() &&
597 return( !
isdigit(ch) && ch !=
'.' && ch !=
'-' );
610 if ( ec_number.empty() )
return false;
612 bool is_ambig =
false;
617 ITERATE(
string, ec_iter, ec_number ) {
620 if (is_ambig)
return false;
621 }
else if (*ec_iter ==
'-' ) {
624 }
else if( *ec_iter ==
'n') {
625 string::const_iterator ec_iter_next = ec_iter;
627 if( ec_iter_next != ec_number.end() && numperiods == 3 && numdigits == 0 &&
isdigit(*ec_iter_next) ) {
633 }
else if (*ec_iter ==
'.') {
635 if (numdigits > 0 && numdashes > 0)
return false;
636 if (numdigits == 0 && numdashes == 0)
return false;
637 if (numdashes > 1)
return false;
643 if (numperiods == 3) {
644 if (numdigits > 0 && numdashes > 0)
return false;
645 if (numdigits > 0 || numdashes == 1)
return true;
654 static const string kOther =
"unclassified";
667 bool hasSubstantiveNote =
false;
669 const string::size_type original_length = note.length();
673 const string& qual = (*it)->GetValue();
676 if ( !note.empty() ) {
677 prefix = punctuation;
678 const string& next_prefix = (*it)->GetPrefix();
680 prefix += next_prefix;
684 if( !qual.empty() && qual !=
"." ) {
685 hasSubstantiveNote =
true;
690 const bool noRedundancyThisIteration =
692 JoinString(note, prefix, qual, noRedundancyThisIteration );
694 addPeriod = (*it)->GetAddPeriod();
695 punctuation = (*it)->GetSuffix();
699 if( ! hasSubstantiveNote ) {
700 note.resize( original_length );
711 if (!noteStr.empty()) {
721 flatFeature.
SetQuals().push_back(note);
728 int total_length = 0;
730 total_length += loc_iter.GetRange().GetLength();
751 int best_overlap = 0;
753 for (
CFeat_CI it(seq, sel); it; ++it) {
766 if ( best_overlap < current_overlap ) {
768 best_overlap = current_overlap;
769 best_processed = current_processed;
772 }
else if ( (best_overlap == current_overlap) && (best_processed > current_processed) ) {
774 best_processed = current_processed;
796 if (
ctx.Config().IsFormatFTable() ) {
812 const string& imploc = imp.
GetLoc();
813 if ( imploc.find(
'<') !=
NPOS || imploc.find(
'>') !=
NPOS ) {
819 const CSeq_loc&
l = it.GetEmbeddingSeq_loc();
820 switch (
l.Which() ) {
823 if (
l.GetPnt().IsSetFuzz() ) {
832 if (
l.GetPacked_pnt().IsSetFuzz() ) {
842 if (
l.GetInt().IsSetFuzz_from() ) {
845 if ( !fuzz &&
l.GetInt().IsSetFuzz_to() ) {
876 if( !
str.empty() ) {
890 if( string_to_split.empty() ) {
895 if( string_to_split[0] !=
'(' ) {
896 output_vec.push_back( string_to_split );
903 size_t amount_to_chop_off_end = 0;
904 if( string_to_split[string_to_split.length() - 1] ==
')' ) {
905 amount_to_chop_off_end = 1;
908 NStr::Split( string_to_split.substr( 1, string_to_split.length() - amount_to_chop_off_end - 1),
",", output_vec, 0 );
925 case objects::CFlatFileConfig::eMode_Release:
926 case objects::CFlatFileConfig::eMode_Entrez:
927 return sc_ValidPseudoGeneText.find(
text.c_str()) != sc_ValidPseudoGeneText.end();
929 return !
text.empty();
934 "annotated by transcript or proteomic data",
935 "rearrangement required for product",
936 "reasons given in citation",
944 return sc_LegalExceptText.find(
text.c_str()) != sc_LegalExceptText.end();
949 "adjusted for low-quality genome",
950 "alternative processing",
951 "alternative start codon",
952 "artificial frameshift",
954 "mismatches in transcription",
955 "mismatches in translation",
956 "modified codon recognition",
957 "nonconsensus splice site",
958 "transcribed product replaced",
959 "transcribed pseudogene",
960 "translated product replaced",
961 "unclassified transcription discrepancy",
962 "unclassified translation discrepancy",
963 "unextendable partial coding region"
970 return sc_LegalRefSeqExceptText.find(
text.c_str()) != sc_LegalRefSeqExceptText.end();
980 bool suppressAccession) :
981 CFlatItem(&
ctx), m_Feat(feat), m_Feat_Tree(ftree), m_Loc(loc ? loc :
982 (feat ? &feat.GetLocation() :
nullptr)),
983 m_SuppressAccession(suppressAccession)
1028 switch ( subtype ) {
1039 switch ( subtype ) {
1048 if ( !
ctx.IsRefSeq() ) {
1049 return "misc_feature";
1057 return "misc_feature";
1073 switch ( subtype ) {
1086 return "regulatory";
1103 bool suppressAccession,
1134 if ( !
ctx.Config().HideUnclassPartial() ) {
1170 const string& operon_name = operon->
GetNamedQual(
"operon" );
1171 if ( !operon_name.empty() ) {
1186 switch ( subtype ) {
1244 if (
ctx.Config().DropIllegalQuals() &&
1290 string precursor_comment;
1299 if( best_prot_feat && best_prot_feat.
IsSetComment() ) {
1300 precursor_comment = best_prot_feat.
GetComment() ;
1310 if ( ! comment.empty() && comment !=
"~" && comment != precursor_comment) {
1318 seqfeat_note->SetAddPeriod();
1325 if( !
ctx.ShowAnnotCommentAsCOMMENT() ) {
1329 if ((*it)->IsComment()) {
1330 const string & comment = (*it)->GetComment();
1332 const static string ktRNAscanSE =
"tRNA features were annotated by tRNAscan-SE";
1340 string comm = comment;
1376 switch(
data.GetSubtype() ) {
1406 string raw_exception;
1412 if ( raw_exception ==
"" ) {
1416 const bool bIsRefseq =
ctx.IsRefSeq();
1418 const bool bIsRelaxed = ((!
ctx.Config().IsModeRelease()) && (!
ctx.Config().IsModeEntrez()));
1420 list<string> exceptions;
1423 list<string> output_exceptions;
1424 list<string> output_notes;
1425 ITERATE( list<string>, it, exceptions ) {
1437 if( bIsRefseq || bIsRelaxed ||
data.IsCdregion() ) {
1438 output_exceptions.push_back( cur );
1440 output_notes.push_back( cur );
1445 if( bIsRefseq || bIsRelaxed ) {
1446 output_exceptions.push_back( cur );
1448 output_notes.push_back( cur );
1453 if(
data.IsCdregion() ) {
1456 output_notes.push_back( cur );
1464 output_notes.push_back( cur );
1469 if(
data.IsRna() ||
data.IsCdregion() ) {
1472 output_notes.push_back( cur );
1476 const bool is_cds_or_mrna = (
data.IsCdregion() ||
1479 if( is_cds_or_mrna ) {
1482 output_notes.push_back( cur );
1489 if( is_cds_or_mrna ) {
1492 output_notes.push_back( cur );
1498 output_exceptions.push_back( cur );
1501 output_notes.push_back( cur );
1505 if ( ! output_exceptions.empty() ) {
1506 string exception =
NStr::Join( output_exceptions,
", " );
1509 if ( ! output_notes.empty() ) {
1510 string note =
NStr::Join( output_notes,
", " );
1537 if ( ! gene_ref && gene_feat ) {
1539 if (gene_ref && gene_ref->
IsSetDb()) {
1558 if ( ! gene_feat ) {
1562 if (
ctx.IsProt() ) {
1572 for (
size_t iPos = 0; iPos < quals.size(); ++iPos ) {
1577 if ( qual->
GetQual() ==
"old_locus_tag" ) {
1594 bool pseudo = m_Feat.IsSetPseudo() ? m_Feat.GetPseudo() :
false;
1599 if ( gene_feat && gene_feat->IsSetPseudo() && gene_feat->GetPseudo() ) {
1601 const CGene_ref* altref = &gene_feat->GetData().GetGene();
1606 if ( gene_ref && gene_ref->IsSetPseudo() && gene_ref->GetPseudo() ) {
1611 if (
data.GetGene().IsSetPseudo() &&
data.GetGene().GetPseudo() ) {
1616 if (
data.GetRna().IsSetPseudo() &&
data.GetRna().GetPseudo() ) {
1637 bool is_not_genbank =
false;
1640 const CSeq_id&
id = **id_iter;
1642 switch (
id.Which() ) {
1647 is_not_genbank =
true;
1658 const CGene_ref* feat_gene_xref =
nullptr;
1660 if (! feat_gene_xref && parentFeatureItem) {
1661 feat_gene_xref = parentFeatureItem->GetFeat().GetGeneXref();
1663 bool suppressed =
false;
1665 const bool gene_forbidden_if_genbank =
1673 (is_not_genbank || ! gene_forbidden_if_genbank)) {
1674 if (feat_gene_xref) {
1680 if (feat_gene_xref && ! suppressed) {
1685 if (parentFeatureItem) {
1709 gene_ref = feat_gene_xref;
1717 gene_ref = feat_gene_xref;
1721 gene_ref = feat_gene_xref;
1727 gene_ref = feat_gene_xref;
1731 gene_ref = feat_gene_xref;
1733 }
else if ((! feat_gene_xref || ! suppressed) &&
1736 bool is_mapped =
false;
1737 if (parentFeatureItem) {
1748 if ( feat_gene_xref ) {
1749 gene_ref = feat_gene_xref;
1767 parent_feat_handle = parentFeatureItem->GetFeat();
1769 gene_feat, parent_feat_handle );
1785 ftree->AddGenesForFeat(
m_Feat,
ctx.GetAnnotSelector());
1796 if (ft && (! is_mapped)) {
1804 }
else if (feat_gene_xref) {
1806 gene_ref = feat_gene_xref;
1813 if (
ctx.IsEMBL() ||
ctx.IsDDBJ() ) {
1916 if (
ctx.Config().IsFormatFTable() ) {
1921 if (
ctx.UsingSeqEntryIndex() ) {
1945 bool is_not_genbank =
false;
1948 const CSeq_id&
id = **id_iter;
1950 switch (
id.Which() ) {
1955 is_not_genbank =
true;
1967 bool suppressed =
false;
1969 const bool gene_forbidden_if_genbank =
1977 (is_not_genbank || ! gene_forbidden_if_genbank)) {
1978 if (feat_gene_xref) {
1983 if (feat_gene_xref && ! suppressed &&
1985 gene_ref = feat_gene_xref;
1986 }
else if ((! feat_gene_xref || ! suppressed) &&
1989 bool is_mapped =
false;
2012 if( parentFeatureItem ) {
2013 parent_feat_handle = parentFeatureItem->GetFeat();
2015 gene_feat, parent_feat_handle );
2144 vector<char>
n(1,
static_cast<char>(aa));
2213 switch ( rna_type ) {
2219 string transcription;
2223 if (
rna.IsSetExt()) {
2225 switch (ext.
Which()) {
2248 const string& aa_str =
s_AaName(aa);
2249 string amino_acid_str = aa_str;
2251 if ( !aa_str.empty() ) {
2252 const string& ac_str = aa_str;
2255 if (!gbqual->IsSetQual() || !gbqual->IsSetVal())
continue;
2258 amino_acid_str =
"tRNA-fMet";
2261 amino_acid_str =
"tRNA-iMet";
2266 if (!gbqual->IsSetQual() || !gbqual->IsSetVal())
continue;
2269 amino_acid_str =
"tRNA-Ile2";
2277 ac_str.substr(5,
NPOS)));
2281 const string& comment =
2300 string transcription;
2307 switch ( subtype ) {
2310 if ( !
rna.IsSetExt() ) {
2314 if ( ! ext.
IsGen() ) {
2320 if ( !
rna.IsSetExt() ) {
2326 const list< CRef< CRNA_qual > >& quals = ext.
GetGen().
GetQuals().Get();
2327 list< CRef< CRNA_qual > >::const_iterator it = quals.
begin();
2328 for ( ; it != quals.end(); ++it ) {
2329 if ( (*it)->IsSetQual() && (*it)->IsSetVal() ) {
2330 if ( (*it)->GetQual() ==
"tag_peptide" ) {
2343 if ( !
rna.IsSetExt() ) {
2348 string strName = ext.
GetName();
2349 if ( strName !=
"misc_RNA" ) {
2356 if (
rna.IsSetExt() &&
rna.GetExt().IsName() ) {
2364 if(
rna.IsSetExt() &&
rna.GetExt().IsGen() ) {
2366 if (
gen.IsSetClass() ) {
2367 if (
gen.IsLegalClass()) {
2402 translation,
false );
2420 translation.clear();
2439 if ( gcode == 255 ) {
2442 if (
ctx.Config().IsFormatGBSeq() ||
ctx.Config().IsFormatINSDSeq() || gcode > 1 ) {
2484 }
else if (inset == 2) {
2526 }
else if ( tr_ex.length() > 0 ) {
2538 static const string conflict_msg =
2539 "Protein sequence is in conflict with the conceptual translation";
2546 bool has_prot =
false;
2563 if (
ctx.IsProt() ) {
2573 if ( ! protHandle ) {
2595 if ( ! protHandle ) {
2729 const CSeq_id & seqid = **seqid_ci;
2732 pTheOneUsableGeneralSeqId.
Reset();
2739 static const char*
const sc_IgnoredDbs[] = {
2753 stringstream sTagStrm;
2756 sTagStrm.str().swap(sTag);
2759 if( ! sDb.empty() && ! sTag.empty() &&
2760 sc_IgnoredDbSet.find(sDb.c_str()) == sc_IgnoredDbSet.end() )
2762 if( pTheOneUsableGeneralSeqId ) {
2764 pTheOneUsableGeneralSeqId.
Reset();
2767 pTheOneUsableGeneralSeqId = *seqid_ci;
2774 const CSeq_id & seqid = **seqid_ci;
2776 switch( seqid.
Which() ) {
2782 eLastRegularChoice = seqid.
Which();
2800 if( *seqid_ci == pTheOneUsableGeneralSeqId ) {
2810 }
else if( protId ) {
2816 if ( protId->
IsGi() ) {
2817 gi = protId->
GetGi();
2845 if( ! prot_acc.empty() ) {
2878 if ( !
names.empty() ) {
2882 if (
names.size() > 1 ) {
2900 if ( !protRef || !protRef->
IsSetDesc() ) {
2904 string desc = protRef->
GetDesc();
2909 prot_desc->SetAddPeriod();
2919 if ( !protRef || protRef->
GetActivity().empty() ) {
2933 if ( !protRef || !protRef->
IsSetEc() || protRef->
GetEc().empty() ) {
2958 if (
ctx.IsEMBL() ||
ctx.IsDDBJ() ) {
2973 if ( !
ctx.GetLocation().IsWhole()) {
2974 if (bsploc.
IsInt()) {
2979 int pos = bspint.
GetTo();
3005 inset = (inset % 3);
3012 for (
auto& gbqual : cds.
GetQual()) {
3013 if (!gbqual->IsSetQual() || !gbqual->IsSetVal())
continue;
3015 tr_ex = gbqual->GetVal ();
3108 (
const_cast<CSeq_id*
>(
id.GetPointer()));
3124 switch( (*it).Which() ) {
3141 return tracker.GetBestChoice();
3172 if( id_iter->IsGi() ) {
3192 const string ®ion =
data.GetRegion();
3193 if ( region.empty() ) {
3197 if (
ctx.IsProt() &&
3206 list< CConstRef<CUser_object> > objs;
3212 back_inserter(objs));
3251 x_AddQual(eFQ_region,
3252 new CFlatStringQVal(f->GetData().GetStr()));
3280 if ( (
ctx.IsGenbankFormat() ||
ctx.Config().IsFormatGBSeq() ||
ctx.Config().IsFormatINSDSeq() ) &&
ctx.IsProt() ) {
3355 variation.GetData().GetInstance().CanGetDelta() ) {
3358 if( *delta_iter && (*delta_iter)->CanGetSeq() ) {
3373 const string::size_type max_len_allowed = seq_literal.
GetLength();
3374 if( nucleotides.size() > max_len_allowed ) {
3375 nucleotides.resize( max_len_allowed );
3391 static const string kOther =
"other";
3392 static const string kDnaBinding =
"DNA binding";
3393 static const string kInhibit =
"inhibition";
3420 if ( (
ctx.Config().IsFormatGenbank() ||
3421 ctx.Config().IsFormatGBSeq() ||
3422 ctx.Config().IsFormatINSDSeq()) &&
ctx.IsProt() ) {
3439 if ( oid ==
"ModelEvidence" ) {
3447 }
else if ( oid ==
"Process" || oid ==
"Component" || oid ==
"Function" ) {
3479 if ( oid ==
"ModelEvidence" ) {
3487 }
else if ( oid ==
"GeneOntology" ) {
3504 if ( ! ids.empty() ) {
3531 if (
label ==
"Process" ) {
3533 }
else if (
label ==
"Component" ) {
3535 }
else if (
label ==
"Function" ) {
3543 if ( (*it)->GetData().IsFields() ) {
3546 bool okay_to_add =
true;
3550 for ( ; iter !=
m_Quals.
end() && iter->first == slot; ++iter) {
3552 if( qual.
Equals(*go_val) )
3554 okay_to_add =
false;
3577 if (
label ==
"Process" ) {
3579 }
else if (
label ==
"Component" ) {
3581 }
else if (
label ==
"Function" ) {
3589 if ( (*it)->GetData().IsFields() ) {
3592 bool okay_to_add =
true;
3596 for ( ; iter !=
m_Quals.
end() && iter->first == slot; ++iter) {
3598 if( qual.
Equals(*go_val) )
3600 okay_to_add =
false;
3628 if ( ! gene_ref && gene_feat ) {
3645 &gene_ref->
GetDesc() :
nullptr;
3647 &gene_ref->
GetSyn() :
nullptr;
3648 const string* locus_tag =
3652 if (
ctx.IsProt() ) {
3660 if ( !from_overlap || okay_to_propage ) {
3664 else if (desc && okay_to_propage) {
3673 if (locus || ! locus_tag) {
3680 if ( gene_ref || okay_to_propage ) {
3686 else if (locus_tag) {
3692 if ( gene_ref || okay_to_propage ) {
3694 if (is_gene && desc) {
3695 string desc_cleaned = *desc;
3700 else if (locus_tag) {
3701 if (is_gene && desc) {
3708 if ( gene_ref || okay_to_propage ) {
3713 }
else if (locus_tag) {
3740 const bool is_type_where_allele_from_gene_forbidden_except_with_embl_or_ddbj =
3745 if ( ! is_type_where_allele_from_gene_forbidden &&
3746 ( is_embl_or_ddbj || ! is_type_where_allele_from_gene_forbidden_except_with_embl_or_ddbj ) )
3768 for (CSeq_feat::TDbxref::iterator
i = xrefs.begin();
3769 i != xrefs.end(); ++
i) {
3770 if ((*i)->Equals(**it)) {
3796 const string & strPseudoGene = gene_feat->
GetNamedQual(
"pseudogene");
3819 if (
names.size() > 1) {
3824 if ( !
ctx.IsProt() ) {
3830 prot_desc->SetAddPeriod();
3861 if (
ctx.IsRefSeq() || !
ctx.Config().ForGBRelease() ) {
3870 if ( !pseudo && (
ctx.Config().ShowPeptides() ||
ctx.Config().IsFormatGBSeq() ||
ctx.Config().IsFormatINSDSeq() ) ) {
3895 bool has_mat_peptide =
false;
3896 bool has_propeptide =
false;
3897 bool has_signal_peptide =
false;
3901 const bool is_pept_whole_loc = loc->
IsWhole() ||
3910 for (
CFeat_CI feat_it(
ctx.GetHandle(), sel); feat_it; ++feat_it) {
3911 bool copy_loc =
false;
3912 switch (feat_it->GetData().GetProt().GetProcessed()) {
3916 has_signal_peptide =
true;
3917 if ( (feat_it->GetLocation().GetTotalRange().GetFrom() ==
3920 loc = loc->
Subtract(feat_it->GetLocation(),
3928 has_mat_peptide =
true;
3932 has_propeptide =
true;
3946 (feat_it->GetLocation().GetTotalRange().GetTo());
3964 bool proteinIsAtLeastMature;
3968 proteinIsAtLeastMature =
false;
3971 proteinIsAtLeastMature =
true;
3975 if ( (!has_mat_peptide || !has_signal_peptide || !has_propeptide) || (proteinIsAtLeastMature) || (!is_pept_whole_loc) ) {
3996 if ( !
ctx.IsRefSeq() ) {
4002 !
ctx.IsRefSeq() && !
ctx.IsProt() &&
4027 vals.push_back(
val);
4030 list<string>::iterator it = vals.begin();
4031 while (it != vals.end()) {
4033 it = vals.erase(it);
4074 static const string kPmid(
"PMID:");
4077 out_new_val.clear();
4082 while( str_pos <
val.length() ) {
4085 const SIZE_TYPE pmid_label_pos =
val.find(
"PMID:", str_pos );
4086 if( pmid_label_pos ==
NPOS ) {
4089 copy(
val.begin() + str_pos,
val.end(), back_inserter(out_new_val) );
4094 const SIZE_TYPE first_pmid_pos = pmid_label_pos + kPmid.length();
4095 copy(
val.begin() + str_pos,
val.begin() + first_pmid_pos, back_inserter(out_new_val) );
4096 str_pos = first_pmid_pos;
4100 bool first_num =
true;
4101 while( str_pos <
val.length() ) {
4103 const SIZE_TYPE next_pmid_pos =
val.find_first_not_of(
" ,", str_pos);
4109 SIZE_TYPE end_of_pmid_pos =
val.find_first_not_of(
"0123456789", next_pmid_pos );
4110 if(
NPOS == end_of_pmid_pos ) {
4111 end_of_pmid_pos =
val.length();
4115 string pmid =
val.substr(next_pmid_pos, end_of_pmid_pos - next_pmid_pos );
4121 out_new_val +=
"<a href=\"";
4123 out_new_val += pmid;
4124 out_new_val +=
"\">";
4125 out_new_val += pmid;
4126 out_new_val +=
"</a>";
4127 str_pos = end_of_pmid_pos;
4142 static const TLegalImport kLegalImports[] = {
4144 #define DO_IMPORT(x) { #x, eFQ_##x }
4201 bool check_qual_syntax =
ctx.Config().CheckQualSyntax();
4205 bool first_pseudogene =
true;
4207 vector<string> replace_quals;
4210 if (!(*it)->IsSetQual() || !(*it)->IsSetVal()) {
4213 const string&
val = (*it)->GetVal();
4215 const char* name = (*it)->GetQual().c_str();
4216 const TLegalImportMap::const_iterator li = kLegalImportMap.find(name);
4218 if ( li != kLegalImportMap.end() ) {
4220 }
else if (check_qual_syntax) {
4254 if ((*it)->IsSetVal()) {
4261 if ((*it)->IsSetVal()) {
4278 if ((*it)->IsSetVal()) {
4293 if( ! old_locus_tag_added_elsewhere ) {
4311 if ((*it)->IsSetVal() &&
4327 const string& gene_val =
4330 const string& product_val =
4332 if (
val != gene_val &&
val != product_val) {
4333 if ( !
ctx.Config().CodonRecognizedToNote() ||
4347 if (!
ctx.Config().CheckQualSyntax() ||
4356 if (
val ==
"EXPERIMENTAL" ) {
4358 }
else if (
val ==
"NOT_EXPERIMENTAL" ) {
4371 if (string::npos == s.find_first_not_of(
"ACGTUacgtu")) {
4375 replace_quals.push_back(s);
4406 if( first_pseudogene ) {
4407 first_pseudogene =
false;
4428 if (replace_quals.size()) {
4429 std::sort(replace_quals.begin(), replace_quals.end());
4430 ITERATE (vector<string>, it, replace_quals) {
4452 const string& rpt_unit )
4455 if (rpt_unit.empty()) {
4459 vector<string> units;
4463 string tmp = rpt_unit.substr(1, rpt_unit.length() - 2);
4466 units.push_back(rpt_unit);
4480 const string& rpt_type,
4481 bool check_qual_syntax )
4484 if (rpt_type.empty()) {
4488 string value( rpt_type );
4491 vector<string> pieces;
4494 ITERATE( vector<string>, it, pieces ) {
4528 const string& recombination_class,
4529 bool check_qual_syntax
4533 if (recombination_class.empty()) {
4537 string recomb_class = recombination_class;
4554 const string& regulatory_class,
4555 bool check_qual_syntax
4559 if (regulatory_class.empty()) {
4563 string reg_class = regulatory_class;
4593 #define DO_QUAL(x) x_FormatQual(eFQ_##x, #x, qvec)
4774 #define DO_NOTE(x) x_FormatNoteQual(eFQ_##x, GetStringOfFeatQual(eFQ_##x), qvec)
4775 #define DO_NOTE_PREPEND_NEWLINE(x) x_FormatNoteQual(eFQ_##x, GetStringOfFeatQual(eFQ_##x), qvec, IFlatQVal::fPrependNewline )
4807 bool add_period =
true;
4811 if (
GetContext()->Config().GoQualsToNote()) {
4821 #undef DO_NOTE_PREPEND_NEWLINE
4832 while (it != end && it->first == slot) {
4849 while (it != end && it->first == slot) {
4864 vector<CConstRef<CFlatGoQVal> > goQuals;
4868 while (it != end && it->first == slot) {
4873 if( goQuals.empty() ) {
4884 string::size_type this_part_beginning_text_string_pos = 0;
4887 const string* pLastQualTextString =
nullptr;
4892 const string *pThisQualTextString = &(*iter)->GetTextString();
4893 if (! pThisQualTextString) {
4899 if(! pLastQualTextString || !
NStr::EqualNocase(*pLastQualTextString, *pThisQualTextString)) {
4901 if( ! combined.empty() ) {
4903 this_part_beginning_text_string_pos = combined.length() - 1;
4905 combined += temp_qvec.back()->GetValue();
4909 const string & new_value = temp_qvec.back()->GetValue();
4914 post_text_string_pos += pLastQualTextString->length();
4918 string str_to_append = new_value.substr( post_text_string_pos,
4919 (pLastQualTextString->length() - post_text_string_pos) );
4920 if(
NStr::Find(combined, str_to_append, this_part_beginning_text_string_pos) ==
NPOS ) {
4921 combined.append( str_to_append );
4925 pLastQualTextString = pThisQualTextString;
4927 pLastQualTextString =
nullptr;
4930 if( ! combined.empty() ) {
4931 const string prefix =
" ";
4932 const string suffix =
";";
4934 qvec.push_back(res);
4973 {
"insertion sequence",
false },
4974 {
"integron",
false },
4975 {
"non-LTR retrotransposon",
false },
4977 {
"retrotransposon",
false },
4978 {
"transposon",
false }
4987 if( mobile_element_type_value.empty() ) {
4992 string::size_type colon_pos = mobile_element_type_value.find(
':' );
4994 const string value_before_colon = ( string::npos == colon_pos
4995 ? mobile_element_type_value
4996 : mobile_element_type_value.substr( 0, colon_pos ) );
4999 sm_MobileElemTypeKeys.find( value_before_colon.c_str() );
5000 if( prefix_info == sm_MobileElemTypeKeys.end() ) {
5005 if( prefix_info->second ) {
5006 if( string::npos == colon_pos ) {
5033 (gene_ref && gene_ref->
IsSetSyn() && !gene_ref->
GetSyn().empty() )
5040 if (
ctx.Config().DropIllegalQuals()) {
5051 const string& gene_name = gene->
GetValue();