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)
197 if (pOverlappingRna) {
209 pRna->
SetData().SetRna().SetExt().SetName(
214 pRna->
SetId().SetLocal().SetStr(rnaId);
224 pRnaXref->SetId(*pFeatId);
225 pRna->
SetXref().push_back(pRnaXref);
237 pRnaXref->SetId(*pGeneId);
238 pRna->
SetXref().push_back(pRnaXref);
272 edit::CLocationEditPolicy editPolicy(
273 edit::CLocationEditPolicy::ePartialPolicy_eSetForBadEnd,
274 edit::CLocationEditPolicy::ePartialPolicy_eSetForBadEnd,
277 edit::CLocationEditPolicy::eMergePolicy_NoChange);
286 infered = editPolicy.ApplyPolicyToFeature(*pEditedCds, *
mpScope);
336 if (!product.empty()) {
351 vector<string> specialQuals{
352 "Protein",
"protein",
353 "go_function",
"go_component",
"go_process" };
359 (it)->GetOriginalFeature()));
360 const QUALS& quals = (*it).GetQual();
361 vector<string> badQuals;
362 for (QUALS::const_iterator qual = quals.begin(); qual != quals.end();
364 string qualKey = (*qual)->GetQual();
365 if (std::find(specialQuals.begin(), specialQuals.end(), qualKey)
366 != specialQuals.end()) {
371 if (qualKey ==
"protein_id" || qualKey ==
"transcript_id") {
374 if (qualKey ==
"orig_protein_id" || qualKey ==
"orig_transcript_id") {
380 badQuals.push_back(qualKey);
387 badQuals.push_back(qualKey);
389 for (vector<string>::const_iterator badIt = badQuals.begin();
390 badIt != badQuals.end(); ++badIt) {
401 {
'A', list<char>({
'A'})},
402 {
'G', list<char>({
'G'})},
403 {
'C', list<char>({
'C'})},
404 {
'T', list<char>({
'T'})},
405 {
'U', list<char>({
'U'})},
406 {
'M', list<char>({
'A',
'C'})},
407 {
'R', list<char>({
'A',
'G'})},
408 {
'W', list<char>({
'A',
'T'})},
409 {
'S', list<char>({
'C',
'G'})},
410 {
'Y', list<char>({
'C',
'T'})},
411 {
'K', list<char>({
'G',
'T'})},
412 {
'V', list<char>({
'A',
'C',
'G'})},
413 {
'H', list<char>({
'A',
'C',
'T'})},
414 {
'D', list<char>({
'A',
'G',
'T'})},
415 {
'B', list<char>({
'C',
'G',
'T'})},
416 {
'N', list<char>({
'A',
'C',
'G',
'T'})}
424 auto codonRecognized = mf.
GetNamedQual(
"codon_recognized");
425 if (codonRecognized.empty()) {
428 if (codonRecognized.size() != 3) {
437 pEditedFeat->
Assign(origFeat);
442 for (
char char1 : sIUPACmap.at(codonRecognized[0])) {
443 for (
char char2 : sIUPACmap.at(codonRecognized[1])) {
444 for (
char char3 : sIUPACmap.at(codonRecognized[2])) {
446 codons.insert(codonIndex);
456 for (
const auto codonIndex :
codons) {
457 extTrna.SetCodon().push_back(codonIndex);
505 string transcript_id = mrna.
GetNamedQual(
"transcript_id");
510 return transcript_id;
531 if (noProteinIdQual) {
542 string transcriptId = cds.
GetNamedQual(
"transcript_id");
544 if (noTranscriptIdQual && mrna) {
548 const bool isGenbankTranscript =
s_IsGenbankId(transcriptId);
555 if (noProteinIdQual) {
561 if (noTranscriptIdQual) {
574 if (hasProteinId && hasTranscriptId) {
575 if (!isGenbankProtein && (transcriptId == proteinId)) {
576 proteinId =
"cds." + proteinId;
580 if (hasProteinId && !isGenbankProtein) {
581 transcriptId =
"mrna." + proteinId;
582 hasTranscriptId =
true;
584 else if (hasTranscriptId && !isGenbankTranscript) {
585 proteinId =
"cds." + transcriptId;
590 if (!hasTranscriptId && mrna) {
610 const string& cds_transcript_id,
611 const string& cds_protein_id,
619 bool use_local_ids =
false;
621 string transcript_id = mrna.
GetNamedQual(
"transcript_id");
623 transcript_id = cds_transcript_id;
626 use_local_ids =
true;
631 protein_id = cds_protein_id;
634 if ((protein_id == transcript_id) && !
NStr::StartsWith(protein_id,
"gb|")) {
635 protein_id =
"cds." + protein_id;
637 use_local_ids =
true;
645 if (transcript_id != cds_transcript_id) {
649 if (protein_id != cds_protein_id) {
669 string transcriptId = mrna.
GetNamedQual(
"transcript_id");
671 if (noTranscriptIdQual) {
674 const bool isGenbankTranscript =
s_IsGenbankId(transcriptId);
681 if (noTranscriptIdQual) {
689 if ((transcriptId == proteinId) &&
690 !isGenbankTranscript) {
691 proteinId =
"cds." + proteinId;
696 transcriptId =
"mrna." + proteinId;
698 else if (!isGenbankTranscript && !
NStr::IsBlank(transcriptId)) {
699 proteinId =
"cds." + transcriptId;
720 string& transcript_id,
726 string locus_tag_prefix;
727 if (update_protein_id || update_transcript_id) {
730 if (update_protein_id) {
731 protein_id =
"gnl|" + locus_tag_prefix +
"|" + protein_id;
734 if (update_transcript_id) {
735 transcript_id =
"gnl|" + locus_tag_prefix +
"|" + transcript_id;
742 if (update_protein_id) {
743 protein_id =
"gnl|" + seq_label +
"|" + protein_id;
746 if (update_transcript_id) {
747 transcript_id =
"gnl|" + seq_label +
"|" + transcript_id;
868 if (sequenceSize == 0) {
877 pGene->
SetId().SetLocal().SetStr(geneId);
885 pGeneXref->SetId(*pFeatId);
886 pGene->
SetXref().push_back(pGeneXref);
905 if (!orig_tid.empty()) {
942 if (!orig_pid.empty()) {
969 if (tid == mRnaTid) {
970 tid =
string(
"cds.") + tid;
1029 if (!orig_tid.empty()) {
1076 if (!orig_tid.empty()) {
1138 const string& rawId)
1142 if (string::npos != rawId.find(
"|")) {
1145 " does not have a usable transcript_ or protein_id.");
1151 if (locusTagPrefix.empty()) {
1153 "Cannot generate transcript_/protein_id for feature " +
xGetIdStr(mf) +
1154 " without a locus tag.");
1159 if (!rawId.empty()) {
1160 return string(
"gnl|") + locusTagPrefix +
"|" + rawId;
1176 return string(
"gnl|") + locusTagPrefix +
"|mrna." + id;
1187 return string(
"gnl|") + locusTagPrefix +
"|cds." + id;
1198 "Cannot generate transcript_/protein_id for feature " +
xGetIdStr(mf) +
1199 " - insufficient context.");
1275 string transcriptId =
rna.GetNamedQual(
"transcript_id");
1277 string proteinId =
rna.GetNamedQual(
"protein_id");
1304 string transcriptId = mf.
GetNamedQual(
"transcript_id");
1305 if (transcriptId.empty()) {
1309 if (proteinId.empty()) {
1315 string transcriptId = mf.
GetNamedQual(
"transcript_id");
1316 if (transcriptId.empty()) {
1339 for (; itGenes; ++itGenes) {
1358 vector<CSeq_id_Handle> annotIds;
1362 for (; itGenes; ++itGenes) {
1365 vector<CSeq_id_Handle>::const_iterator compIt;
1366 for (compIt = annotIds.begin();
1367 compIt != annotIds.end();
1369 if (*compIt == idh) {
1373 if (compIt == annotIds.end()) {
1374 annotIds.push_back(idh);
1379 for (vector<CSeq_id_Handle>::const_iterator idIt = annotIds.begin();
1380 idIt != annotIds.end();
1389 for (; itGenes; ++itGenes) {
1413 for (; itOther; ++itOther) {
1415 (itOther)->GetOriginalFeature()));
1446 if (
auto parent =
mTree.GetParent(*it); parent) {
1447 auto subtype = parent.GetOriginalFeature().GetData().GetSubtype();
1485 const string& qualKey,
1486 const string& qualVal)
1498 const string& qualKey)
1509 const string& qualKey,
1510 const string& qualVal)
1514 if (!existing.empty()) {
1523 const string& proteinIdStr)
1532 pEditedFeat->
Assign(origFeat);
1533 pEditedFeat->
SetProduct().SetWhole(*pProteinId);
1542 const int WIDTH = 6;
1545 if (suffix.size() < WIDTH) {
1546 suffix =
padding.substr(0, WIDTH - suffix.size()) + suffix;
1548 string nextTag(
"auto");
1549 return nextTag + suffix;
1556 const int WIDTH = 6;
1559 if (suffix.size() < WIDTH) {
1560 suffix =
padding.substr(0, WIDTH - suffix.size()) + suffix;
1571 const string dbPrefix(
"gnl|");
1592 if (locusTag.empty() &&
1598 string prefix, suffix;
1611 const string dbPrefix(
"gnl|");
1631 if (locusTag.empty() &&
1638 string prefix, suffix;
1644 return transcriptId;
1657 auto& baseId = *baseLoc.
GetId();
1659 if (sequenceSize == 0 || baseStart <= baseStop) {
1661 pEnvelope->
SetId(baseId);
1662 pEnvelope->
SetInt().SetFrom(baseStart);
1663 pEnvelope->
SetInt().SetTo(baseStop);
1669 pTop->
SetId().Assign(baseId);
1671 pTop->
SetTo(sequenceSize-1);
1675 pBottom->
SetId().Assign(baseId);
1677 pBottom->
SetTo(baseStop);
1684 pBottom->
SetId().Assign(baseId);
1686 pBottom->
SetTo(baseStop);
1690 pTop->
SetId().Assign(baseId);
1692 pTop->
SetTo(sequenceSize-1);
1727 const string& message)
1756 string message = subName +
" feature is missing locus tag.";
1777 string message = subName +
" feature is missing transcript ID.";
1784 const string codonRecognized)
1790 string message =
"tRNA with bad codon recognized attribute \"" +
1791 codonRecognized +
"\".";
1812 string message = subName +
" feature is missing protein ID.";
1830 xPutError(
"Protein ID on mRNA feature differs from protein ID on child CDS.");
1846 xPutError(
"Transcript ID on mRNA feature differs from transcript ID on child CDS.");
1856 stringstream strstr;
1857 auto&
id = mf.
GetId();
1858 switch (
id.Which()) {
1860 return "\"UNKNOWN ID\"";
1862 id.GetLocal().AsString(strstr);
1863 return strstr.str();
1884 if (geneRef.IsSetLocus_tag()) {
1886 string prefix, suffix;
1890 auto locusTagFromQualifier = geneFeature.
GetNamedQual(
"locus_tag");
1891 if (!locusTagFromQualifier.empty()) {
1892 string prefix, suffix;
1902 if (feature.
Empty())
1923 auto append_nonduplicated_item = [](list<string>& current_list,
1924 const list<string>& other_list)
1926 unordered_set<string> current_set;
1927 for (
const auto& item : current_list) {
1928 current_set.insert(item);
1931 for (
const auto& item : other_list) {
1932 if (current_set.find(item) == current_set.end()) {
1933 current_list.push_back(item);
1939 append_nonduplicated_item(current_ref.
SetName(),
1948 append_nonduplicated_item(current_ref.
SetEc(),
1953 append_nonduplicated_item(current_ref.
SetActivity(),
1958 for (
const auto& pDBtag : other_ref.
GetDb()) {
1959 current_ref.
SetDb().push_back(pDBtag);
1982 const string& product_name = cds.
GetNamedQual(
"product");
1984 prot_ref.
SetName().push_back(product_name);
1988 if (pMrna.
Empty()) {
1993 for (
auto& prot_name : prot_ref.
SetName()) {
2011 feature.
SetId().SetLocal().SetId(
id++);
2020 if (feat.NotEmpty() && feat->IsSetData() && feat->GetData().IsCdregion())
2043 bool was_extended =
false;
2044 if (replacement.
Empty())
2050 if (protein.
Empty())
2060 protein_entry->
SetSeq(*protein);
2080 if (protein->
GetId().empty())
2082 const string* protein_ids = 0;
2084 qual_to_remove =
"protein_id";
2085 protein_ids = &cd_feature.
GetNamedQual(qual_to_remove);
2087 if (protein_ids->empty())
2089 qual_to_remove =
"orig_protein_id";
2090 protein_ids = &cd_feature.
GetNamedQual(qual_to_remove);
2093 if (protein_ids->empty())
2099 if (protein_ids->empty())
2104 if (!protein_ids->empty())
2109 MergeSeqIds(*protein, new_ids);
2118 if (protein->
GetId().empty())
2120 if (base_name.empty() && !bioseq.GetId().empty())
2125 newid = GetNewProteinId(*m_scope, base_name);
2126 protein->
SetId().push_back(newid);
2132 CSeq_feat& prot_feat = CreateOrSetFTable(*protein);
2142 prot_ref.
SetName().push_back(
"hypothetical protein");
2144 cd_feature.
SetProtXref().SetName().push_back(
"hypothetical protein");
2152 prot_feat.
SetLocation().SetInt().SetId().Assign(*GetAccessionId(protein->
GetId()));
2156 cd_feature.
SetProduct().SetWhole().Assign(*GetAccessionId(protein->
GetId()));
2181 auto& ext = mrna_feature.
SetData().SetRna().SetExt();
2183 (ext.IsName() && ext.SetName().empty()))
2184 ext.SetName() = prot_ref.
GetName().front();
2208 return protein_entry;
2217 if (objectId.
IsStr()) {
2218 return objectId.
GetStr();
2232 for (
auto pThisFeat: thisFeatures) {
2234 if (!pThisFeat->IsSetId() || !pThisFeat->GetId().IsLocal()) {
2237 const auto& this_oid = pThisFeat->GetId().GetLocal();
2240 for (
auto pOtherFeat: otherFeatures) {
2241 if (!pOtherFeat->IsSetId() || !pOtherFeat->GetId().IsLocal()) {
2242 thisFeatures.push_back(pOtherFeat);
2245 const auto& other_oid = pOtherFeat->GetId().GetLocal();
2247 thisFeatures.push_back(pOtherFeat);
2251 thisFeatures.push_back(pOtherFeat);
2277 string oldFeatIdAsStr;
2278 if (oldFeatId.
IsStr()) {
2279 oldFeatIdAsStr = oldFeatId.
GetStr();
2285 string newFeatIdAsStr = oldFeatIdAsStr +
"x";
2287 pNewFeatId->
SetStr(oldFeatIdAsStr +
"x");
2289 pNewFeatId->
SetStr() +=
"x";
2293 pBaseFeat->SetId().SetLocal(*pNewFeatId);
2297 for (
auto it = featMap.
begin(); it != featMap.
end(); ++it) {
2298 auto pFeat = it->second;
2299 for (
auto& pXref: pFeat->SetXref()) {
2300 if (!pXref->IsSetId() || !pXref->GetId().IsLocal()) {
2304 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 xGenerateMissingMrnaForCds(const CMappedFeat &cds)
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 xGenerateMissingGeneForFeats(const SAnnotSelector &sel, const CGff3LocationMerger *=nullptr)
void xPutErrorMissingProteinId(CMappedFeat)
string xNextProteinId(const CMappedFeat &)
void xGenerateMissingGeneForFeat(const CMappedFeat &feat)
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 s_IsGenbankId(const string &id)
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)
static bool s_IsGeneralId(const string &id)
static const char * str(char *buf, int n)
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.