60 #include <unordered_set>
74 pProduct->
SetId(*pId);
91 if (
prot.IsSetName() &&
prot.GetName().size() > 0) {
92 productName =
prot.GetName().front();
103 if (
prot.IsSetName() &&
prot.GetName().size() > 0) {
104 productName =
prot.GetName().front();
116 const string& locusTagPrefix,
117 unsigned int locusTagNumber,
118 unsigned int startingFeatId,
123 mpMessageListener(pMessageListener),
124 mLocusTagPrefix(locusTagPrefix),
125 mLocusTagNumber(locusTagNumber),
126 mNextFeatId(startingFeatId)
139 unsigned int sequenceSize,
140 const string& locusTagPrefix,
141 unsigned int locusTagNumber,
142 unsigned int startingFeatId,
146 mSequenceSize(sequenceSize),
147 mpMessageListener(pMessageListener),
148 mLocusTagPrefix(locusTagPrefix),
149 mLocusTagNumber(locusTagNumber),
150 mNextFeatId(startingFeatId)
186 if (pOverlappingRna) {
196 pRna->
SetData().SetRna().SetExt().SetName(
201 pRna->
SetId().SetLocal().SetStr(rnaId);
211 pRnaXref->SetId(*pFeatId);
212 pRna->
SetXref().push_back(pRnaXref);
224 pRnaXref->SetId(*pGeneId);
225 pRna->
SetXref().push_back(pRnaXref);
260 edit::CLocationEditPolicy editPolicy(
261 edit::CLocationEditPolicy::ePartialPolicy_eSetForBadEnd,
262 edit::CLocationEditPolicy::ePartialPolicy_eSetForBadEnd,
265 edit::CLocationEditPolicy::eMergePolicy_NoChange);
274 infered = editPolicy.ApplyPolicyToFeature(*pEditedCds, *
mpScope);
324 if (!product.empty()) {
339 vector<string> specialQuals{
340 "Protein",
"protein",
341 "go_function",
"go_component",
"go_process" };
347 (it)->GetOriginalFeature()));
348 const QUALS& quals = (*it).GetQual();
349 vector<string> badQuals;
350 for (QUALS::const_iterator qual = quals.begin(); qual != quals.end();
352 string qualKey = (*qual)->GetQual();
353 if (std::find(specialQuals.begin(), specialQuals.end(), qualKey)
354 != specialQuals.end()) {
359 if (qualKey ==
"protein_id" || qualKey ==
"transcript_id") {
362 if (qualKey ==
"orig_protein_id" || qualKey ==
"orig_transcript_id") {
368 badQuals.push_back(qualKey);
375 badQuals.push_back(qualKey);
377 for (vector<string>::const_iterator badIt = badQuals.begin();
378 badIt != badQuals.end(); ++badIt) {
389 {
'A', list<char>({
'A'})},
390 {
'G', list<char>({
'G'})},
391 {
'C', list<char>({
'C'})},
392 {
'T', list<char>({
'T'})},
393 {
'U', list<char>({
'U'})},
394 {
'M', list<char>({
'A',
'C'})},
395 {
'R', list<char>({
'A',
'G'})},
396 {
'W', list<char>({
'A',
'T'})},
397 {
'S', list<char>({
'C',
'G'})},
398 {
'Y', list<char>({
'C',
'T'})},
399 {
'K', list<char>({
'G',
'T'})},
400 {
'V', list<char>({
'A',
'C',
'G'})},
401 {
'H', list<char>({
'A',
'C',
'T'})},
402 {
'D', list<char>({
'A',
'G',
'T'})},
403 {
'B', list<char>({
'C',
'G',
'T'})},
404 {
'N', list<char>({
'A',
'C',
'G',
'T'})}
412 auto codonRecognized = mf.
GetNamedQual(
"codon_recognized");
413 if (codonRecognized.empty()) {
416 if (codonRecognized.size() != 3) {
425 pEditedFeat->
Assign(origFeat);
430 for (
char char1 : sIUPACmap.at(codonRecognized[0])) {
431 for (
char char2 : sIUPACmap.at(codonRecognized[1])) {
432 for (
char char3 : sIUPACmap.at(codonRecognized[2])) {
434 codons.insert(codonIndex);
444 for (
const auto codonIndex :
codons) {
445 extTrna.SetCodon().push_back(codonIndex);
493 string transcript_id = mrna.
GetNamedQual(
"transcript_id");
498 return transcript_id;
509 if (no_protein_id_qual) {
519 string transcript_id = cds.
GetNamedQual(
"transcript_id");
520 const bool no_transcript_id_qual =
NStr::IsBlank(transcript_id);
521 if (no_transcript_id_qual) {
533 if (no_protein_id_qual) {
538 if (no_transcript_id_qual) {
553 if (has_protein_id && has_transcript_id) {
554 if (!is_genbank_protein && (transcript_id == protein_id)) {
555 protein_id =
"cds." + protein_id;
559 if (has_protein_id && !is_genbank_protein) {
560 transcript_id =
"mrna." + protein_id;
561 has_transcript_id =
true;
563 else if (has_transcript_id && !is_genbank_transcript) {
564 protein_id =
"cds." + transcript_id;
565 has_protein_id =
true;
569 if (!has_transcript_id) {
572 if (!has_protein_id) {
590 const string& cds_transcript_id,
591 const string& cds_protein_id,
599 bool use_local_ids =
false;
601 string transcript_id = mrna.
GetNamedQual(
"transcript_id");
603 transcript_id = cds_transcript_id;
606 use_local_ids =
true;
611 protein_id = cds_protein_id;
614 if ((protein_id == transcript_id) && !
NStr::StartsWith(protein_id,
"gb|")) {
615 protein_id =
"cds." + protein_id;
617 use_local_ids =
true;
625 if (transcript_id != cds_transcript_id) {
629 if (protein_id != cds_protein_id) {
649 string transcript_id = mrna.
GetNamedQual(
"transcript_id");
651 if (no_transcript_id_qual) {
659 if ((is_genbank_protein ||
661 (is_genbank_transcript ||
663 if (no_transcript_id_qual) {
671 if ((transcript_id == protein_id) &&
672 !is_genbank_transcript) {
673 protein_id =
"cds." + protein_id;
678 transcript_id =
"mrna." + protein_id;
681 if (!is_genbank_transcript && !
NStr::IsBlank(transcript_id)) {
682 protein_id =
"cds." + transcript_id;
702 string& transcript_id,
708 string locus_tag_prefix;
709 if (update_protein_id || update_transcript_id) {
712 if (update_protein_id) {
713 protein_id =
"gnl|" + locus_tag_prefix +
"|" + protein_id;
716 if (update_transcript_id) {
717 transcript_id =
"gnl|" + locus_tag_prefix +
"|" + transcript_id;
724 if (update_protein_id) {
725 protein_id =
"gnl|" + seq_label +
"|" + protein_id;
728 if (update_transcript_id) {
729 transcript_id =
"gnl|" + seq_label +
"|" + transcript_id;
838 if (sequenceSize == 0) {
847 pGene->
SetId().SetLocal().SetStr(geneId);
855 pGeneXref->SetId(*pFeatId);
856 pGene->
SetXref().push_back(pGeneXref);
875 if (!orig_tid.empty()) {
912 if (!orig_pid.empty()) {
939 if (tid == mRnaTid) {
940 tid =
string(
"cds.") + tid;
999 if (!orig_tid.empty()) {
1046 if (!orig_tid.empty()) {
1108 const string& rawId)
1112 if (string::npos != rawId.find(
"|")) {
1115 " does not have a usable transcript_ or protein_id.");
1121 if (locusTagPrefix.empty()) {
1123 "Cannot generate transcript_/protein_id for feature " +
xGetIdStr(mf) +
1124 " without a locus tag.");
1129 if (!rawId.empty()) {
1130 return string(
"gnl|") + locusTagPrefix +
"|" + rawId;
1146 return string(
"gnl|") + locusTagPrefix +
"|mrna." + id;
1157 return string(
"gnl|") + locusTagPrefix +
"|cds." + id;
1168 "Cannot generate transcript_/protein_id for feature " +
xGetIdStr(mf) +
1169 " - insufficient context.");
1245 string transcriptId =
rna.GetNamedQual(
"transcript_id");
1247 string proteinId =
rna.GetNamedQual(
"protein_id");
1274 string transcriptId = mf.
GetNamedQual(
"transcript_id");
1275 if (transcriptId.empty()) {
1279 if (proteinId.empty()) {
1285 string transcriptId = mf.
GetNamedQual(
"transcript_id");
1286 if (transcriptId.empty()) {
1309 for (; itGenes; ++itGenes) {
1328 vector<CSeq_id_Handle> annotIds;
1332 for (; itGenes; ++itGenes) {
1335 vector<CSeq_id_Handle>::const_iterator compIt;
1336 for (compIt = annotIds.begin();
1337 compIt != annotIds.end();
1339 if (*compIt == idh) {
1343 if (compIt == annotIds.end()) {
1344 annotIds.push_back(idh);
1349 for (vector<CSeq_id_Handle>::const_iterator idIt = annotIds.begin();
1350 idIt != annotIds.end();
1359 for (; itGenes; ++itGenes) {
1383 for (; itOther; ++itOther) {
1385 (itOther)->GetOriginalFeature()));
1431 const string& qualKey,
1432 const string& qualVal)
1444 const string& qualKey)
1455 const string& qualKey,
1456 const string& qualVal)
1460 if (!existing.empty()) {
1469 const string& proteinIdStr)
1478 pEditedFeat->
Assign(origFeat);
1479 pEditedFeat->
SetProduct().SetWhole(*pProteinId);
1488 const int WIDTH = 6;
1494 string nextTag(
"auto");
1502 const int WIDTH = 6;
1517 const string dbPrefix(
"gnl|");
1538 if (locusTag.empty() &&
1557 const string dbPrefix(
"gnl|");
1577 if (locusTag.empty() &&
1590 return transcriptId;
1603 auto& baseId = *baseLoc.
GetId();
1605 if (sequenceSize == 0 || baseStart <= baseStop) {
1607 pEnvelope->
SetId(baseId);
1608 pEnvelope->
SetInt().SetFrom(baseStart);
1609 pEnvelope->
SetInt().SetTo(baseStop);
1615 pTop->
SetId().Assign(baseId);
1617 pTop->
SetTo(sequenceSize-1);
1621 pBottom->
SetId().Assign(baseId);
1623 pBottom->
SetTo(baseStop);
1630 pBottom->
SetId().Assign(baseId);
1632 pBottom->
SetTo(baseStop);
1636 pTop->
SetId().Assign(baseId);
1638 pTop->
SetTo(sequenceSize-1);
1673 const string& message)
1702 string message = subName +
" feature is missing locus tag.";
1723 string message = subName +
" feature is missing transcript ID.";
1730 const string codonRecognized)
1736 string message =
"tRNA with bad codon recognized attribute \"" +
1737 codonRecognized +
"\".";
1758 string message = subName +
" feature is missing protein ID.";
1776 xPutError(
"Protein ID on mRNA feature differs from protein ID on child CDS.");
1792 xPutError(
"Transcript ID on mRNA feature differs from transcript ID on child CDS.");
1802 stringstream strstr;
1803 auto&
id = mf.
GetId();
1804 switch (
id.Which()) {
1806 return "\"UNKNOWN ID\"";
1808 id.GetLocal().AsString(strstr);
1809 return strstr.str();
1830 if (geneRef.IsSetLocus_tag()) {
1836 auto locusTagFromQualifier = geneFeature.
GetNamedQual(
"locus_tag");
1837 if (!locusTagFromQualifier.empty()) {
1848 if (feature.
Empty())
1869 auto append_nonduplicated_item = [](list<string>& current_list,
1870 const list<string>& other_list)
1872 unordered_set<string> current_set;
1873 for (
const auto& item : current_list) {
1874 current_set.insert(item);
1877 for (
const auto& item : other_list) {
1878 if (current_set.find(item) == current_set.end()) {
1879 current_list.push_back(item);
1885 append_nonduplicated_item(current_ref.
SetName(),
1894 append_nonduplicated_item(current_ref.
SetEc(),
1899 append_nonduplicated_item(current_ref.
SetActivity(),
1904 for (
const auto& pDBtag : other_ref.
GetDb()) {
1905 current_ref.
SetDb().push_back(pDBtag);
1928 const string& product_name = cds.
GetNamedQual(
"product");
1930 prot_ref.
SetName().push_back(product_name);
1934 if (pMrna.
Empty()) {
1939 for (
auto& prot_name : prot_ref.
SetName()) {
1957 feature.
SetId().SetLocal().SetId(
id++);
1966 if (feat.NotEmpty() && feat->IsSetData() && feat->GetData().IsCdregion())
1989 bool was_extended =
false;
1990 if (replacement.
Empty())
1996 if (protein.
Empty())
2006 protein_entry->
SetSeq(*protein);
2026 if (protein->
GetId().empty())
2028 const string* protein_ids = 0;
2030 qual_to_remove =
"protein_id";
2031 protein_ids = &cd_feature.
GetNamedQual(qual_to_remove);
2033 if (protein_ids->empty())
2035 qual_to_remove =
"orig_protein_id";
2036 protein_ids = &cd_feature.
GetNamedQual(qual_to_remove);
2039 if (protein_ids->empty())
2045 if (protein_ids->empty())
2050 if (!protein_ids->empty())
2055 MergeSeqIds(*protein, new_ids);
2064 if (protein->
GetId().empty())
2066 if (base_name.empty() && !bioseq.GetId().empty())
2071 newid = GetNewProteinId(*m_scope, base_name);
2072 protein->
SetId().push_back(newid);
2078 CSeq_feat& prot_feat = CreateOrSetFTable(*protein);
2088 prot_ref.
SetName().push_back(
"hypothetical protein");
2090 cd_feature.
SetProtXref().SetName().push_back(
"hypothetical protein");
2098 prot_feat.
SetLocation().SetInt().SetId().Assign(*GetAccessionId(protein->
GetId()));
2102 cd_feature.
SetProduct().SetWhole().Assign(*GetAccessionId(protein->
GetId()));
2127 auto& ext = mrna_feature.
SetData().SetRna().SetExt();
2129 (ext.IsName() && ext.SetName().empty()))
2130 ext.SetName() = prot_ref.
GetName().front();
2154 return protein_entry;
2163 if (objectId.
IsStr()) {
2164 return objectId.
GetStr();
2178 for (
auto pThisFeat: thisFeatures) {
2180 if (!pThisFeat->IsSetId() || !pThisFeat->GetId().IsLocal()) {
2183 const auto& this_oid = pThisFeat->GetId().GetLocal();
2186 for (
auto pOtherFeat: otherFeatures) {
2187 if (!pOtherFeat->IsSetId() || !pOtherFeat->GetId().IsLocal()) {
2188 thisFeatures.push_back(pOtherFeat);
2191 const auto& other_oid = pOtherFeat->GetId().GetLocal();
2193 thisFeatures.push_back(pOtherFeat);
2197 thisFeatures.push_back(pOtherFeat);
2223 string oldFeatIdAsStr;
2224 if (oldFeatId.
IsStr()) {
2225 oldFeatIdAsStr = oldFeatId.
GetStr();
2231 string newFeatIdAsStr = oldFeatIdAsStr +
"x";
2233 pNewFeatId->
SetStr(oldFeatIdAsStr +
"x");
2235 pNewFeatId->
SetStr() +=
"x";
2239 pBaseFeat->SetId().SetLocal(*pNewFeatId);
2243 for (
auto it = featMap.
begin(); it != featMap.
end(); ++it) {
2244 auto pFeat = it->second;
2245 for (
auto& pXref: pFeat->SetXref()) {
2246 if (!pXref->IsSetId() || !pXref->GetId().IsLocal()) {
2250 pXref->SetId().SetLocal(*pNewFeatId);
User-defined methods of the data storage class.
@ eExtreme_Positional
numerical value
User-defined methods of the data storage class.
User-defined methods of the data storage class.
string GetIdHashOrValue(const string &base, int offset)
CSeqdesc & Set(bool skip_lookup=false)
static bool ExtendToStopIfShortAndNotPartial(CSeq_feat &f, CBioseq_Handle bsh, bool check_for_stop=true)
Extends a coding region up to 50 nt.
static bool ExtendStopPosition(CSeq_feat &f, const CSeq_feat *cdregion, size_t extension=0)
static bool LocationMayBeExtendedToMatch(const CSeq_loc &orig, const CSeq_loc &improved)
Checks whether it is possible to extend the original location up to improved one.
void InstantiateProducts()
void xFeatureSetQualifier(CMappedFeat, const std::string &, const std::string &)
unsigned int mSequenceSize
CConstRef< CSeq_feat > xGetLinkedFeature(const CSeq_feat &cd_feature, bool gene)
void GenerateMissingGeneForMrna()
void GenerateMissingGeneForCds()
void xFeatureAddTranscriptIdMrna(CMappedFeat)
IObjtoolsListener * mpMessageListener
set< CMappedFeat > mProcessedMrnas
bool xAdjustExistingParentGene(CMappedFeat)
void xGenerateLocusIdsRegenerate()
void xFeatureRemoveQualifier(CMappedFeat, const std::string &)
CRef< CSeq_loc > xGetGeneLocation(const CSeq_loc &, TSeqPos)
unsigned int mLocusTagNumber
void xPutError(const string &message)
void ProcessCodonRecognized()
void xFeatureAddTranscriptIdCds(CMappedFeat)
void xGenerateMissingGeneForChoice(CSeqFeatData::E_Choice, const CGff3LocationMerger *=nullptr)
static std::string xGetIdStr(CMappedFeat)
CSeq_annot_EditHandle mEditHandle
void xPutErrorMissingLocustag(CMappedFeat)
void GenerateProteinAndTranscriptIds()
CRef< CSeq_feat > xMakeGeneForFeature(const CMappedFeat &, TSeqPos)
void GenerateMissingParentFeaturesForProkaryote(const objects::CGff3LocationMerger *=nullptr)
bool AnnotHasAllLocusTags() const
void xFeatureAddProteinIdCds(CMappedFeat)
void xAddTranscriptAndProteinIdsToUnmatchedMrna(CMappedFeat &mrna)
std::string xGetCurrentLocusTagPrefix(CMappedFeat)
void GenerateMissingParentFeaturesForEukaryote(const objects::CGff3LocationMerger *=nullptr)
void xConvertToGeneralIds(const CMappedFeat &mf, string &transcript_id, string &protein_id)
void xFeatureAddTranscriptIdDefault(CMappedFeat)
CSeq_annot_Handle mHandle
void xGenerateLocusIdsUseExisting()
void xFeatureAddQualifier(CMappedFeat, const std::string &, const std::string &)
string xNextTranscriptId(const CMappedFeat &)
void xPutErrorBadCodonRecognized(const string codonRecognized)
bool m_use_hypothetic_protein
void xPutErrorMissingProteinId(CMappedFeat)
string xNextProteinId(const CMappedFeat &)
void xPutErrorMissingTranscriptId(CMappedFeat)
void xGenerateMissingGeneForSubtype(CSeqFeatData::ESubtype, const CGff3LocationMerger *=nullptr)
void GenerateMissingParentFeatures(bool forEukaryote, const objects::CGff3LocationMerger *=nullptr)
void xFeatureAddProteinIdDefault(CMappedFeat)
void xFeatureSetProduct(CMappedFeat, const string &)
map< string, int > mMapProtIdCounts
bool xCreateMissingParentGene(CMappedFeat, TSeqPos)
void MergeFeatures(const CSeq_annot::TData::TFtable &other)
std::string xGenerateTranscriptOrProteinId(CMappedFeat, const std::string &)
void GenerateMissingMrnaForCds()
void xAddTranscriptAndProteinIdsToCdsAndParentMrna(CMappedFeat &cds)
void EliminateBadQualifiers()
void xGenerate_mRNA_Product(CSeq_feat &cd_feature)
void InstantiateProductsNames()
void xAddTranscriptAndProteinIdsToMrna(const string &cds_transcript_id, const string &cds_protein_id, CMappedFeat &mrna)
void xPutErrorDifferingTranscriptIds(const CMappedFeat &mrna)
CFeatTableEdit(CSeq_annot &, const string &="", unsigned int=1, unsigned int=1, IObjtoolsListener *=nullptr)
void xFeatureAddProteinIdMrna(CMappedFeat)
void xPutErrorDifferingProteinIds(const CMappedFeat &mrna)
void xRenameFeatureId(const CObject_id &, FeatMap &)
static int CodonToIndex(char base1, char base2, char base3)
TSeqPos GetSequenceSize(const string &) const
bool IsLegalQualifier(EQualifier qual) const
Test wheather a certain qualifier is legal for the feature.
EQualifier
List of available qualifiers for feature keys.
ESubtype GetSubtype(void) const
static EQualifier GetQualifierType(CTempString qual)
convert qual string to enumerated value
static CTempString SubtypeValueToName(ESubtype eSubtype)
Turns a ESubtype into its string value which is NOT necessarily related to the identifier of the enum...
namespace ncbi::objects::
const CProt_ref * GetProtXref(void) const
get protein (if present) from Seq-feat.xref list
const string & GetNamedQual(const CTempString &qual_name) const
Return a named qualifier.
void AddQualifier(const string &qual_name, const string &qual_val)
Add a qualifier to this feature.
void RemoveQualifier(const string &qual_name)
Remove all qualifiers with the given name; do nothing if no such qualifier exists.
bool AddSeqFeatXref(const CSeqFeatXref::TId &id)
void SetProtXref(CProt_ref &value)
static bool GetOrgName(string &name, const objects::CSeq_entry &entry)
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
const_iterator begin() const
const_iterator end() const
const_iterator find(const key_type &key) const
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
CRef< CSeq_loc > sProductFromString(const string str)
static string s_GetTranscriptIdFromMrna(const CMappedFeat &mrna)
static void s_SetProtRef(const CSeq_feat &cds, CConstRef< CSeq_feat > pMrna, CProt_ref &prot_ref)
static bool AssignLocalIdIfEmpty(CSeq_feat &feature, unsigned &id)
static void s_AppendProtRefInfo(CProt_ref ¤t_ref, const CProt_ref &other_ref)
static bool s_ShouldConvertToGeneral(const string &id)
string sGetCdsProductName(const CSeq_feat &cds, CScope &scope)
bool idAlpha(const CSeq_id_Handle &idh1, const CSeq_id_Handle idh2)
bool OjectIdsAreEqual(const CObject_id &lhs, const CObject_id &rhs)
string sGetFeatMapKey(const CObject_id &objectId)
const TResidue codons[4][4]
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
@ eDiag_Error
Error message.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
static SIZE_TYPE ParseIDs(CBioseq::TId &ids, const CTempString &s, TParseFlags flags=fParse_Default)
Parse a string representing one or more Seq-ids, appending the results to IDS.
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
string AsString(void) const
@ fParse_PartialOK
Warn rather than throwing an exception when a FASTA-style ID set contains unparsable portions,...
@ fParse_ValidLocal
Treat otherwise unidentified strings as raw accessions, provided that they pass rudimentary validatio...
@ eContent
Untagged human-readable accession or the like.
void SetPacked_int(TPacked_int &v)
ENa_strand GetStrand(void) const
Get the location's strand.
void SetId(CSeq_id &id)
set the 'id' field in all parts of this location
TSeqPos GetStart(ESeqLocExtremes ext) const
Return start and stop positions of the seq-loc.
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
TSeqPos GetStop(ESeqLocExtremes ext) const
CMappedFeat GetBestMrnaForCds(const CMappedFeat &cds_feat, CFeatTree *feat_tree=0, const SAnnotSelector *base_sel=0)
bool CopyFeaturePartials(CSeq_feat &dst, const CSeq_feat &src)
CopyFeaturePartials A function to copy the start and end partialness from one feature to another.
CMappedFeat GetBestGeneForCds(const CMappedFeat &cds_feat, CFeatTree *feat_tree=0, const SAnnotSelector *base_sel=0, CFeatTree::EBestGeneType lookup_type=CFeatTree::eBestGene_TreeOnly)
CMappedFeat GetBestGeneForFeat(const CMappedFeat &feat, CFeatTree *feat_tree=0, const SAnnotSelector *base_sel=0, CFeatTree::EBestGeneType lookup_type=CFeatTree::eBestGene_TreeOnly)
CMappedFeat GetBestOverlappingFeat(const CMappedFeat &feat, CSeqFeatData::ESubtype need_subtype, sequence::EOverlapType overlap_type, CFeatTree *feat_tree=0, const SAnnotSelector *base_sel=0)
bool AdjustProteinMolInfoToMatchCDS(CMolInfo &molinfo, const CSeq_feat &cds)
AdjustProteinMolInfoToMatchCDS A function to change an existing MolInfo to match a coding region.
CMappedFeat GetBestCdsForMrna(const CMappedFeat &mrna_feat, CFeatTree *feat_tree=0, const SAnnotSelector *base_sel=0)
@ eOverlap_CheckIntRev
1st is a subset of 2nd with matching boundaries
bool IsPseudo(const CSeq_feat &feat, CScope &scope)
Determines whether given feature is pseudo, using gene associated with feature if necessary Checks to...
CBioseq_Handle GetBioseqFromSeqLoc(const CSeq_loc &loc, CScope &scope, CScope::EGetBioseqFlag flag=CScope::eGetBioseq_Loaded)
Retrieve the Bioseq Handle from a location.
static CRef< CBioseq > TranslateToProtein(const CSeq_feat &cds, CScope &scope)
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
CSeq_feat_Handle GetSeq_featHandle(const CSeq_feat &feat, EMissing action=eMissing_Default)
CBioseq_EditHandle GetEditHandle(const CBioseq_Handle &seq)
Get editable Biosec handle by regular one.
CSeq_annot_Handle AddSeq_annot(CSeq_annot &annot, TPriority pri=kPriority_Default, EExist action=eExist_Throw)
Add Seq-annot, return its CSeq_annot_Handle.
CBioseq_Handle GetObjectHandle(const CBioseq &bioseq, EMissing action=eMissing_Default)
const string & GetNamedQual(const CTempString &qual_name) const
Return a named qualifier.
void AddQualifier(const string &qual_name, const string &qual_val)
Add a qualifier to this feature.
virtual CSeq_id_Handle GetLocationId(void) const
const CFeat_id & GetId(void) const
const CSeq_annot_Handle & GetAnnot(void) const
Get handle to seq-annot for this feature.
const CSeqFeatData & GetData(void) const
CSeq_feat_EditHandle AddFeat(const CSeq_feat &new_obj) const
bool IsSetProduct(void) const
void RemoveQualifier(const string &qual_name)
Remove all qualifiers with the given name on this feature.
CSeqFeatData::ESubtype GetFeatSubtype(void) const
void Replace(const CSeq_feat &new_feat) const
Replace the feature with new Seq-feat object.
SAnnotSelector & IncludeFeatSubtype(TFeatSubtype subtype)
Include feature subtype in the search.
SAnnotSelector & ExcludeFeatSubtype(TFeatSubtype subtype)
Exclude feature subtype from the search.
bool IsSetPartial(void) const
const CSeq_loc & GetLocation(void) const
bool GetPartial(void) const
const CSeq_feat & GetOriginalFeature(void) const
Get original feature with unmapped location/product.
SAnnotSelector & IncludeFeatType(TFeatType type)
Include feature type in the search.
SAnnotSelector & SetSortOrder(ESortOrder sort_order)
Set sort order of annotations.
CConstRef< CSeq_feat > GetSeq_feat(void) const
Get current seq-feat.
CSeq_id_Handle GetLocationId(void) const
@ eSortOrder_Normal
default - increasing start, decreasing length
@ eSortOrder_None
do not sort annotations for faster retrieval
bool Empty(void) const THROWS_NONE
Check if CConstRef is empty – not pointing to any object which means having a null value.
void Reset(void)
Reset reference object.
void Reset(void)
Reset reference object.
bool NotEmpty(void) const THROWS_NONE
Check if CConstRef is not empty – pointing to an object and has a non-null value.
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
static string & ToUpper(string &str)
Convert string to upper case – string& version.
bool IsSetLocus_tag(void) const
systematic gene name (e.g., MI0001, ORF0069) Check if a value has been assigned to Locus_tag data mem...
const TLocus_tag & GetLocus_tag(void) const
Get the Locus_tag member data.
bool IsStr(void) const
Check if variant Str is selected.
E_Choice Which(void) const
Which variant is currently selected.
const TStr & GetStr(void) const
Get the variant data.
TStr & SetStr(void)
Select the variant.
TId GetId(void) const
Get the variant data.
TActivity & SetActivity(void)
Assign a value to Activity data member.
bool IsSetDesc(void) const
description (instead of name) Check if a value has been assigned to Desc data member.
const TDb & GetDb(void) const
Get the Db member data.
const TActivity & GetActivity(void) const
Get the Activity member data.
TEc & SetEc(void)
Assign a value to Ec data member.
const TName & GetName(void) const
Get the Name member data.
bool IsSetDb(void) const
ids in other dbases Check if a value has been assigned to Db data member.
bool IsSetEc(void) const
E.C.
void SetDesc(const TDesc &value)
Assign a value to Desc data member.
TProcessed GetProcessed(void) const
Get the Processed member data.
void SetProcessed(TProcessed value)
Assign a value to Processed data member.
bool IsSetName(void) const
protein name Check if a value has been assigned to Name data member.
const TDesc & GetDesc(void) const
Get the Desc member data.
bool IsSetActivity(void) const
activities Check if a value has been assigned to Activity data member.
const TEc & GetEc(void) const
Get the Ec member data.
TDb & SetDb(void)
Assign a value to Db data member.
TName & SetName(void)
Assign a value to Name data member.
bool IsSetExt(void) const
generic fields for ncRNA, tmRNA, miscRNA Check if a value has been assigned to Ext data member.
const TName & GetName(void) const
Get the variant data.
const TExt & GetExt(void) const
Get the Ext member data.
bool IsName(void) const
Check if variant Name is selected.
@ e_not_set
No variant selected.
TXref & SetXref(void)
Assign a value to Xref data member.
void ResetPartial(void)
Reset Partial data member.
const TData & GetData(void) const
Get the Data member data.
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
bool IsProt(void) const
Check if variant Prot is selected.
void SetLocation(TLocation &value)
Assign a value to Location data member.
void SetPartial(TPartial value)
Assign a value to Partial data member.
void SetProduct(TProduct &value)
Assign a value to Product data member.
const TId & GetId(void) const
Get the Id member data.
const TLocal & GetLocal(void) const
Get the variant data.
bool IsSetXref(void) const
cite other relevant features Check if a value has been assigned to Xref data member.
const TLocation & GetLocation(void) const
Get the Location member data.
bool IsLocal(void) const
Check if variant Local is selected.
bool IsGene(void) const
Check if variant Gene is selected.
const TData & GetData(void) const
Get the Data member data.
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
void SetId(TId &value)
Assign a value to Id data member.
void SetData(TData &value)
Assign a value to Data data member.
bool IsSetId(void) const
Check if a value has been assigned to Id data member.
const TProduct & GetProduct(void) const
Get the Product member data.
const TGene & GetGene(void) const
Get the variant data.
const TProt & GetProt(void) const
Get the variant data.
const TXref & GetXref(void) const
Get the Xref member data.
vector< CRef< CSeqFeatXref > > TXref
void ResetProduct(void)
Reset Product data member.
vector< CRef< CGb_qual > > TQual
const TRna & GetRna(void) const
Get the variant data.
bool IsSetProduct(void) const
product of process Check if a value has been assigned to Product data member.
bool IsSetLocation(void) const
feature made from Check if a value has been assigned to Location data member.
@ e_Local
for local software use
void SetTo(TTo value)
Assign a value to To data member.
void SetId(TId &value)
Assign a value to Id data member.
void SetFrom(TFrom value)
Assign a value to From data member.
void SetStrand(TStrand value)
Assign a value to Strand data member.
const TSeq & GetSeq(void) const
Get the variant data.
TSeq & SetSeq(void)
Select the variant.
void SetData(TData &value)
Assign a value to Data data member.
TId & SetId(void)
Assign a value to Id data member.
const TInst & GetInst(void) const
Get the Inst member data.
const TId & GetId(void) const
Get the Id member data.
TLength GetLength(void) const
Get the Length member data.
list< CRef< CSeq_id > > TId
void SetBiomol(TBiomol value)
Assign a value to Biomol data member.
void SetDescr(TDescr &value)
Assign a value to Descr data member.
const TFtable & GetFtable(void) const
Get the variant data.
list< CRef< CSeq_feat > > TFtable
const TData & GetData(void) const
Get the Data member data.
void SetTech(TTech value)
Assign a value to Tech data member.
TMolinfo & SetMolinfo(void)
Select the variant.
@ eTech_concept_trans
conceptual translation
@ e_Molinfo
info on the molecule and techniques
constexpr auto sort(_Init &&init)
constexpr bool empty(list< Ts... >) noexcept
IMessage/IMessageListener interfaces and basic implementations.
static const char * suffix[]
static const char * prefix[]
static const char * str(char *buf, int n)