92 switch (id->
Which()) {
114 ITERATE (vector<CSeq_id_Handle>, it, unique_ids) {
119 unique_ids.push_back(idh);
139 const bool bHtml =
ctx.Config().DoHTML();
150 switch (idh.
Which()) {
186 vector<CSeq_id_Handle> unique_ids;
212 ITERATE (vector<CSeq_id_Handle>, it, unique_ids) {
228 if (cds_seq_id && cds_seq_id->
IsGi()) {
250 replace( it->begin(), it->end(),
'\"',
'\'' );
270 bool containsHostLine =
false;
275 containsHostLine =
true;
302 m_DBSource.push_back(
"punctuation in sequence");
307 const char*
type =
nullptr;
308 switch ((*it)->Which()) {
319 xrefs.push_back(
type + (*it)->GetSeqIdString(
true));
322 if ( !xrefs.empty() ) {
346 if( ! containsHostLine ) {
391 string s(
"created: ");
397 string s(
"sequence updated: ");
403 string s(
"annotation updated: ");
419 xrefs.push_back(acc);
443 if ( !xrefs.empty() ) {
451 string id = (
tag.IsStr() ?
tag.GetStr()
453 string db = (*it)->GetDb();
455 if (
ctx.Config().DoHTML()) {
458 "https://omim.org/entry/" +
id
459 +
"\">" +
id +
"</a>");
461 xrefs.push_back(
"MIM:" +
id);
466 if(
id.substr(0, db.length() + 1) == (db +
":") ) {
469 xrefs.push_back(db +
':' +
id);
474 (
"xrefs (non-sequence databases): " +
NStr::Join(xrefs,
", "));
508 *it += (&*it == &
m_DBSource.back() ?
'.' :
';');
525 string s(
"deposition: ");
538 if ( !rep.
GetIds().empty() ) {
542 string s(
"replacement date: ");
547 *it += (&*it == &
m_DBSource.back() ?
'.' :
';');
577 string s(
"pdb: "), sep;
591 s += sep +
"release ";
603 string s, sep, comma, ht;
604 bool is_uniprot =
false;
614 s +=
"locus " + tsid->
GetName();
635 s += comma + sep +
"accession " + ht;
664 const string & a_source = *source_iter;
665 if( ! answer.empty() ) {
669 const static string kMmdbIdPrefix =
"Mmdb_id:";
675 answer +=
" <a href=\"" + url + url_suffix +
"\">";
676 answer += url_suffix;
687 const string & a_source,
690 string & out_url_suffix )
692 const static struct {
695 bool m_must_be_all_digits;
696 } potentialPrefixes[] = {
697 {
"Mmdb_id:",
"https://www.ncbi.nlm.nih.gov/Structure/mmdb/mmdbsrv.cgi?uid=",
true }
700 const static size_t numPotentialPrefixes =
sizeof(potentialPrefixes)/
sizeof(potentialPrefixes[0]);
702 for(
size_t idx = 0; idx < numPotentialPrefixes; ++idx ) {
703 const string & prefix = potentialPrefixes[idx].m_prefix;
704 const string & url = potentialPrefixes[idx].m_url;
705 const bool must_be_all_digits = potentialPrefixes[idx].m_must_be_all_digits;
707 if( a_source.length() <= prefix.length() ) {
716 string::size_type first_non_space_pos = prefix.length();
717 for( ; first_non_space_pos < a_source.length(); ++first_non_space_pos ) {
718 if( !
isspace(a_source[first_non_space_pos]) ) {
722 if( first_non_space_pos >= a_source.length() ) {
727 if( must_be_all_digits ) {
728 bool non_digit_found =
false;
729 string::size_type test_pos = first_non_space_pos;
730 for( ; test_pos < a_source.length(); ++test_pos ) {
731 if( !
isdigit(a_source[test_pos]) ) {
732 non_digit_found =
true;
736 if( non_digit_found ) {
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
const CFlatFileConfig & Config(void) const
void x_AddSPBlock(CBioseqContext &ctx)
string x_FormatPDBSource(const CPDB_block &pdb)
void Format(IFormatter &formatter, IFlatTextOStream &text_os) const override
void x_AddPDBBlock(CBioseqContext &ctx)
bool x_ExtractLinkableSource(const string &a_source, string &out_prefix, string &out_url, string &out_url_suffix)
void x_AddPIRBlock(CBioseqContext &ctx)
void x_GatherInfo(CBioseqContext &ctx) override
string x_FormatDBSourceID(const CSeq_id_Handle &idh)
EItem GetItemType() const override
void x_AddPRFBlock(CBioseqContext &ctx)
CTime AsCTime(CTime::ETimeZone tz=CTime::eLocal) const
const IHTMLFormatter & GetHTMLFormatter() const
CBioseqContext * GetContext(void)
void x_SetObject(const CSerialObject &obj)
namespace ncbi::objects::
Seq-loc iterator class – iterates all intervals from a seq-loc in the correct order.
Include a standard set of the NCBI C++ Toolkit most basic headers.
static bool s_HasLocalBioseq(const CSeq_loc &loc, const CSeq_entry_Handle &tse)
static void s_FormatDate(const CDate &date, string &str)
static void s_AddToUniqueIdList(const CSeq_id_Handle &idh, vector< CSeq_id_Handle > &unique_ids)
static const CSeq_id_Handle s_FindBestChoiceForDbsource(const CSeq_id_Handle &idh, CScope &scope)
static int s_ScoreForDBSource(const CSeq_id_Handle &idh)
static const char * str(char *buf, int n)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
const TPrim & Get(void) const
string GetSeqIdString(bool with_version=false) const
Return seqid string with optional version for text seqid type.
CConstRef< CSeq_id > GetSeqId(void) const
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
CSeq_id::E_Choice Which(void) const
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
const CSeq_feat * GetCDSForProduct(const CBioseq &product, CScope *scope)
Get the encoding CDS feature of a given protein sequence.
const CSeq_feat * GetPROTForProduct(const CBioseq &product, CScope *scope)
Get the mature peptide feature of a protein.
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
TIds GetIds(const CSeq_id &id, TGetFlags flags=0)
Get "native" bioseq ids without filtering and matching.
CBioseq_Handle GetBioseqHandleFromTSE(const CSeq_id &id, const CTSE_Handle &tse)
Get bioseq handle for sequence withing one TSE.
vector< CSeq_id_Handle > TId
CScope & GetScope(void) const
Get scope this handle belongs to.
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
const TId & GetId(void) const
#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 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 string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
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 TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string.
@ eNocase
Case insensitive compare.
string AsString(const CTimeFormat &format=kEmptyStr, TSeconds out_tz=eCurrentTimeZone) const
Transform time to string.
C::value_type FindBestChoice(const C &container, F score_func)
Find the best choice (lowest score) for values in a container.
bool IsStr(void) const
Check if variant Str is selected.
const TDb & GetDb(void) const
Get the Db member data.
const TStr & GetStr(void) const
Get the variant data.
TId GetId(void) const
Get the variant data.
const TLocation & GetLocation(void) const
Get the Location member data.
TChain GetChain(void) const
Get the Chain member data.
bool IsSetChain_id(void) const
chain identifier; length-independent generalization of 'chain' Check if a value has been assigned to ...
bool IsSetChain(void) const
Deprecated: 'chain' can't support multiple character PDB chain identifiers (introduced in 2015).
const TName & GetName(void) const
Get the Name member data.
bool CanGetName(void) const
Check if it is safe to call GetName method.
E_Choice Which(void) const
Which variant is currently selected.
bool IsSwissprot(void) const
Check if variant Swissprot is selected.
TGi GetGi(void) const
Get the variant data.
TVersion GetVersion(void) const
Get the Version member data.
bool CanGetVersion(void) const
Check if it is safe to call GetVersion method.
const TMol & GetMol(void) const
Get the Mol member data.
bool CanGetRel(void) const
Check if it is safe to call GetRel method.
bool CanGetAccession(void) const
Check if it is safe to call GetAccession method.
const TChain_id & GetChain_id(void) const
Get the Chain_id member data.
const TGeneral & GetGeneral(void) const
Get the variant data.
bool IsGi(void) const
Check if variant Gi is selected.
const TRel & GetRel(void) const
Get the Rel member data.
const TAccession & GetAccession(void) const
Get the Accession member data.
@ e_Gibbmt
Geninfo backbone moltype.
@ e_Giim
Geninfo import id.
@ e_Other
for historical reasons, 'other' = 'refseq'
@ e_Tpe
Third Party Annot/Seq EMBL.
@ e_Tpd
Third Party Annot/Seq DDBJ.
@ e_Gibbsq
Geninfo backbone seqid.
@ e_General
for other databases
@ e_Gi
GenInfo Integrated Database.
@ e_not_set
No variant selected.
@ e_Tpg
Third Party Annot/Seq Genbank.
const TPdb & GetPdb(void) const
Get the variant data.
const TSp & GetSp(void) const
Get the variant data.
const TPrf & GetPrf(void) const
Get the variant data.
const TPir & GetPir(void) const
Get the variant data.
@ e_Pir
PIR specific info.
@ e_Prf
PRF specific information.
@ e_Sp
SWISSPROT specific info.
@ e_Pdb
PDB specific information.
const TDate & GetDate(void) const
Get the Date member data.
const TSource & GetSource(void) const
Get the Source member data.
const TExp_method & GetExp_method(void) const
Get the Exp_method member data.
bool IsSetSource(void) const
Check if a value has been assigned to Source data member.
bool CanGetExp_method(void) const
Check if it is safe to call GetExp_method method.
const TReplace & GetReplace(void) const
Get the Replace member data.
const TClass & GetClass(void) const
Get the Class member data.
bool CanGetReplace(void) const
Check if it is safe to call GetReplace method.
const TDeposition & GetDeposition(void) const
Get the Deposition member data.
const TIds & GetIds(void) const
Get the Ids member data.
bool CanGetSeqref(void) const
Check if it is safe to call GetSeqref method.
const TCross_reference & GetCross_reference(void) const
Get the Cross_reference member data.
THad_punct GetHad_punct(void) const
Get the Had_punct member data.
const TIncludes & GetIncludes(void) const
Get the Includes member data.
const TSummary & GetSummary(void) const
Get the Summary member data.
const TPlacement & GetPlacement(void) const
Get the Placement member data.
bool CanGetSummary(void) const
Check if it is safe to call GetSummary method.
bool CanGetHad_punct(void) const
Check if it is safe to call GetHad_punct method.
bool CanGetCross_reference(void) const
Check if it is safe to call GetCross_reference method.
bool CanGetSource(void) const
Check if it is safe to call GetSource method.
const THost & GetHost(void) const
Get the Host member data.
bool CanGetDate(void) const
Check if it is safe to call GetDate method.
bool CanGetPlacement(void) const
Check if it is safe to call GetPlacement method.
bool CanGetSuperfamily(void) const
Check if it is safe to call GetSuperfamily method.
const TSource & GetSource(void) const
Get the Source member data.
bool CanGetHost(void) const
Check if it is safe to call GetHost method.
list< CRef< CSeq_id > > TSeqref
const TSeqref & GetSeqref(void) const
Get the Seqref member data.
const TSuperfamily & GetSuperfamily(void) const
Get the Superfamily member data.
bool CanGetIncludes(void) const
Check if it is safe to call GetIncludes method.
const TDate & GetDate(void) const
Get the Date member data.
const TGenetic & GetGenetic(void) const
Get the Genetic member data.
bool CanGetGenetic(void) const
Check if it is safe to call GetGenetic method.
const TTaxon & GetTaxon(void) const
Get the Taxon member data.
const TPart & GetPart(void) const
Get the Part member data.
const TExtra_src & GetExtra_src(void) const
Get the Extra_src member data.
bool CanGetState(void) const
Check if it is safe to call GetState method.
const THost & GetHost(void) const
Get the Host member data.
const TStrain & GetStrain(void) const
Get the Strain member data.
bool CanGetHost(void) const
Check if it is safe to call GetHost method.
const TState & GetState(void) const
Get the State member data.
bool CanGetStrain(void) const
Check if it is safe to call GetStrain method.
bool CanGetExtra_src(void) const
Check if it is safe to call GetExtra_src method.
bool CanGetTaxon(void) const
Check if it is safe to call GetTaxon method.
bool CanGetPart(void) const
Check if it is safe to call GetPart method.
TImeth GetImeth(void) const
Get the Imeth member data.
const TExtra_acc & GetExtra_acc(void) const
Get the Extra_acc member data.
TClass GetClass(void) const
Get the Class member data.
bool CanGetCreated(void) const
Check if it is safe to call GetCreated method.
bool CanGetDbref(void) const
Check if it is safe to call GetDbref method.
bool CanGetPlasnm(void) const
Check if it is safe to call GetPlasnm method.
const TCreated & GetCreated(void) const
Get the Created member data.
bool CanGetAnnotupd(void) const
Check if it is safe to call GetAnnotupd method.
bool CanGetExtra_acc(void) const
Check if it is safe to call GetExtra_acc method.
bool CanGetSeqref(void) const
Check if it is safe to call GetSeqref method.
list< CRef< CSeq_id > > TSeqref
const TDbref & GetDbref(void) const
Get the Dbref member data.
const TPlasnm & GetPlasnm(void) const
Get the Plasnm member data.
const TAnnotupd & GetAnnotupd(void) const
Get the Annotupd member data.
list< CRef< CDbtag > > TDbref
const TSequpd & GetSequpd(void) const
Get the Sequpd member data.
const TSeqref & GetSeqref(void) const
Get the Seqref member data.
bool CanGetSequpd(void) const
Check if it is safe to call GetSequpd method.
@ eClass_standard
conforms to all SWISSPROT checks
@ eClass_prelim
only seq and biblio checked
const CharType(& source)[N]
Useful/utility classes and methods.
void DateToString(const CDate &date, string &str, EDateToString format_choice=eDateToString_regular)
bool ConvertQuotesNotInHTMLTags(string &str)