63 static const string kCommonUrl =
"https://www.ncbi.nlm.nih.gov";
67 const string& tax_id_file,
77 bool is_na = bsh.
IsNa();
85 bool genome_specific_search =
false;
86 if ( !tax_id_file.empty() ) {
92 if (tax_id == NStr::StringToNumeric<TTaxId>(line)) {
93 genome_specific_search =
true;
102 string source_id_str;
114 entrezdb_tag =
"/nucest/";
116 entrezdb_tag =
"/nucgss/";
118 entrezdb_tag =
"/nuccore/";
121 entrezdb_tag =
"/protein/";
127 typedef pair<string, string>
TPair;
129 TPair(
"GenBank record",
"report=genbank"),
130 TPair(
"FASTA record",
"report=fasta"),
133 string type =
"Extra";
138 for (
size_t i = 0;
i <
size; ++
i) {
140 label = source_id_str;
146 url = entrezdb_tag + source_id_str +
"?" +
tag;
155 label = source_id_str;
156 string params(
"QUERY=" + source_id_str);
158 params +=
"&QUERY_FROM=";
160 params +=
"&QUERY_TO=";
164 string extra_params(
"&");
171 "BLAST_PROGRAMS=megaBlast&"
172 "PAGE_TYPE=BlastSearch&"
180 "BLAST_PROGRAMS=blastp&"
181 "PAGE_TYPE=BlastSearch&"
184 url =
"/blast/Blast.cgi?" + params + extra_params;
188 if (genome_specific_search) {
190 params +=
"&PROGRAM=tblastn";
192 name =
"BLAST to Genome";
193 url =
"/genome/seq/BlastGen/BlastGen.cgi?taxid=";
204 const string& tax_id_file,
207 bool exclude_self_links)
214 if ( !loc_obj.
GetId() ) {
228 const string& tax_id_file,
232 bool exclude_self_links)
236 bool is_na = bsh.
IsNa();
246 bool genome_specific_search =
false;
247 if ( !tax_id_file.empty() ) {
253 if (tax_id == NStr::StringToNumeric<TTaxId>(line)) {
254 genome_specific_search =
true;
263 string source_id_str;
282 entrezdb_tag =
"/nucest/";
284 entrezdb_tag =
"/nucgss/";
286 entrezdb_tag =
"/nuccore/";
289 entrezdb_tag =
"/protein/";
300 string product_id_str;
301 bool is_product_na =
false;
307 is_product_na = bsh.
IsNa();
319 string type =
"Extra";
323 if (
range.GetLength() > 5) {
324 typedef pair<string, string>
TPair;
326 TPair(
"GenBank record",
"report=genbank"),
327 TPair(
"FASTA record",
"report=fasta"),
332 if (!exclude_self_links) {
333 for (
size_t i = 0;
i <
size; ++
i) {
335 label = source_id_str + range_str;
342 url = entrezdb_tag + source_id_str +
"?" +
tag +
355 label = source_id_str + range_str;
356 url =
"/blast/Blast.cgi?";
357 string params(
"QUERY=" + source_id_str);
358 string extra_params(
"&");
360 params +=
"&QUERY_FROM=";
362 params +=
"&QUERY_TO=";
371 "BLAST_PROGRAMS=megaBlast&"
372 "PAGE_TYPE=BlastSearch&"
380 "BLAST_PROGRAMS=blastp&"
381 "PAGE_TYPE=BlastSearch&"
384 url = url + params + extra_params;
388 if (genome_specific_search) {
390 params +=
"&PROGRAM=tblastn";
392 name =
"BLAST to Genome";
393 label = source_id_str + range_str;
394 url =
"/genome/seq/BlastGen/BlastGen.cgi?taxid=";
405 product_db =
"/nuccore/";
407 product_db =
"/protein/";
413 typedef pair<string, string>
TPair;
415 TPair(
"GenBank record",
"report=genbank"),
416 TPair(
"FASTA record",
"report=fasta"),
417 TPair(
"Graphical View",
"report=graph")
422 for (
size_t i = 0;
i <
size; ++
i) {
424 if ( !is_product_na ) {
428 url = product_db + product_id_str +
"?" +
tag;
437 string params(
"QUERY=" + product_id_str);
438 string extra_params(
"&");
441 extra_params +=
"PAGE=Nucleotides&"
444 "BLAST_PROGRAMS=megaBlast&"
445 "PAGE_TYPE=BlastSearch&"
449 extra_params +=
"PAGE=Proteins&"
451 "BLAST_PROGRAMS=blastp&"
452 "PAGE_TYPE=BlastSearch&"
456 url =
"/blast/Blast.cgi?" + params + extra_params;
460 if (genome_specific_search) {
461 if (!is_product_na) {
462 params +=
"&PROGRAM=tblastn";
464 name =
"BLAST to Genome";
465 url =
"/genome/seq/BlastGen/BlastGen.cgi?taxid=";
499 if ( (*iter)->GetType().IsStr() &&
502 if ((*link_iter)->GetData().IsStr()) {
503 url = (*link_iter)->GetData().GetStr();
504 if ( !url.empty() && (*link_iter)->GetLabel().IsStr()) {
505 label = (*link_iter)->GetLabel().GetStr();
507 size_t pos =
label.find_first_of(
":");
508 if (pos != string::npos) {
541 if ( !
label.empty() ) {
543 url =
"/dbvar/variants/" +
label;
550 if ((*iter)->GetType().IsStr() &&
551 !(*iter)->GetData().empty()) {
552 name =
"Other Variant Calls from this Sample";
553 if ((*iter)->GetType().GetStr() ==
"related calls") {
555 if (fields.size() < 5) {
557 label = (*f_iter)->GetLabel().GetStr();
558 url =
"/dbvar/variants/" + (*f_iter)->GetData().GetStr();
574 url =
"/dbvar/?term=" + term;
578 }
else if ((*iter)->GetType().GetStr() ==
"related call count") {
581 if ((*f_iter)->GetLabel().IsStr() && (*f_iter)->GetData().IsStr()) {
582 label = (*f_iter)->GetLabel().GetStr();
583 term = (*f_iter)->GetData().GetStr();
588 if ( !term.empty() ) {
593 url =
"/dbvar/?term=" + term;
615 string product_id_str;
616 bool is_product_na =
false;
620 is_product_na = bsh.
IsNa();
629 string type =
"Extra";
630 string name =
"BLAST ";
634 string params(
"QUERY=" + product_id_str);
635 string extra_params(
"&");
638 extra_params +=
"PAGE=Nucleotides&"
641 "BLAST_PROGRAMS=megaBlast&"
642 "PAGE_TYPE=BlastSearch&"
647 extra_params +=
"PAGE=Proteins&"
649 "BLAST_PROGRAMS=blastp&"
650 "PAGE_TYPE=BlastSearch&"
654 url =
"/blast/Blast.cgi?" + params + extra_params;
661 bool add_parent_gene_dbxrefs,
669 if (!loc_obj.
GetId()) {
684 bool add_parent_gene_dbxrefs,
713 string type =
"Basic";
714 string name =
"SNP summary";
715 string label =
"rs" + rsid;
716 string url =
"/snp/rs" + rsid;
727 name =
"Genotype information";
728 url =
"/snp/rs" + rsid +
"#frequency_tab";
737 url =
"/projects/SNP/snp3D.cgi?rsnum=" + rsid;
745 name =
"OMIM information";
746 url =
"/projects/SNP/snp_redirect.cgi?snp_id=" + rsid;
765 for ( ; feat_iter; ++feat_iter) {
772 if( !sGeneLocus.empty() ) {
773 name =
"Variation viewer";
774 label +=
" (" + sGeneLocus +
")";
775 url =
"/sites/varvu?rs=" + rsid +
"&gene=" + sGeneLocus;
787 const string&
type,
const string& name,
788 const string&
label,
const string& url,
791 string edited_url(url);
803 ((links[
type])[name]).push_back(std::pair<string, string>(
label, edited_url));
812 bool add_parent_gene_dbxrefs,
815 string type =
"Basic";
822 switch ((*iter)->GetType()) {
828 (*iter)->GetLabel(&label_str);
829 size_t pos = label_str.find(
":");
831 pos = label_str.rfind(
" ");
835 name = label_str.substr(0, pos);
836 label = label_str.substr(pos + 1);
841 url = tax_id !=
ZERO_TAX_ID ? (*iter)->GetUrl(tax_id) : (*iter)->GetUrl();
843 if (
label.empty() || url.empty()) {
870 gene_symbol_feat =
NULL;
873 if (gene_symbol_feat.
Empty()) {
877 int gene_id = (*iter)->GetTag().GetId();
886 feat_iter->GetNamedDbxref(
"GeneID");
887 if (
tag &&
tag->GetTag().GetId() == gene_id) {
888 gene_symbol_feat = feat_iter->GetSeq_feat();
897 if (!gene_symbol.empty()) {
898 label +=
" (" + gene_symbol +
")";
User-defined methods of the data storage class.
static void AddDbxrefFeatureLinks(const objects::CSeq_feat &feat, const objects::CBioseq_Handle &handle, TLinksMap &links, bool add_parent_gene_dbxrefs=true, bool relative=true)
static void AddSequenceLinks(const objects::CSeq_id_Handle &idh, const string &tax_id_file, objects::CScope &scope, TLinksMap &links, TSeqPos from=0, TSeqPos to=0, bool relative=true)
static void AddDbxrefLinksForSNP(const objects::CSeq_feat &feat, const CRef< objects::CDbtag > &dbt, objects::CScope &scope, TLinksMap &links, bool relative=true)
static void AddBlastProductLink(const objects::CSeq_feat &feat, objects::CScope &scope, TLinksMap &links, bool relative)
static void AddFeatureLinks(const objects::CSeq_feat &feat, const objects::CBioseq_Handle &handle, const string &tax_id_file, TLinksMap &links, bool relative=true, bool exclude_self_links=false)
static void x_AddLink(TLinksMap &links, const string &type, const string &name, const string &label, const string &url, bool relative=true)
static void x_AddDbxrefFeatureLinks(const objects::CSeq_feat &feat, const objects::CSeq_loc &loc, objects::CScope &scope, objects::CBioseq_Handle &bsh, TTaxId tax_id, TLinksMap &links, bool add_parent_gene_dbxrefs=true, bool relative=true)
ESubtype GetSubtype(void) const
namespace ncbi::objects::
CConstRef< CDbtag > GetNamedDbxref(const CTempString &db) const
Return a specified DB xref.
CSnpBitfield is a facade for representing any version of the SNP bitfield.
bool IsTrue(EProperty prop) const
@ eHasSnp3D
Has 3D structure SNP3D.
static TRsid GetRsid(const CMappedFeat &mapped_feat)
Return rsid of SNP.
static const char location[]
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static const TPair sc_Pairs[]
SStaticPair< const char *, const char * > TPair
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
SStrictId_Tax::TId TTaxId
Taxon id type.
static objects::SAnnotSelector GetAnnotSelector(TAnnotFlags flags=0)
request an annotation selector for a given type
static CRef< objects::CSeq_loc > MixLocToLoc(const objects::CSeq_loc &mix_loc, const objects::CBioseq_Handle &handle)
Create a new seq-loc with a unique seq-id from a "mixed" loc.
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
static EAccessionInfo IdentifyAccession(const CTempString &accession, TParseFlags flags=fParse_AnyRaw)
Deduces information from a bare accession a la WHICH_db_accession; may report false negatives on prop...
CConstRef< CSeq_id > GetSeqId(void) const
EAccessionInfo
For IdentifyAccession (below)
CSeq_id::E_Choice Which(void) const
string GetLabel(const CSeq_id &id)
TRange GetTotalRange(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.
CMappedFeat GetBestGeneForMrna(const CMappedFeat &mrna_feat, CFeatTree *feat_tree=0, const SAnnotSelector *base_sel=0, CFeatTree::EBestGeneType lookup_type=CFeatTree::eBestGene_TreeOnly)
CMappedFeat GetBestGeneForCds(const CMappedFeat &cds_feat, CFeatTree *feat_tree=0, const SAnnotSelector *base_sel=0, CFeatTree::EBestGeneType lookup_type=CFeatTree::eBestGene_TreeOnly)
@ fFGL_Content
Include its content if there is any.
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,...
CSeq_id_Handle GetIdHandle(const CSeq_loc &loc, CScope *scope)
TTaxId GetTaxId(const CBioseq_Handle &handle)
return the tax-id associated with a given sequence.
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
TSeqPos GetBioseqLength(void) const
CScope & GetScope(void) const
Get scope this handle belongs to.
SAnnotSelector & IncludeFeatSubtype(TFeatSubtype subtype)
Include feature subtype in the search.
SAnnotSelector & SetResolveAll(void)
SetResolveAll() is equivalent to SetResolveMethod(eResolve_All).
const CSeq_feat & GetMappedFeature(void) const
Feature mapped to the master sequence.
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.
bool NotEmpty(void) const THROWS_NONE
Check if CConstRef is not empty – pointing to an object and has a non-null value.
TObjectType & GetObject(void) const
Get object.
static TThisType GetWhole(void)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
CNcbiIstream & NcbiGetlineEOL(CNcbiIstream &is, string &str, string::size_type *count=NULL)
Read from "is" to "str" the next line (taking into account platform specifics of End-of-Line)
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static string & Replace(const string &src, const string &search, const string &replace, string &dst, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a 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 EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
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 & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string.
@ fWithCommas
Use commas as thousands separator.
static const char label[]
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
bool IsSetLocus(void) const
Official gene symbol Check if a value has been assigned to Locus data member.
const TLocus & GetLocus(void) const
Get the Locus member data.
bool IsStr(void) const
Check if variant Str is selected.
const TTag & GetTag(void) const
Get the Tag member data.
bool IsId(void) const
Check if variant Id is selected.
const TDb & GetDb(void) const
Get the Db member data.
const TStr & GetStr(void) const
Get the variant data.
vector< CRef< CUser_field > > TData
TId GetId(void) const
Get the variant data.
vector< CRef< CDbtag > > TDbxref
E_Choice Which(void) const
Which variant is currently selected.
const TExts & GetExts(void) const
Get the Exts member data.
list< CRef< CUser_object > > TExts
const TLocation & GetLocation(void) const
Get the Location member data.
const TData & GetData(void) const
Get the Data member data.
const TDbxref & GetDbxref(void) const
Get the Dbxref member data.
bool CanGetLocation(void) const
Check if it is safe to call GetLocation method.
const TProduct & GetProduct(void) const
Get the Product member data.
bool IsSetExts(void) const
set of extensions; will replace 'ext' field Check if a value has been assigned to Exts data member.
const TGene & GetGene(void) const
Get the variant data.
bool IsSetDbxref(void) const
support for xref to other databases Check if a value has been assigned to Dbxref data member.
bool IsSetProduct(void) const
product of process Check if a value has been assigned to Product data member.
const TVariation & GetVariation(void) const
Get the variant data.
bool IsRna(void) const
Check if variant Rna is selected.
bool IsLocal(void) const
Check if variant Local is selected.
bool IsWhole(void) const
Check if variant Whole is selected.
@ eNa_strand_both
in forward orientation
const TSample_id & GetSample_id(void) const
Get the Sample_id member data.
const TId & GetId(void) const
Get the Id member data.
const TParent_id & GetParent_id(void) const
Get the Parent_id member data.
bool CanGetParent_id(void) const
Check if it is safe to call GetParent_id method.
bool CanGetSample_id(void) const
Check if it is safe to call GetSample_id method.
bool CanGetId(void) const
Check if it is safe to call GetId method.
static const string kCommonUrl
range(_Ty, _Ty) -> range< _Ty >
const struct ncbi::grid::netcache::search::fields::SIZE size
std::istream & in(std::istream &in_, double &x_)
Template structure SStaticPair is simlified replacement of STL pair<> Main reason of introducing this...