108 return (
r0.GetLength() <
r1.GetLength());
144 if (iter != sm_NameTypeMap.end()) {
156 for (iter = sm_NameTypeMap.begin(); iter != sm_NameTypeMap.end(); ++iter) {
157 if (iter->second ==
type) {
188 view = reg.
GetReadView(
"GBENCH.Utils.AnnotSelector");
190 if (view.
GetBool(
"ExcludeExternal")) {
199 static const char* named_annots[] = {
206 for (
const char** p = named_annots; p && *p; ++p) {
207 bool incl = view.
GetBool(*p,
true);
216 if (view.
GetBool(
"AdaptiveDepth",
true)) {
275 bool include_naas =
false;
277 if (include_naas && annots.empty()) {
281 ITERATE (vector<string>, iter, annots) {
282 const string& annot = *iter;
313 bool adaptive,
int depth)
325 sel.AddUnnamedAnnots();
328 sel.ExcludeUnnamedAnnots();
336 bool include_naas =
false;
338 sel.IncludeNamedAnnotAccession(
"NA*");
344 sel.AddNamedAnnots(annot);
346 sel.IncludeNamedAnnotAccession(annot);
357 return reg.
GetReadView(
"GBENCH.Utils.AnnotSelector");
362 return view.
GetInt(
"MaxSearchSegments", 0);
367 string max_search_segs_action = view.
GetString(
"MaxSearchSegmentsAction",
"silent");
370 if(max_search_segs_action ==
"throw") {
372 }
else if (max_search_segs_action ==
"log") {
376 return MaxSearchSegmentsAction;
381 if (
max > 0 && actual >
max) {
385 "CSeqUtils::CheckMaxSearchSegments: search segments limit exceeded");
391 ERR_POST(
"CSeqUtils::CheckMaxSearchSegments: search segments limit exceeded");
402 return view.
GetInt(
"MaxSearchTime", 0);
407 bool adaptive,
int depth)
410 sel.SetAdaptiveDepth(
true);
411 sel.SetExactDepth(
false);
420 sel.SetMaxSearchSegments(max_search_segs);
421 if(max_search_segs > 0) {
427 sel.SetResolveDepth(
depth);
429 }
else if (
depth >= 0) {
430 sel.SetResolveDepth(
depth);
431 sel.SetExactDepth(
true);
432 sel.SetAdaptiveDepth(
false);
443 template <
class T,
class U>
446 bool operator()(
const pair<T,U>& p1,
const pair<T,U>& p2)
const
448 return p1.first < p2.first;
466 feature::CFeatTree
tree;
467 tree.SetFeatIdMode(feature::CFeatTree::EFeatIdMode(
mode));
474 tree.AddFeature(curr_feat->GetMappedFeature());
475 fmap[curr_feat->GetMappedFeature()] = curr_feat;
482 CMappedFeat parent_feat =
tree.GetParent(curr_feat->GetMappedFeature());
484 fmap[parent_feat]->AddChild(curr_feat);
487 out_feats.push_back(curr_feat);
492 out_feats.swap(feats);
505 SRelLoc converter(dummy_parent, child, scope);
507 return converter.
Resolve(scope);
563 if ( !it_r->Empty() ) {
564 p_int.
AddInterval(
id, it_r->GetFrom(), it_r->GetTo());
567 switch (p_int.
Get().size()) {
593 if(it != loc_map.
end()) {
633 bioseq->
SetInst().SetLength((
int)seq_string.size());
647 bioseq->
SetId().push_back(
id);
652 id->GetLabel(&title_str);
656 bioseq->
SetDescr().Set().push_back(title);
669 if (handle.
IsSynonym(iter.GetSeq_id())) {
671 if ( !
range.Empty() ) {
673 range.GetTo(), iter.GetStrand());
677 switch (p_int.
Get().size()) {
703 }
else if (annot_handle.
IsNamed()) {
715 if ((*descrIter)->IsTitle()) {
716 name = (*descrIter)->GetTitle();
718 }
else if ((*descrIter)->IsName()) {
719 name = (*descrIter)->GetName();
730 if ((*descrIter)->IsUser()) {
731 const auto& user((*descrIter)->GetUser());
732 if(user.GetType().IsStr() && user.GetType().GetStr() ==
type && user.HasField(
label)) {
733 return user.GetFieldRef(
label);
757 if ((*descrIter)->IsComment()) {
758 return (*descrIter)->GetComment();
765 static bool s_IsNAA(
const string& annot,
char div)
772 size_t len = annot.size();
773 if (
len >= acc_len && annot[0] ==
'N' && annot[1] ==
'A') {
775 while (
i < acc_len && annot[
i] >=
'0' && annot[
i] <=
'9') {
780 if (
len == acc_len) {
783 else if (annot[
i++] == div) {
784 while (
i <
len && annot[
i] >=
'0' && annot[
i] <=
'9') {
810 return "rmt_pipleine_" + sSuffix;
821 return sFileType ==
"bigBed" || sFileType ==
"bigWig" || sFileType ==
"vcfTabix" || sFileType ==
"vcf";
827 size_t posHashSign{sAnnotName.find(
'#')};
829 if(posHashSign ==
NPOS) {
833 return s_IsNAA(sAnnotName, div);
836 if(!
s_IsNAA(sAnnotName.substr(0, posHashSign), div))
840 if(posHashSign == sAnnotName.length() - 1) {
843 for(
size_t i = posHashSign+1;
i<sAnnotName.length(); ++
i) {
844 if(sAnnotName[
i] <
'0' || sAnnotName[
i] >
'9') {
870 vector<string> parts;
874 return parts.size() > 1 ? parts[1] :
string();
880 vector<string> parts;
884 return parts.size() > 2 ? parts[2] :
string(
"N");
890 if (acc.size() < 3 || acc[1] !=
'R')
917 if (
data.IsGene() &&
data.GetGene().IsSetPseudo()) {
918 return data.GetGene().GetPseudo();
919 }
else if (
data.IsRna() &&
data.GetRna().IsSetPseudo()) {
920 return data.GetRna().GetPseudo();
974 static string base_url =
"https://www.ncbi.nlm.nih.gov";
981 return "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
993 return "<tr><td align=\"right\" valign=\"top\" nowrap><b>" +
tag + (
tag.empty() ?
"" :
":") +
" " +
994 "</b></td><td valign=\"top\" width=\"200\">" +
value +
"</td></tr>";
1000 return "<tr><td align=\"right\" nowrap>[<i>" +
tag +
"</i>] </td><td></td></tr>";
1005 const string&
label,
1008 return "<tr><td align=\"right\" valign=\"top\" nowrap><b>" +
tag +
": " +
1009 "</b></td><td width=\"200\"><a href=\"" + url +
"\">" +
label +
"</a></td></tr>";
1019 for (; aln_iter; ++aln_iter) {
1036 if (r_map.count(target_gi) == 0) {
1040 r_map[target_gi].CombineWith(
TSeqRange(from, to));
1046 ITERATE(TRangeMap, iter, r_map) {
1048 id->SetGi(iter->first);
1050 iter->second.GetTo()));
1051 mapped_locs.push_back(loc);
1057 "https://www.ncbi.nlm.nih.gov/sviewer/links.fcgi?link_name=gi_placement&report=asn";
1061 static string LinksUrl;
1062 if (LinksUrl.empty()) {
1072 timeout.
sec = time_out_sec;
1079 *obj_stream >> align_set;
1081 LOG_POST(
Error <<
"Failed to retrieve gi placements for gi|"
1082 << gi <<
", error: " << e.
GetMsg());
1149 *obj_stream >> align_set;
1165 timeout.
sec = time_out_sec;
1172 SourceFrom = loc.GetInt().GetFrom();
1173 SourceTo = loc.GetInt().GetTo();
1174 if(loc.GetInt().GetId().IsGi()) {
1175 SourceGi = loc.GetInt().GetId().GetGi();
1179 }
else if(loc.IsPnt()) {
1180 SourceFrom = loc.GetPnt().GetPoint();
1181 SourceTo = SourceFrom;
1182 if(loc.GetPnt().GetId().IsGi()) {
1183 SourceGi = loc.GetPnt().GetId().GetGi();
1190 if(SourceTo < SourceFrom) {
1191 swap(SourceTo, SourceFrom);
1200 *obj_stream >> align_set;
1202 LOG_POST(
Error <<
"Failed to retrieve location placements for gi|"
1203 << SourceGi <<
", error: " << e.
GetMsg());
1208 TRangeMap range_map;
1210 for(; aln_iter; ++aln_iter) {
1226 if (i_source_from > i_source_to) {
1227 swap(i_source_from, i_source_to);
1229 if(i_source_from <= SourceFrom && SourceTo <= i_source_to) {
1238 range_map[target_gi] =
TSignedSeqRange(from + (SourceFrom - i_source_from), from + (SourceTo - i_source_from));
1244 ITERATE (TRangeMap, iter, range_map) {
1246 id->SetGi(iter->first);
1248 mapped_locs.push_back(loc);
1255 long& from,
long& to)
1271 size_t len =
str.length();
1273 if (
len == 0)
return false;
1284 bool space_before_this =
false;
1285 bool separator_before_this =
false;
1286 for (
size_t i = 0;
i <
len; ++
i) {
1292 if ( !separator_before_this )
1293 space_before_this =
true;
1296 if (separator_before_this)
return false;
1298 space_before_this =
false;
1302 if (separator_before_this)
return false;
1304 space_before_this =
false;
1306 out_str.append(
"000");
1310 if (separator_before_this)
return false;
1312 space_before_this =
false;
1314 out_str.append(
"000000");
1320 space_before_this =
false;
1321 separator_before_this =
true;
1324 if (separator_before_this) {
1325 out_str.append(
"-");
1326 separator_before_this =
false;
1327 }
else if (space_before_this) {
1328 out_str.append(
"-");
1329 space_before_this =
false;
1331 out_str.append(1,
str[
i]);
1336 typedef vector<string> TPositions;
1339 if (pos.size() < 3) {
1341 bool is_from =
true;
1344 if (iter->empty())
continue;
1370 #ifdef NCBI_STRICT_GI
1373 uids_from.push_back(gi);
1384 LOG_POST(
Error <<
"Failed to get assembly entrez ids for gi: " << gi <<
". Error: " << e.
GetMsg());
1387 if (uids_to.empty())
1403 for (itNode = nodes.
begin(); itNode != nodes.
end(); ++itNode) {
1407 gc_ids.push_back(NStr::StringToNumeric<TEntrezId>(
id));
1423 assm->
Find(idh, sequences);
1427 if(replicon->IsSetName()) {
1428 return replicon->GetName();
1432 LOG_POST(
Error <<
"Call to GenColl timed out when getting assembly: " << *iGCId);
1460 for (
auto it : top_level_seqs) {
1461 const CSeq_id& tls_seq_id = it->GetSeq_id();
1462 ids.emplace_back(&tls_seq_id);
1490 string sNormalizedSeqId(seq_id.
AsFastaString() +
":" + assm_acc);
1500 if (scope && !assembly_ids.empty() && assembly_ids.front()->IsGi()) {
1503 bool all_checked =
true;
1504 for (
const auto&
id : assembly_ids) {
1508 all_checked =
false;
1511 if (id->GetGi() == gi) {
1526 for (
const auto&
id : assembly_ids) {
1527 if(
Match(seq_id, *
id, scope)) {
1537 }
catch (exception& e) {
1538 LOG_POST(
Error <<
"Call to GenColl timed out when getting assembly: " << assm_acc <<
", " << e.what());
1547 if(!id_str.empty() ) {
1549 seq_id->Set(id_str);
1550 objects::CBioseq_Handle bsh = scope.GetBioseqHandle(*seq_id);
1551 objects::CSeq_id_Handle shdl = bsh.GetAccessSeq_id_Handle();
1590 for (itAcc = doc_sums.
begin(); itAcc != doc_sums.
end(); ++itAcc) {
1598 template<
class T1,
class T2>
1599 static void s_ELinkQuery(
const string &db_from,
const string &db_to,
const vector<T1> &uids_from, vector<T2> &uids_to,
const string &
cmd,
const string &xpath)
1606 for (itLink = links.
begin(); itLink != links.
end(); ++itLink) {
1610 uids_to.push_back(NStr::StringToNumeric<T2>(
id));
1632 ecli.
Link(db_from, db_to, uids_from,
xml,
cmd);
1636 string docstr(sb.str());
1653 static void s_ESearchQuery(
const string &db,
const string &term, vector<T> &uids,
size_t &
count,
const int ret_max,
const string &xpath)
1663 string docstr(sb.str());
1668 for (itLink = links.
begin(); itLink != links.
end(); ++itLink) {
1672 uids.push_back(NStr::StringToNumeric<T>(
id));
1675 if (!countStr.empty())
1678 count = uids.size();
1687 static void s_ESearchQuery(
const string &db,
const string &term,
const string &web_env,
const string &query_key, vector<T> &uids,
size_t &
count,
int retstart,
const string &xpath)
1694 for (itLink = links.
begin(); itLink != links.
end(); ++itLink) {
1698 uids.push_back(NStr::StringToNumeric<T>(
id));
1701 if (!countStr.empty())
1704 count = uids.size();
1718 ecli.
SearchHistory(db, term, web_env, NStr::StringToNumeric<Int8>(query_key), retstart,
xml);
1722 string docstr(sb.str());
1725 searchset.
swap(doc);
1732 if (parent.
end() == itNode)
1751 #ifdef NCBI_STRICT_GI
1754 uids_from.push_back(gi);
1764 LOG_POST(
Error <<
"Failed to get assembly ids for gi: " << gi <<
". Error: " << e.
GetMsg());
1795 if (annot && annot.
IsNamed()) {
1796 const string& annot_str = annot.
GetName();
1805 CAlign_CI align_iter(scope, *aln_loc, sel);
1807 while (align_iter && !align_ref) {
1811 if (num_row != 2)
continue;
1819 align_ref.
Reset(&align);
1842 locs.push_back(prod_loc);
1843 locs.push_back(gen_loc);
1848 #undef MAP_INFO_DEBUG
1865 while (it1 && it2) {
1869 r1.GetLength() !=
r2.GetLength()) {
1879 int1->
SetId(*prod_id);
1886 int2->
SetId(*gen_id);
1890 info.emplace_back(int1, int2);
1902 const objects::CSeq_loc& feat_loc,
1904 const objects::CBioseq_Handle& handle)
1908 if (locs.size() == 2) {
1929 #ifdef MAP_INFO_DEBUG
1930 cout <<
"\n===== Original Map ==========\n";
1931 for (
const auto& it : cds_map_info) {
1932 auto gen_int = get<1>(it);
1933 auto prod_int = get<0>(it);
1934 cout << gen_int->GetFrom() <<
".." << gen_int->GetTo() <<
"->" << prod_int->GetFrom() <<
".." << prod_int->GetTo() << endl;
1936 cout <<
"\n========================\n";
1943 int curr_prod_pos = -1;
1944 int last_prod_pos = -1;
1946 auto cds_map_it = cds_map_info.begin();
1947 while (cds_map_it != cds_map_info.end()) {
1948 auto gen_int = cds_map_it->second;
1950 if ((gen_int->GetTo() - gen_int->GetFrom()) + 1 < 3) {
1951 cds_map_it = cds_map_info.erase(cds_map_it);
1955 auto prod_loc =
Ref(
new CSeq_loc(gen_int->SetId(), gen_int->GetFrom(), gen_int->GetTo(), gen_int->GetStrand()));
1956 auto mapped_prod_loc = map2prod.
Map(*prod_loc);
1957 auto mapped_gen_loc = map2loc.
Map(*mapped_prod_loc);
1959 #ifdef MAP_INFO_DEBUG
1964 cout <<
"Remapped to\n";
1969 list<TSeqRange> rngs;
1970 for (
size_t i = 0;
i < sz; ++
i, ++lit) {
1974 if (
i == 0 &&
r.GetLength() < 3) {
1977 if (
i == sz - 1 &&
r.GetLength() < 3)
1981 if (!rngs.empty()) {
1982 bool reverse = gen_int->CanGetStrand() && gen_int->GetStrand() ==
eNa_strand_minus;
1984 auto prod_int = cds_map_it->first;
1985 auto r_it = rngs.begin();
1988 gen_int->SetFrom(max<int>(r_it->GetFrom(), gen_int->GetFrom()));
1989 gen_int->SetTo(gen_int->GetTo());
1992 gen_int->SetFrom(gen_int->GetFrom());
1993 gen_int->SetTo(min<int>(r_it->GetTo(), gen_int->GetTo()));
1995 if (curr_prod_pos == -1) {
1996 curr_prod_pos = prod_int->SetFrom();
1998 else if (last_prod_pos != -1) {
1999 if (prod_int->SetFrom() - last_prod_pos > 0) {
2000 curr_prod_pos += (prod_int->SetFrom() - last_prod_pos);
2003 last_prod_pos = prod_int->GetTo() + 1;
2004 prod_int->SetFrom(curr_prod_pos);
2005 curr_prod_pos += (gen_int->GetTo() - gen_int->GetFrom());
2006 prod_int->SetTo(curr_prod_pos);
2009 while (r_it != rngs.end()) {
2013 auto from = curr_prod_pos;
2014 curr_prod_pos += r_it->GetLength() - 1;
2017 cds_map_it = cds_map_info.emplace(++cds_map_it, int1, int2);
2025 #ifdef MAP_INFO_DEBUG
2027 cout <<
"\n=====Final Map ==========\n";
2028 for (
const auto& it : cds_map_info) {
2029 auto& gen_int = get<1>(it);
2030 auto& prod_int = get<0>(it);
2031 cout << gen_int->GetFrom() <<
".." << gen_int->GetTo() <<
"->" << prod_int->GetFrom() <<
".." << prod_int->GetTo() << endl;
2033 cout <<
"\n========================\n";
2043 const int feat_offset)
2049 int cds_offset = -1;
2064 for (; feat_iter; ++feat_iter) {
2078 prod_id->
Assign(product_id);
2089 TMappingInfo::const_iterator iter = mapping_info.begin();
2091 while (iter != mapping_info.end() && !
done) {
2092 auto& gen_int = iter->second;
2093 auto& prod_int = iter->first;
2095 TSeqPos gen_from = gen_int->GetFrom();
2096 TSeqPos gen_to = gen_int->GetTo();
2097 TSeqPos prod_from = prod_int->GetFrom();
2098 TSeqPos prod_to = prod_int->GetTo();
2099 bool reverse = gen_int->CanGetStrand() && gen_int->GetStrand() ==
eNa_strand_minus;
2102 if (cds_map_info.empty()) {
2103 if (bio_start >= gen_from && bio_start <= gen_to) {
2105 TSeqPos off1 = reverse ? gen_to - bio_start : bio_start - gen_from;
2106 r1.Set(prod_from + off1, prod_to);
2108 r2.Set(gen_from, gen_to - off1);
2110 r2.Set(gen_from + off1, gen_to);
2112 if (cds_offset < 0 || (
TSeqPos)cds_offset >
r1.GetFrom()) {
2113 cds_offset =
int(
r1.GetFrom());
2117 r1.Set(prod_from, prod_to);
2118 r2.Set(gen_from, gen_to);
2122 if (!
r1.Empty() && !
r2.Empty()) {
2123 if (bio_stop >= gen_from && bio_stop <= gen_to) {
2125 TSeqPos off2 = reverse ? bio_stop - gen_from : gen_to - bio_stop;
2126 r1.SetTo(
r1.GetTo() - off2);
2127 if (reverse)
r2.SetFrom(
r2.GetFrom() + off2);
2128 else r2.SetTo(
r2.GetTo() - off2);
2135 int1->
SetFrom(
r1.GetFrom() - cds_offset);
2136 int1->
SetTo(
r1.GetTo() - cds_offset);
2137 int1->
SetId(*prod_id);
2143 int2->
SetId(*gen_id);
2147 cds_map_info.emplace_back(int1, int2);
2155 if ( !cds_map_info.empty() ) {
2169 cds_map_info.clear();
2182 if (!cds_map_info.empty() && (0 != feat_offset)) {
2183 if (feat_offset > 0) {
2184 auto& prod_int = cds_map_info.begin()->first;
2185 prod_int->SetFrom(prod_int->GetFrom() + feat_offset);
2186 auto& gen_int = cds_map_info.begin()->second;
2187 gen_int->SetFrom(gen_int->GetFrom() + feat_offset);
2190 auto& prod_int = cds_map_info.begin()->first;
2191 prod_int->SetFrom(prod_int->GetFrom() - feat_offset);
2192 auto& gen_int = cds_map_info.begin()->second;
2193 gen_int->SetTo(gen_int->GetTo() + feat_offset);
2196 return cds_map_info;
2201 const objects::CSeq_loc &feat_loc,
2202 const objects::CSeq_id &product_id,
2203 const int feat_offset
2208 gen_id->
Assign(*feat_loc.GetId());
2210 prod_id->
Assign(product_id);
2216 start +=
r.GetLength();
2219 info.emplace_back(int1, int2);
2222 if (!
info.empty() && (0 != feat_offset)) {
2223 if (feat_offset > 0) {
2224 auto& prod_int =
info.begin()->first;
2225 prod_int->SetFrom(prod_int->GetFrom() + feat_offset);
2226 auto& gen_int =
info.begin()->second;
2227 gen_int->SetFrom(gen_int->GetFrom() + feat_offset);
2230 auto& prod_int =
info.begin()->first;
2231 prod_int->SetFrom(prod_int->GetFrom() - feat_offset);
2232 auto& gen_int =
info.begin()->second;
2233 gen_int->SetTo(gen_int->GetTo() + feat_offset);
2246 if ( !loc_obj.
GetId() ) {
2250 loc.
Reset(&loc_obj);
2258 if (!named_acc.empty()) {
2289 auto GetCDSFrame = [&]() {
2306 int offset = GetCDSFrame();
2316 if (mrna_info.empty())
2327 static unsigned id_num{ 0 };
2328 int offset = GetCDSFrame();
2340 if (!gi_str)
return match;
2347 for (
size_t i = pos + 3;
i < sid.length(); ++
i) {
2350 gi_str->append(1, c);
2380 shown_desc->
SetType().SetStr(
"x-sv-track-settings");
2381 shown_desc->
AddField(
"show-track", isShown);
2382 annot.AddUserObject(*shown_desc);
2403 if (!
id &&
str.find(
'|') !=
NPOS) {
2419 mapper->MapObject(*
id);
2432 fuzz = loc_it.GetFuzzFrom();
2439 fuzz = loc_it.GetFuzzTo();
2464 TSeqPos pos = exon->GetGenomic_start();
2491 for (
CBioseq_CI bioseq_it(*handle); bioseq_it; ++bioseq_it) {
2493 if (bioseq_it->IsSetDescr()) {
2496 if (dit->GetPointer() == &seq_desc) {
2519 if (entry_ci->IsSetDescr()) {
2521 if ((*dit)->IsPub()) {
2523 if (&desc_pub == &pubdesc) {
2529 if (entry_ci->IsSeq()) {
2531 if (&(fi->GetData().GetPub()) == &pubdesc) {
2549 if (handles.size() > 0) {
2563 if (
f->GetSeq_feat() == &feat) {
2577 if (
f.IsSetLocation()) {
2579 if (subloc && !subloc.
IsEmpty()) {
2601 const objects::CSeq_entry* seqEntry =
dynamic_cast<const objects::CSeq_entry*
>(ptr);
2602 const objects::CBioseq* bioseq =
dynamic_cast<const objects::CBioseq*
>(ptr);
2603 const objects::CBioseq_set* bioseq_set =
dynamic_cast<const objects::CBioseq_set*
>(ptr);
2604 const objects::CSeq_annot* seqannot =
dynamic_cast<const objects::CSeq_annot*
>(ptr);
2605 const objects::CSeq_feat* seqfeat =
dynamic_cast<const objects::CSeq_feat*
>(ptr);
2606 const objects::CSeqdesc* seqdesc =
dynamic_cast<const objects::CSeqdesc*
>(ptr);
2607 const objects::CSeq_submit* seqsubmit =
dynamic_cast<const objects::CSeq_submit*
>(ptr);
2608 const objects::CPubdesc* pubdesc =
dynamic_cast<const objects::CPubdesc*
>(ptr);
2609 const objects::CSeq_loc* loc =
dynamic_cast<const objects::CSeq_loc*
>(ptr);
2610 const objects::CSeq_id* seq_id =
dynamic_cast<const objects::CSeq_id*
>(ptr);
2612 objects::CSeq_entry_Handle seh;
2619 seh = seh.GetTopLevelEntry();
2624 }
else if(bioseq_set) {
2629 }
else if(seqannot) {
2632 seh = sah.GetTopLevelEntry();
2633 }
else if(seqfeat) {
2638 }
else if (seqdesc) {
2641 seh = seh.GetTopLevelEntry();
2645 }
else if (pubdesc) {
2648 seh = seh.GetTopLevelEntry();
2652 }
else if (seqsubmit) {
2653 if (seqsubmit->IsEntrys() && seqsubmit->GetData().GetEntrys().front()) {
2661 }
else if (seq_id) {
2680 char ch1 = str1.c_str()[0];
2681 char ch2 = str2.c_str()[0];
2695 if (
ch1 ==
'~' &&
ch2 ==
'~') {
2697 }
else if (
ch1 ==
'~') {
2699 }
else if (
ch2 ==
'~') {
2702 if (
ch1 ==
'-' &&
ch2 ==
'-') {
2704 }
else if (
ch1 ==
'-') {
2706 }
else if (
ch2 ==
'-') {
2716 vector<const CFeatListItem * > r_list;
2733 vector<const CFeatListItem * > used;
2734 vector<const CFeatListItem * > popular;
2735 vector<const CFeatListItem * > import_feats;
2736 vector<const CFeatListItem * > least_liked;
2737 vector<const CFeatListItem * >
unused;
2743 int subtype =
f->GetSubtype();
2751 string desc =
f->GetDescription();
2752 if (existing.
find(desc) == existing.
end())
2756 if (!present[subtype]) {
2765 import_feats.push_back(
f);
2768 popular.push_back(
f);
2777 popular.push_back(
f);
2780 least_liked.push_back(
f);
2796 r_list.insert(r_list.begin(), popular.begin(), popular.end());
2797 r_list.insert(r_list.end(), used.begin(), used.end());
2798 r_list.insert(r_list.end(), least_liked.begin(), least_liked.end());
2799 r_list.insert(r_list.end(), import_feats.begin(), import_feats.end());
2800 r_list.insert(r_list.end(),
unused.begin(),
unused.end());
2803 r_list.insert(r_list.begin(),
all);
2811 vector<string> range_pairs;
2814 ITERATE (vector<string>, iter, range_pairs) {
2817 if (pos.size() != 2)
continue;
2820 if ( !f_str.empty() && !t_str.empty() ) {
2848 id->Assign(*idh.GetSeqId());
2852 auto mapped_loc =
Map(*loc);
2855 if (mapped_loc && !mapped_loc->IsNull() && !mapped_loc->IsEmpty() && mapped_loc->GetId())
2867 for (; idit; ++idit) {
2869 if (ids.emplace(&
id).second ==
false)
2873 auto mapped_loc =
Map(*loc);
2874 if (!mapped_loc || !mapped_loc->GetId())
2876 id.Assign(*mapped_loc->GetId());
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.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
@ eExtreme_Positional
numerical value
@ eExtreme_Biological
5' and 3'
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.
CRef< CSeq_align > ConvertSeq_align(const CSeq_align &src, CSeq_align::TSegs::E_Choice dst_choice, CSeq_align::TDim anchor_row=-1, CScope *scope=NULL)
Convert source alignment to a new type.
CSeq_entry_Handle GetSeqEntryForSeqdesc(CRef< CScope > scope, const CSeqdesc &seq_desc)
int GetGenCode(int def=1) const
This stream exchanges data with an HTTP server located at the URL: http[s]://host[:port]/path[?...
void SetMaxReturn(int ret_max)
void SearchHistory(const string &db, const string &term, const string &web_env, Int8 query_key, int retstart, CNcbiOstream &ostr)
Uint8 Search(const string &db, const string &term, vector< objects::CSeq_id_Handle > &uids, const string &xml_path=kEmptyStr)
void Summary(const string &db, const vector< objects::CSeq_id_Handle > &uids, xml::document &docsums, const string &version="")
void Link(const string &db_from, const string &db_to, const vector< objects::CSeq_id_Handle > &uids_from, vector< objects::CSeq_id_Handle > &uids_to, const string &xml_path=kEmptyStr, const string &command="neighbor")
CFeatListItem - basic configuration data for one "feature" type.
string GetDescription() const
CConfigurableItems - a static list of items that can be configured.
string GetAccession() const
Retrieve the accession for this assembly.
void Find(const CSeq_id_Handle &id, TSequenceList &sequences) const
Find all references to a given sequence within an assembly.
bool IsRefSeq() const
Is this assembly a RefSeq assembly?
list< CConstRef< CGC_Sequence > > TSequenceList
void GetMolecules(TSequenceList &molecules, ESubset subset) const
Retrieve a subset of molecules.
CRef< objects::CSeq_loc > Map(const objects::CSeq_loc &Loc, const SIdSpec &Spec) const
static bool isGenCollSequence(const objects::CBioseq_Handle &handle)
static CRef< CGencollSvc > GetInstance(void)
static CRef< objects::CGenomicCollectionsService > GetGenCollService(int timeout_sec=-1)
static CGuiRegistry & GetInstance()
access the application-wide singleton
CRegistryReadView GetReadView(const string §ion) const
get a read-only view at a particular level.
static CNcbiApplication * Instance(void)
Singleton method.
void AddInterval(const CSeq_interval &ival)
for convenience
@Pubdesc.hpp User-defined methods of the data storage class.
TThisType & CombineWith(const TRange &r)
class CRegistryReadView provides a nested hierarchical view at a particular key.
int GetInt(const string &key, int default_val=0) const
access a named key at this level, with no recursion
bool GetBool(const string &key, bool default_val=false) const
list< SKeyInfo > TKeys
retrieve information about all keys in the registry
string GetString(const string &key, const string &default_val=kEmptyStr) const
void GetKeys(TKeys &keys) const
Retrieve information about all keys in this view.
ESubtype GetSubtype(void) const
static const CFeatList * GetFeatList()
@ eSubtype_transit_peptide
@ eSubtype_bad
These no longer need to match the FEATDEF values in the C toolkit's objfdef.h.
TDim CheckNumRows(void) const
Validatiors.
const CSeq_id & GetSeq_id(TDim row) const
Get seq-id (the first one if segments have different ids).
ENa_strand GetSeqStrand(TDim row) const
Get strand (the first one if segments have different strands).
namespace ncbi::objects::
int Compare(const CSeq_feat &f2) const
Compare relative order of this feature and feature f2, ordering first by features' coordinates,...
Seq-loc iterator class – iterates all intervals from a seq-loc in the correct order.
static TSeqPos Pack(CSeq_data *in_seq, TSeqPos uLength=ncbi::numeric_limits< TSeqPos >::max())
Base class for all serializable objects.
class CStaticArrayMap<> provides access to a static array in much the same way as CStaticArraySet<>,...
TBase::const_iterator const_iterator
static CSeq_id_Handle GetSeq_id_Handle(const const_iterator &iter)
Template class for iteration on objects of class C (non-medifiable version)
Template class for iteration on objects of class C.
CUser_object & AddField(const string &label, const string &value, EParseField parse=eParse_String)
add a data field to the user object that holds a given value
General IdMapper interface.
Task clients implement this callback interface.
container_type::const_iterator const_iterator
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
The xml::document class is used to hold the XML tree and various bits of information about it.
void swap(document &other)
Swap one xml::document object for another.
const node & get_root_node(void) const
Get a reference to the root node of this document.
The xml::node::const_iterator provides a way to access children nodes similar to a standard C++ conta...
The xml::node_set::const_iterator class is used to iterate over nodes in a node set.
The xml::node_set class is used to store xpath query result set.
iterator begin()
Get an iterator that points to the beginning of the xpath query result node set.
iterator end()
Get an iterator that points one past the last node in the xpath query result node set.
The xml::node class is used to hold information about one XML node.
iterator end(void)
Get an iterator that points one past the last child for this node.
iterator find(const char *name, const ns *nspace=NULL)
Find the first child node that has the given name and namespace.
node_set run_xpath_query(const xpath_expression &expr)
Run the given XPath query.
const char * get_content(void) const
Get the content for this text node.
string GetSeqIdString(const CSeq_id &id)
static unsigned char depth[2 *(256+1+29)+1]
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static const char * str(char *buf, int n)
SStrictId_Entrez::TId TEntrezId
TEntrezId type for entrez ids which require the same strictness as TGi.
#define ENTREZ_ID_TO(T, entrez_id)
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
int TSignedSeqPos
Type for signed sequence position.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
unsigned int THTTP_Flags
Bitwise OR of EHTTP_Flag.
@ fHTTP_AutoReconnect
See HTTP_CreateConnectorEx()
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
static CConstRef< objects::CSeq_loc > GetFeatLocation(const objects::CSeq_feat &feat, const objects::CBioseq_Handle &bsh)
static bool StringToRange(const string &range_str, long &from, long &to)
Convert a range string to a range.
virtual void SetTaskName(const string &name)=0
virtual void SetTaskCompleted(int completed)=0
set total finished task number.
static int GetMaxSearchTime(const CRegistryReadView &view)
static string CreateLinkRow(const string &tag, const string &label, const string &url)
static TMappingInfo GetMappingInfoFromLocation(const objects::CSeq_loc &feat_loc, const objects::CSeq_id &product_id, const int feat_offset=0)
static TMappingInfo GetRnaMappingInfo(const objects::CSeq_loc &feat_loc, const objects::CMappedFeat &feat, const objects::CBioseq_Handle &handle)
Helper function to generate mapping info between the specified product sequence and genomic sequence ...
static void ELinkQuery(const string &db_from, const string &db_to, const TEntrezIds &uids_from, TEntrezIds &uids_to, const string &cmd="neighbor", const string &xpath="//Link/Id/text()")
Queries elink.fcgi with a vector of uids/seq-ids (seq-ids preferred for future compatibility) and ret...
static string GetAlignDbIsQuery(const string &annot)
get a is_source_assembly_query string from AlignDb annotation suffixed after a second '#'
static bool LinkFeatures(CLinkedFeature::TLinkedFeats &feats, TFeatLinkingMode mode=1, ISeqTaskProgressCallback *p_cb=NULL)
Link features into a hierarchical list.
static bool IsNAA(const string &annot, bool isStrict=false)
check if a given annotation is a named annotation accession[.version][number] when isSctrict == false...
static bool IsException(const objects::CSeq_feat &feat)
static objects::CBioseq * SeqLocToBioseq(objects::CScope &scope, const objects::CSeq_loc &loc)
Construct a bioseq to fit a given location.
static bool isRmtPipelineFileType(const string &sFileType)
check if a file type is one of remote file types
static TLocVec GetAccessionPlacements(const objects::CSeq_id &id, objects::CScope &scope, int time_out_sec=1, THTTP_Flags flags=fHTTP_AutoReconnect)
Retrieve mapped-up sequences.
static bool isTopLevel(const objects::CSeq_id &seq_id, const string &assm_acc, objects::CScope *scope=NULL)
static bool IsPartialStart(const objects::CSeq_loc &loc)
static objects::SAnnotSelector GetAnnotSelector(TAnnotFlags flags=0)
request an annotation selector for a given type
list< CRef< CLinkedFeature > > TLinkedFeats
static bool IsPartialFeature(const objects::CSeq_feat &feat)
static TLocVec GetGiPlacements(TGi gi, int time_out_sec=5, THTTP_Flags flags=fHTTP_AutoReconnect)
Retrieve mapped-up sequences.
static void ESearchQuery(const string &db, const string &term, TEntrezIds &uids, size_t &count, const int ret_max, const string &xpath="//IdList/Id/text()")
Queries esearch.fcgi and returns a vector of uids/seq-ids (seq-ids preferred for future compatibility...
vector< CRef< objects::CSeq_loc > > TLocVec
static TMappingInfo GetCdsMappingInfoFromRna(const TMappingInfo &rna_mapping_info, const objects::CSeq_feat &rna_feat, const objects::CMappedFeat &mapped_cds_feat, const objects::CSeq_loc &feat_loc, objects::CScope &scope, const int feat_offset=0)
Derive the CDS feature mapping information based on its parent RNA feature mapping info.
static string GetNcbiBaseUrl()
static int GetMaxSearchSegments(const CRegistryReadView &view)
static bool IsCrossOrigin(const objects::CSeq_loc &loc)
static bool IsAlignDb(const string &annot)
check if a given annotation is AlignDb (potentially suffixed with batch identication string after a '...
static const string & NameTypeValueToStr(TAnnotNameType type)
vector< TEntrezId > TEntrezIds
static void GetAssmAccs_Gi(TAccs &accs, TGi gi)
get all assembly accessions corresponding to a GI
static objects::SAnnotSelector::EMaxSearchSegmentsAction GetMaxSearchSegmentsAction(const CRegistryReadView &view)
virtual objects::CSeq_id_Handle Map(const objects::CSeq_id_Handle &idh) override
static bool IsPseudoFeature(const objects::CSeq_feat &feat)
vector< objects::CSeq_id_Handle > TSeqIdHandles
static string MakeRmtAnnotName(const string &sSuffix)
create an annotation name for a remote file pipeline, appending sSuffix
static string GetAnnotName(const objects::CSeq_annot_Handle &annot_handle)
static bool IsPartialStop(const objects::CSeq_loc &loc)
CGencollIdMapper::SIdSpec m_Spec
CSeq_entry_Handle GetTopSeqEntryFromScopedObject(SConstScopedObject &obj)
static bool GetRangeCollection(const objects::CSeq_id &id, const objects::CHandleRangeMap &map, CRangeCollection< TSeqPos > &ranges)
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 GetAssmIds_GIChr(TEntrezIds &gc_ids, TGi gi)
get all assembly ids associated with a gi where this gi is a chromosome
static CConstRef< objects::CUser_field > GetAnnotUserField(const objects::CSeq_annot &annot, const string &type, const string &label)
static bool CanHavePlacements(const objects::CSeq_id &seqid)
check that a given seq-id can potentially have placements (to weed out cases like local ids)
static const string & GetUnnamedAnnot()
Get the commonly used symbol representing a unnnamed annotation.
static void GetMappingInfo(const objects::CMappedFeat &mapped_feat, const objects::CBioseq_Handle &bsh, TMappingInfo &info, const string &annot=string())
virtual void SetTaskTotal(int total)=0
static string CreateIdStr(const vector< T > &uids)
Convert a list of ids into a comma-delimited string.
static TLocVec GetLocPlacements(const objects::CSeq_loc &loc, int time_out_sec=1)
Retrieve locations on mapped-up sequences Help method for retrieving upper level sequences for a give...
static string GetAnnotComment(const objects::CSeq_annot_Handle &annot_handle)
static string CreateSectionRow(const string &tag)
virtual void MapObject(CSerialObject &obj) override
static bool isQuasiLocal(const objects::CBioseq_Handle &handle)
check that a given accession is either local or unrecognizable this can be important to avoid unneces...
static bool IsVDBAccession(const string &acc)
Check if string starts with ("SRA", "SRR", "DRR", "ERR")
static bool IsSameStrands(const objects::CSeq_loc &loc)
static bool GetAnnotShown(const objects::CSeq_annot &annot)
static CRef< objects::CSeq_loc > CreateSeq_loc(const objects::CSeq_id &id, const CRangeCollection< TSeqPos > &ranges)
vector< TSeqRange > TRanges
CRef< CGencollIdMapper > m_Mapper
static bool IsNAA_Name(const string &annot)
check if a given annotation is a named annotation name with '.' replaced with '_'.
static bool GetGIString(const string &sid, string *gi_str)
ad-hoc GI extraction (for misformed seq-id strings like: "gi|55823257|ref|YP_141698....
static IIdMapper * GetIdMapper(CRef< objects::CGC_Assembly > assm)
static TAnnotNameType NameTypeStrToValue(const string &type)
static bool IsExtendedNAA(const string &annot, bool isStrict=false)
check if a given annotation is an extended NAA (named accession[.version][number],...
static int GetGenCode(const objects::CBioseq_Handle &handle)
Returns Bioseq's Genetic Code.
static string GetChrGI(TGi gi)
try to get a chromosome from a GI
static bool Match(const objects::CSeq_id &id1, const objects::CSeq_id &id2, objects::CScope *scope=NULL)
check to see if two seq-ids are identical.
static void SetAnnot(objects::SAnnotSelector &sel, const string &annot)
help function for setting up an annotation.
static string CreateTableRow(const string &tag="", const string &value="")
static CRef< objects::CSeq_loc > RemapChildToParent(const objects::CSeq_loc &parent, const objects::CSeq_loc &child, objects::CScope *scope=NULL)
remap a location to a parent location.
static string CreateTableStart()
help methods for creating HTML text
static TLocVec GetAccessionPlacementsMsec(const objects::CSeq_id &id, objects::CScope &scope, unsigned long time_out_msec=1000, THTTP_Flags flags=fHTTP_AutoReconnect)
same, with a timeout in milliseconds
static CRegistryReadView GetSelectorRegistry()
helper functions to read selector-related tune-up info (mostly segment limits) from registry:
CGencollIdMapperAdapter(CRef< CGencollIdMapper > mapper, const CGencollIdMapper::SIdSpec &spec)
-------------------------------- CGencollIdMapperAdapter ——————————–
virtual bool StopRequested() const =0
static bool isRmtAnnotName(const string &sAnnotname)
check if a given annotation was created by a remote file pipeline
EAnnotationNameType
flags for classifying annotation names.
static CRef< objects::CSeq_id > MapStringId(const string &str, objects::IIdMapper *mapper)
static objects::CMappedFeat GetMrnaForCds(const objects::CMappedFeat &cds_feat, const string &named_acc=string())
static std::string GetXmlChildNodeValue(const xml::node &parent, const std::string &name)
Returns the contents of the specified child node.
static string GetChrId(const string &id_str, objects::CScope &scope)
same as GetChrGI(), but takes an string with id (that must correspond to some GI)
static void GetAssmIds_GI(TEntrezIds &gc_ids, TGi gi)
get all assembly ids associated with a gi.
static bool IsExtendedNAA_Name(const string &annot)
check if a given annotation is an extended NAA name with '.' replaced with '_'.
static void ParseRanges(const string &sRanges, TRanges &ranges)
vector< TMappedInt > TMappingInfo
static string CreateTableEnd()
static void SetResolveDepth(objects::SAnnotSelector &sel, bool adaptive, int depth=-1)
help function for setting selector resolve depth.
static void SetAnnotShown(objects::CSeq_annot &annot, bool isShown)
static bool CheckMaxSearchSegments(int actual, int max, objects::SAnnotSelector::EMaxSearchSegmentsAction action)
check actual number of segments against max and perform the action if the actual number is more than ...
virtual void AddTaskCompleted(int delta)=0
set to add newly finished task number.
static string GetAlignDbBatch(const string &annot)
get a batch string from AlignDb annotation suffixed with batch identication string after a '#'
@ eAnnot_Unnamed
unnamed annotation
@ eAnnot_All
all annotations
@ eAnnot_Named
all named annotations
@ eAnnot_Other
any given named annots
CRef< objects::CScope > scope
CConstRef< CObject > object
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
#define MSerial_AsnText
I/O stream manipulators –.
@ eSerial_AsnText
ASN.1 text.
const string AsFastaString(void) const
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...
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
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.
EAccessionInfo
For IdentifyAccession (below)
bool MatchesTo(const CSeq_id_Handle &h) const
True if *this matches to h.
bool Match(const CSeq_id &sid2) const
Match() - TRUE if SeqIds are equivalent.
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
@ eAcc_refseq_mrna_predicted
@ eAcc_refseq_prot_predicted
@ eAcc_refseq_ncrna_predicted
@ eAcc_refseq_wgs_intermed
void SetPacked_int(TPacked_int &v)
bool IsPartialStart(ESeqLocExtremes ext) const
check start or stop of location for e_Lim fuzz
TRange GetTotalRange(void) const
TSeqPos GetStart(ESeqLocExtremes ext) const
Return start and stop positions of the seq-loc.
CRef< CSeq_loc > Merge(TOpFlags flags, ISynonymMapper *syn_mapper) const
All functions create and return a new seq-loc object.
bool IsSetStrand(void) const
Get strand.
int CompareSubLoc(const CSeq_loc &loc, ENa_strand strand, const ISubLocFilter *filter=NULL) const
Compare first-level sub-locations sequentially to order them by biological "complexity".
bool IsEmpty(void) const
True if the current location is empty.
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
size_t GetSize(void) const
Get number of ranges.
TRange GetRange(void) const
Get the range.
ENa_strand GetStrand(void) const
const CSeq_id & GetSeq_id(void) const
Get seq_id of the current location.
void GetLabel(string *label) const
Appends a label suitable for display (e.g., error messages) label must point to an existing string ob...
bool IsPartialStop(ESeqLocExtremes ext) const
TSeqPos GetStop(ESeqLocExtremes ext) const
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
CMappedFeat GetBestMrnaForCds(const CMappedFeat &cds_feat, CFeatTree *feat_tree=0, const SAnnotSelector *base_sel=0)
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,...
ENa_strand GetStrand(const CSeq_loc &loc, CScope *scope=0)
Returns eNa_strand_unknown if multiple Bioseqs in loc Returns eNa_strand_other if multiple strands in...
CConstRef< CSeq_loc > m_ParentLoc
CRef< CSeq_loc > Resolve(CScope *scope=0, TFlags flags=0) const
TGi GetGiForId(const objects::CSeq_id &id, CScope &scope, EGetIdType flags=0)
Given a Seq-id retrieve the corresponding GI.
@ eGetId_ForceGi
return only a gi-based seq-id
CRef< CSeq_loc > Map(const CSeq_loc &src_loc)
Map seq-loc.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
void GetAllTSEs(TTSE_Handles &tses, enum ETSEKind kind=eManualTSEs)
CConstRef< CSynonymsSet > GetSynonyms(const CSeq_id &id)
Get bioseq synonyms, resolving to the bioseq in this scope.
vector< CSeq_entry_Handle > TTSE_Handles
@ eProductToLocation
Map from the feature's product to location.
@ eLocationToProduct
Map from the feature's location to product.
CConstRef< CBioseq > GetCompleteBioseq(void) const
Get the complete bioseq.
const CSeq_annot_Handle & GetAnnot(void) const
Get handle to seq-annot for this feature.
const CSeqFeatData & GetData(void) const
CConstRef< CSeq_annot > GetCompleteSeq_annot(void) const
Complete and return const reference to the current seq-annot.
bool IsSetProduct(void) const
CConstRef< CSeq_id > GetSeqId(void) const
Get id which can be used to access this bioseq handle Throws an exception if none is available.
CSeq_entry_Handle GetParentEntry(void) const
Get parent Seq-entry handle.
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
CScope & GetScope(void) const
Get scope this handle belongs to.
const string & GetName(void) const
CRef< CSeq_loc > GetRangeSeq_loc(TSeqPos start, TSeqPos stop, ENa_strand strand=eNa_strand_unknown) const
Return CSeq_loc referencing the given range and strand on the bioseq If start == 0,...
CSeq_entry_Handle GetTopLevelEntry(void) const
Return a handle for the top-level seq-entry.
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
bool IsSynonym(const CSeq_id &id) const
Check if this id can be used to obtain this bioseq handle.
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
SAnnotSelector & IncludeFeatSubtype(TFeatSubtype subtype)
Include feature subtype in the search.
SAnnotSelector & SetFeatType(TFeatType type)
Set feature type (also set annotation type to feat)
SAnnotSelector & SetExactDepth(bool value=true)
SetExactDepth() specifies that annotations will be searched on the segment level specified by SetReso...
SAnnotSelector & SetResolveAll(void)
SetResolveAll() is equivalent to SetResolveMethod(eResolve_All).
SAnnotSelector & SetOverlapTotalRange(void)
Check overlapping only of total ranges.
const CSeq_loc & GetLocation(void) const
const CSeq_feat & GetOriginalFeature(void) const
Get original feature with unmapped location/product.
SAnnotSelector & SetAdaptiveDepth(bool value=true)
SetAdaptiveDepth() requests to restrict subsegment resolution depending on annotations found on lower...
SAnnotSelector & SetResolveDepth(int depth)
SetResolveDepth sets the limit of subsegment resolution in searching annotations.
SAnnotSelector & IncludeNamedAnnotAccession(const string &acc, int zoom_level=0)
SAnnotSelector & SetExcludeExternal(bool exclude=true)
External annotations for the Object Manger are annotations located in top level Seq-entry different f...
SAnnotSelector & SetCollectNames(bool value=true)
Collect available annot names rather than annots.
const CSeq_feat & GetMappedFeature(void) const
Feature mapped to the master sequence.
const CSeq_loc & GetProduct(void) const
SAnnotSelector & SetAnnotType(TAnnotType type)
Set annotation type (feat, align, graph)
SAnnotSelector & AddNamedAnnots(const CAnnotName &name)
Add named annot to set of annots names to look for.
SAnnotSelector & SetFeatSubtype(TFeatSubtype subtype)
Set feature subtype (also set annotation and feat type)
SAnnotSelector & ExcludeNamedAnnots(const CAnnotName &name)
Add named annot to set of annots names to exclude.
SAnnotSelector & ExcludeUnnamedAnnots(void)
Add unnamed annots to set of annots names to exclude.
SAnnotSelector & AddUnnamedAnnots(void)
Add unnamed annots to set of annots names to look for.
@ fIncludeGivenEntry
Include the top (given) entry.
@ fRecursive
Iterate recursively.
@ eMaxSearchSegmentsSilent
@ eMaxSearchSegmentsThrow
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
bool IsProtein(void) const
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
void Reset(void)
Reset reference object.
void Reset(void)
Reset reference object.
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
TObjectType * Release(void)
Release a reference to the object and return a pointer to the object.
CRange< TSeqPos > TSeqRange
typedefs for sequence ranges
CRange< TSignedSeqPos > TSignedSeqRange
static TThisType GetWhole(void)
virtual string GetString(const string §ion, const string &name, const string &default_value, TFlags flags=0) const
Get the parameter string value.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
NCBI_NS_STD::string::size_type SIZE_TYPE
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static SIZE_TYPE FindNoCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case insensitive search.
static size_t StringToSizet(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to size_t.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static int Compare(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Compare of a substring with another string.
static long StringToLong(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to long.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
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.
unsigned int usec
microseconds (modulo 1,000,000)
STimeout * NcbiMsToTimeout(STimeout *timeout, unsigned long ms)
static const char label[]
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
bool IsLim(void) const
Check if variant Lim is selected.
const TData & GetData(void) const
Get the Data member data.
TLim GetLim(void) const
Get the variant data.
void SetType(TType &value)
Assign a value to Type data member.
bool IsBool(void) const
Check if variant Bool is selected.
@ eLim_circle
artificial break at origin of circle
@ eGC_SequenceRole_top_level
bool IsSetSegs(void) const
Check if a value has been assigned to Segs data member.
const TSpliced & GetSpliced(void) const
Get the variant data.
const TStd & GetStd(void) const
Get the variant data.
const TExons & GetExons(void) const
Get the Exons member data.
bool IsStd(void) const
Check if variant Std is selected.
bool IsSetExons(void) const
set of segments involved each segment corresponds to one exon exons are always in biological order Ch...
bool IsSpliced(void) const
Check if variant Spliced is selected.
const TSegs & GetSegs(void) const
Get the Segs member data.
E_Choice Which(void) const
Which variant is currently selected.
bool IsSetPartial(void) const
incomplete in some way? Check if a value has been assigned to Partial data member.
const TLocation & GetLocation(void) const
Get the Location member data.
TFrame GetFrame(void) const
Get the Frame member data.
const TData & GetData(void) const
Get the Data member data.
bool IsSetExcept(void) const
something funny about this? Check if a value has been assigned to Except data member.
const TCdregion & GetCdregion(void) const
Get the variant data.
TPseudo GetPseudo(void) const
Get the Pseudo member data.
const TProduct & GetProduct(void) const
Get the Product member data.
bool IsSetPseudo(void) const
annotated on pseudogene? Check if a value has been assigned to Pseudo data member.
TPartial GetPartial(void) const
Get the Partial member data.
TExcept GetExcept(void) const
Get the Except member data.
bool CanGetProduct(void) const
Check if it is safe to call GetProduct method.
bool IsSetProduct(void) const
product of process Check if a value has been assigned to Product data member.
bool IsRna(void) const
Check if variant Rna is selected.
bool IsSetFrame(void) const
Check if a value has been assigned to Frame data member.
@ e_Pub
publication applies to this seq
void SetTo(TTo value)
Assign a value to To data member.
ENa_strand
strand of nucleic acid
const Tdata & Get(void) const
Get the member data.
Tdata & Set(void)
Assign a value 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.
TGi GetGi(void) const
Get the variant data.
bool IsGi(void) const
Check if variant Gi is selected.
bool IsWhole(void) const
Check if variant Whole is selected.
void SetStrand(TStrand value)
Assign a value to Strand data member.
const TPacked_int & GetPacked_int(void) const
Get the variant data.
@ e_Gi
GenInfo Integrated Database.
list< CRef< CSeqdesc > > Tdata
const Tdata & Get(void) const
Get the member data.
TId & SetId(void)
Assign a value to Id data member.
TTitle & SetTitle(void)
Select the variant.
const TSource & GetSource(void) const
Get the variant data.
const Tdata & Get(void) const
Get the member data.
const TDesc & GetDesc(void) const
Get the Desc member data.
list< CRef< CSeq_id > > TId
bool IsSetDesc(void) const
used only for stand alone Seq-annots Check if a value has been assigned to Desc data member.
void SetInst(TInst &value)
Assign a value to Inst data member.
void SetDescr(TDescr &value)
Assign a value to Descr data member.
const TPub & GetPub(void) const
Get the Pub member data.
const TDescr & GetDescr(void) const
Get the Descr member data.
@ eRepr_raw
continuous sequence
@ e_Source
source of materials, includes Org-ref
@ eMol_na
just a nucleic acid
unsigned int
A callback function used to compare two keys in a database.
SStaticPair< const char *, CSeqUtils::TAnnotNameType > TNameTypeStr
static bool s_CompareDescriptions(const CFeatListItem *p1, const CFeatListItem *p2)
static void s_CreateMappingInfo(const CSeq_loc &prod_loc, const CSeq_loc &gen_loc, CSeqUtils::TMappingInfo &info)
Helper function to convert two mapped locations into an interval-to-interval mapping structure.
static TMappedLocs s_GetRnaMappingLocs(const CSeq_loc &feat_loc, const CMappedFeat &feat, const CBioseq_Handle &handle)
static bool s_IsNAA(const string &annot, char div)
static void s_AdjustToAnnotatedCDS(const CMappedFeat &mapped_cds_feat, CScope &scope, CSeqUtils::TMappingInfo &cds_map_info)
map< string, bool > TTopLevels
DEFINE_STATIC_ARRAY_MAP(TNameTypeMap, sm_NameTypeMap, s_NameTypeStrs)
CBioseq_Handle GetBioseqForSeqFeat(const CSeq_feat &f, CScope &scope)
static void s_ESearchQuery(const string &db, const string &term, vector< T > &uids, size_t &count, const int ret_max, const string &xpath)
static void s_ELinkQuery(const string &db_from, const string &db_to, const vector< T1 > &uids_from, vector< T2 > &uids_to, const string &cmd, const string &xpath)
static const TAssemblySeqIds & s_GetAssemblySeqIds(const string &assm_acc)
CConstRef< CBioseq > GetBioseqForSeqdesc(CRef< CScope > scope, const CSeqdesc &seq_desc)
static CSeqUtils::TLocVec s_GetAlnMapplingLocs(const CSeq_align_set &align_set, TGi gi)
static CRWLock m_AssemblySeqIdLock
CSeq_feat_Handle GetSeqFeatHandleForBadLocFeature(const CSeq_feat &feat, CScope &scope)
CStaticArrayMap< string, CSeqUtils::TAnnotNameType > TNameTypeMap
static const string kTaxDb
static bool s_IsExtendedNAA(const string &sAnnotName, char div, bool isStrict)
static map< string, TAssemblySeqIds > s_AssemblySeqIdCache
static const string kAssmDb
static CRWLock m_TopLevelsLock
static const string & GetLinksURL()
CSeq_entry_Handle GetDefaultTopLevelSeqEntry(CScope &scope)
static const string kNucDb
vector< const CFeatListItem * > GetSortedFeatList(CSeq_entry_Handle seh, size_t max)
CSeq_entry_Handle GetSeqEntryForPubdesc(CRef< CScope > scope, const CPubdesc &pubdesc)
static TTopLevels m_TopLevels
vector< CRef< CSeq_loc > > TMappedLocs
For CDS and RNA feature mapping information.
static const char * kLinksUrlDefault
vector< CConstRef< CSeq_id > > TAssemblySeqIds
static const TNameTypeStr s_NameTypeStrs[]
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is smart and slim</td> n<td> orig</td> n</tr> n<tr> n<td> last_modified</td> n<td> optional</td> n<td> Integer</td> n<td class=\"description\"> The blob last modification If provided then the exact match will be requested with n the Cassandra storage corresponding field value</td> n<td> Positive integer Not provided means that the most recent match will be selected</td> n<td></td> n</tr> n<tr> n<td> use_cache</td> n<td> optional</td> n<td> String</td> n<td class=\"description\"> The option controls if the Cassandra LMDB cache and or database should be used It n affects the seq id resolution step and the blob properties lookup step The following n options are BIOSEQ_INFO and BLOB_PROP at all
Lightweight interface for getting lines of data with minimal memory copying.
static const CS_INT unused
range(_Ty, _Ty) -> range< _Ty >
constexpr auto sort(_Init &&init)
constexpr bool empty(list< Ts... >) noexcept
const GenericPointer< typename T::ValueType > T2 value
static const BitmapCharRec ch1
static const BitmapCharRec ch2
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)
static const sljit_gpr r1
static const sljit_gpr r0
static const sljit_gpr r2
#define row(bind, expected)
CSeq_annot::C_Data::E_Choice TAnnotType
bool operator()(const CMappedFeat &feat0, const CMappedFeat &feat1) const
bool operator()(const CMappedFeat &feat0, const CMappedFeat &feat1) const
bool operator()(const pair< T, U > &p1, const pair< T, U > &p2) const
Location relative to a base Seq-loc: one (usually) or more ranges of offsets.
Template structure SStaticPair is simlified replacement of STL pair<> Main reason of introducing this...