NCBI C++ ToolKit
table_data_biotreecontainer.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: table_data_biotreecontainer.cpp 45972 2021-01-20 16:32:24Z grichenk $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Roman Katargin
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
34 #include <algorithm>
35 #include <assert.h>
36 
40 #include <gui/objutils/label.hpp>
41 #include <gui/objutils/utils.hpp>
45 
50 #include <objects/biotree/Node.hpp>
53 
54 #include <objmgr/util/sequence.hpp>
55 
58 
60 {
61 public:
63 
65 
66  virtual void LoadData() {}
67  virtual ColumnType GetColumnType(size_t col) const;
68  virtual string GetColumnLabel(size_t col) const;
69 
70  virtual size_t GetRowsCount() const;
71  virtual size_t GetColsCount() const;
72 
73  virtual void GetStringValue(size_t row, size_t col, string& value) const;
74  virtual long GetIntValue(size_t row, size_t col) const;
75  virtual double GetRealValue(size_t row, size_t col) const;
76  virtual SConstScopedObject GetObjectValue(size_t row, size_t col) const;
78  CConstRef<CNode> GetNode(size_t row) const;
79  int FindRow (int nodeId) const;
80 
81  void SelectSeqIds(const CSelectionEvent::TIds& ids, CFeatureDescr::TId seqidFeatId, vector<size_t>& selectedNodes) const;
82  void SelectTaxIds(const CSelectionEvent::TTaxIds& tids, CFeatureDescr::TId taxidFeatId, vector<size_t>& selectedNodes) const;
83  void SelectFeatures(const CBioTreeSelection &selection, CFeatureDescr::TId srcFeatId, CFeatureDescr::TId dstFeatId, vector<size_t>& selectedNodes) const;
84 
85 private:
86  struct ColInfo {
87  ColInfo() : m_Name(""), m_Type(kNone) {}
88  ColInfo(const string& n) : m_Name(n), m_Type(kNone) {}
89  ColInfo(const string& n, ITableData::ColumnType t)
90  : m_Name(n), m_Type(t) {}
91 
92  string m_Name;
94  };
95 
96  void Init();
97 
98  string x_GetNodeFeature(int feature_id, const CNode& node) const;
99 
102  vector<pair<int, ColInfo> > m_FeatureDescr;
103  vector<CRef<CNode> > m_Nodes;
106 };
107 
109 {
110 public:
111  typedef vector<string> TStringVector;
112 
114 
115  virtual void GetRows(const ITableData& table, const CSelectionEvent& evt, vector<size_t>& rows) const;
116  virtual void GetSelection(const ITableData& table, const vector<size_t>& rows, CSelectionEvent& evt) const;
117 
118 private:
119  bool x_StringToSeqId(const string &seq_id, CRef<CSeq_id> &id) const;
120 };
121 
123 {
125  typeid(ITableData).name(),
126  CBioTreeContainer::GetTypeInfo(),
128 
130  typeid(ITableSelection).name(),
131  CBioTreeContainer::GetTypeInfo(),
133 }
134 
135 bool StringToSeqId(const string &seq_id, CRef<CSeq_id> &id)
136 {
137  // 1. make an attempt to convert "as-is":
138  try {
139  id->Set(seq_id);
140  return true;
141  }
142  catch(CException& )
143  {
144  }
145 
146  // 2. try ad-hoc GI extraction (for misformed seq-id strings like: "gi|55823257|ref|YP_141698.1"
147  try {
148  string gi_str;
149  CSeqUtils::GetGIString(seq_id, &gi_str);
150  if (!gi_str.empty()) {
151  id->Set(gi_str);
152  return true;
153  }
154  }
155  catch(CException& )
156  {
157  }
158 
159  // 3. Take it as local
160  try {
161  string lcl_sid = "lcl|";
162  lcl_sid.append(seq_id);
163  id->Set(lcl_sid);
164  return true;
165  }
166  catch(CException& )
167  {
168  }
169  return false;
170 }
171 
173 {
175  table_data->m_Object = object.object;
176  table_data->m_Scope = object.scope;
177  table_data->Init();
178  return table_data;
179 }
180 
182 {
183  const CBioTreeContainer& biotree = dynamic_cast<const CBioTreeContainer&>(*m_Object);
184  const CFeatureDictSet::Tdata& fdict = biotree.GetFdict().Get();
185  ITERATE(CFeatureDictSet::Tdata, it, fdict) {
187 
188  if (NStr::EqualNocase((*it)->GetName(), "seq-id"))
189  t = kObject;
190 
191  m_FeatureDescr.push_back(pair<int, ColInfo>((*it)->GetId(),
192  ColInfo((*it)->GetName(),t)));
193  }
194 
195  const CNodeSet::Tdata& nodes = biotree.GetNodes().Get();
196  m_Nodes.resize(nodes.size());
197 
198  size_t i = 0;
199  ITERATE(CNodeSet::Tdata, it, nodes) {
200  // Guess types - look for ints and reals (with blank == 0) so that numbers
201  // can have sorting and querying based on numeric rather than string semantics.
202  // If a field as any non-numbers (other than blanks), call it a string. No
203  // attempt is made here to look for other IDs (only id is decided by name).
204  for (size_t j=0; j<m_FeatureDescr.size(); ++j) {
205  string val = x_GetNodeFeature(m_FeatureDescr[j].first, (*it).GetObject());
206  if (val == "")
207  continue;
208 
209  // kObject was decided by field name and once a string always a string
210  // (if we find a string value for a column, no future ints or floats
211  // will change it's type back).
212  if (m_FeatureDescr[j].second.m_Type == kObject ||
213  m_FeatureDescr[j].second.m_Type == kString)
214  continue;
215 
216  try {
217  // No exception converting to int - it's an int. Can
218  // only change to int from 'none' (all values must be ints)
220  if (m_FeatureDescr[j].second.m_Type == kNone)
221  m_FeatureDescr[j].second.m_Type = kInt;
222  }
223  catch (CStringException&) {
224  try {
225  // No exception converting to double - it's a real number.
226  // only change to real from kInt or kNone.
227  NStr::StringToDouble(val.c_str());
228  if (m_FeatureDescr[j].second.m_Type == kNone ||
229  m_FeatureDescr[j].second.m_Type == kInt) {
230  m_FeatureDescr[j].second.m_Type = kReal;
231  }
232  }
233  catch (CStringException&) {
234  // It's just a string probably, but
235  // leave it as a number for range errors (overflow/underflow)
236  //double d = NStr::StringToDoublePosix(val.c_str());
237  if (errno != ERANGE) {
238  m_FeatureDescr[j].second.m_Type = kString;
239  }
240  }
241  }
242  }
243 
244 
245  m_Nodes[i++] = *it;
246  if ((*it)->CanGetId())
247  m_NodeIdRows[(*it)->GetId()] = i-1;
248  }
249 }
250 
252 {
253  if (col < 2)
254  return kInt;
255 
256  if (col - 2 < m_FeatureDescr.size())
257  return m_FeatureDescr[col-2].second.m_Type;
258 
259  return kNone;
260 }
261 
263 {
264  if (col == 0)
265  return "id";
266  else if (col == 1)
267  return "parent";
268 
269  if (col - 2 < m_FeatureDescr.size())
270  return m_FeatureDescr[col - 2].second.m_Name;
271 
272  return "";
273 }
274 
276 {
277  return m_Nodes.size();
278 }
279 
281 {
282  return 2 + m_FeatureDescr.size();
283 }
284 
285 void CTableDataBioTreeContainer::GetStringValue(size_t row, size_t col, string& value) const
286 {
287  value.resize(0);
288  if (row >= m_Nodes.size())
289  return ;
290 
291  if (col < 2) {
293  }
294  else {
295  if (col - 2 < m_FeatureDescr.size()) {
296  try {
297  const CNode& node = *m_Nodes[row];
298  value = x_GetNodeFeature(m_FeatureDescr[col - 2].first, node);
299  }
300  catch (const std::exception& e) {
301  LOG_POST(Error << "CTableDataBioTreeContainer: " << e.what());
302  }
303  }
304  }
305 }
306 
307 long CTableDataBioTreeContainer::GetIntValue(size_t row, size_t col) const
308 {
309  long value = 0;
310  if (row >= m_Nodes.size())
311  return value;
312 
313  try {
314  const CNode& node = *m_Nodes[row];
315  if (col == 0)
316  value = node.GetId();
317  else if (col == 1) {
318  value = node.CanGetParent() ? node.GetParent() : -1;
319  }
320  else {
321  string strval = x_GetNodeFeature(m_FeatureDescr[col - 2].first, node);
322  if (NStr::IsBlank(strval))
323  return 0;
324  value = NStr::StringToLong(strval);
325  }
326  }
327  catch (const std::exception& e) {
328  LOG_POST(Error << "CTableDataBioTreeContainer: " << e.what());
329  }
330 
331  return value;
332 }
333 
334 double CTableDataBioTreeContainer::GetRealValue(size_t row, size_t col) const
335 {
336  double value = 0.0;
337 
338  if (row >= m_Nodes.size())
339  return value;
340 
341  if (col < 2)
342  return value;
343 
344  const CNode& node = *m_Nodes[row];
345  string strval = x_GetNodeFeature(m_FeatureDescr[col - 2].first, node);
346 
347  try {
348  if (NStr::IsBlank(strval))
349  return 0.0;
350  value = NStr::StringToDouble(strval.c_str());
351  }
352  catch (const std::exception& e) {
353  value = NStr::StringToDoublePosix(strval.c_str());
354  if (errno != ERANGE)
355  LOG_POST("Value range error: " << strval);
356  else
357  LOG_POST(Error << "CTableDataBioTreeContainer: " << e.what());
358  }
359 
360  return value;
361 }
362 
364 {
366 
367  if (row >= m_Nodes.size())
368  return value;
369 
370  if (col >= 2 && NStr::EqualNocase(m_FeatureDescr[col - 2].second.m_Name, "Seq-id")) {
371  const CNode& node = *m_Nodes[row];
372  string seq_id = x_GetNodeFeature(m_FeatureDescr[col - 2].first, node);
373  if (seq_id.empty())
374  return value;
375 
376  CRef<CSeq_id> id(new CSeq_id());
377 
378  bool sid_res_status = false;
379  // 1. make an attempt to convert "as-is":
380  try {
381  id->Set(seq_id);
382 
385 
386  if( idh ){
387  CRef<CSeq_id> id_copy( new CSeq_id() );
388  id_copy->Assign( *idh.GetSeqId() );
389  value.object.Reset(id_copy.GetPointer());
390  value.scope = m_Scope;
391  }
392  sid_res_status = true;
393  }
394  catch(CException& )
395  {
396  }
397 
398  // 2. try ad-hoc GI extraction (for misformed seq-id strings like: "gi|55823257|ref|YP_141698.1"
399  if (!sid_res_status) {
400  try {
401  string gi_str;
402  CSeqUtils::GetGIString(seq_id, &gi_str);
403  if (!gi_str.empty()) {
404  id->Set(gi_str);
405  sid_res_status = true;
406  }
407  }
408  catch(CException& )
409  {
410  }
411  }
412 
413  // 3. Take it as local
414  if (!sid_res_status) {
415  try {
416  string lcl_sid = "lcl|";
417  lcl_sid.append(seq_id);
418  id->Set(lcl_sid);
419  sid_res_status = true;
420  }
421  catch(CException& )
422  {
423  }
424  }
425 
426  if (sid_res_status) {
427  value.object.Reset(id.GetPointer());
428  value.scope = m_Scope;
429  }
430  } // if "seq-id"
431 
432 
433  return value;
434 }
435 
437 {
438  if (row >= m_Nodes.size())
439  return CConstRef<CNode>();
440 
441  return m_Nodes[row];
442 }
443 
445 {
447  return (node != m_NodeIdRows.end()) ? (int)node->second : -1;
448 }
449 
450 void CTableDataBioTreeContainer::SelectSeqIds(const CSelectionEvent::TIds& ids, CFeatureDescr::TId seqidFeatId, vector<size_t>& selectedNodes) const
451 {
452  ITERATE(CSelectionEvent::TIds, it_id, ids) {
453  const CSeq_id& id = **it_id;
454 
455  for (size_t i=0; i<m_Nodes.size(); ++i) {
456  const CNode& node = *m_Nodes[i];
457 
458  string feat_value = x_GetNodeFeature(seqidFeatId, node);
459  if (feat_value.empty())
460  continue;
461  CRef<CSeq_id> id2(new CSeq_id());
462  if (!StringToSeqId(feat_value, id2))
463  continue;
464 
465  if (CSeq_id::e_YES != id.Compare(*id2))
466  continue;
467 
468  selectedNodes.push_back(i);
469  }
470  }
471 }
472 
473 void CTableDataBioTreeContainer::SelectTaxIds(const CSelectionEvent::TTaxIds& tids, CFeatureDescr::TId taxidFeatId, vector<size_t>& selectedNodes) const
474 {
475  for (size_t i=0; i<m_Nodes.size(); ++i) {
476  const CNode& node = *m_Nodes[i];
477 
478  string tax_id = x_GetNodeFeature(taxidFeatId, node);
479  if (tax_id.empty())
480  continue;
481 
483  if (!tids.IsSelected(id))
484  continue;
485 
486  selectedNodes.push_back(i);
487  }
488 
489 }
490 
491 void CTableDataBioTreeContainer::SelectFeatures(const CBioTreeSelection &selection, CFeatureDescr::TId srcFeatId, CFeatureDescr::TId dstFeatId, vector<size_t>& selectedNodes) const
492 {
493  vector<string> selected_feature_values;
494  selected_feature_values.reserve(selection.GetNodeIds().size());
495  // Iterate over the selection tree and collect all the selected values.
497  string feat_val = selection.GetFeatureValue(*iter, srcFeatId);
498  if (feat_val.empty())
499  continue;
500  selected_feature_values.push_back(feat_val);
501  }
502 
503  // Iterate over the tree to be updated and select all those nodes
504  // that have the feature dstFeatId equal to one of the selected values
505  ITERATE(vector<string>, itFeatValue, selected_feature_values) {
506 
507  for (size_t i=0; i<m_Nodes.size(); ++i) {
508  const CNode& node = *m_Nodes[i];
509 
510  string feat_value = x_GetNodeFeature(dstFeatId, node);
511  if (feat_value.empty())
512  continue;
513  if (*itFeatValue != feat_value)
514  continue;
515 
516  selectedNodes.push_back(i);
517  }
518  }
519 }
520 
521 string CTableDataBioTreeContainer::x_GetNodeFeature(int feature_id, const CNode& node) const
522 {
523  string feature_value;
524 
525  if (node.CanGetFeatures()) {
528  if ((*it)->GetFeatureid() == feature_id) {
529  feature_value = (*it)->GetValue();
530  break;
531  }
532  }
533  }
534 
535  return feature_value;
536 }
537 
539 {
540  return new CTableSelectionBioTreeContainer();
541 }
542 
543 void CTableSelectionBioTreeContainer::GetRows (const ITableData& table, const CSelectionEvent& evt, vector<size_t>& rows) const
544 {
545  enum SelectionMode {
546  selectNone = 0x0,
547  selectNodeIds = 0x1,
548  selectSeqIds = 0x2,
549  selectTaxIds = 0x4,
550  selectBothIds = 0x6,
551  selectFeatures = 0x8
552  };
553 
554  unsigned selectionMode = selectNone;
555  const CTableDataBioTreeContainer& bc = dynamic_cast<const CTableDataBioTreeContainer&>(table);
556  const CBioTreeContainer& biotree = dynamic_cast<const CBioTreeContainer&>(*bc.m_Object);
557  const CBioTreeSelection* bioTreeSelection = 0;
558  TConstObjects objs;
559  evt.GetIndexed("tree", objs);
560  if (!objs.empty()) {
561  bioTreeSelection = dynamic_cast<const CBioTreeSelection*>(objs[0].GetNonNullPointer());
562  }
563  else {
564  selectionMode = selectSeqIds | selectTaxIds;
565  }
566 
567  // Feature Id in the source (selection) tree
568  CFeatureDescr::TId srcFeatId = -1;
569  // Feature Id in the destination (data source) tree
570  CFeatureDescr::TId dstFeatId = -1;
571 
572  if (selectNone == selectionMode) {
573  assert(bioTreeSelection);
574  if ((&biotree == bioTreeSelection->GetBioTree().GetNonNullPointer()) && CSelectionEvent::sm_TreeBroadcastOneToOne) {
575  selectionMode = selectNodeIds;
576  }
577  else {
578  // Helper object, used to search the destination (data source) tree
579  unique_ptr<CBioTreeSelection> dstTree(new CBioTreeSelection(CConstRef<CBioTreeContainer>(&biotree)));
580  // The name of the feature, used to select node
581  string feat_name;
582 
584  srcFeatId = bioTreeSelection->GetFeatureId(*it);
585  if ((CFeatureDescr::TId)-1 == srcFeatId)
586  continue;
587 
588  dstFeatId = dstTree->GetFeatureId(*it);
589  if ((CFeatureDescr::TId)-1 == dstFeatId)
590  continue;
591 
592  // The feature was found in both trees
593  feat_name = *it;
594  break;
595  }
596  if (feat_name == "seq-id")
597  selectionMode = selectSeqIds;
598  else if (feat_name == "tax-id" || feat_name == "taxid")
599  selectionMode = selectTaxIds;
600  else
601  selectionMode = selectFeatures;
602  }
603  }
604 
605  switch(selectionMode)
606  {
607  case selectNodeIds :
608  // Convert node ids to row numbers
609  {
610  const CBioTreeSelection::TNodeIdsVector &nodeIds = bioTreeSelection->GetNodeIds();
611  rows.reserve(nodeIds.size());
612  ITERATE(CBioTreeSelection::TNodeIdsVector, nodeId, nodeIds) {
613  int row = bc.FindRow((int)(*nodeId));
614  if (-1 == row)
615  continue;
616  rows.push_back(row);
617  }
618  }
619  break;
620  case selectSeqIds :
621  bc.SelectSeqIds(evt.GetIds(), dstFeatId, rows);
622  break;
623  case selectTaxIds :
624  bc.SelectTaxIds(evt.GetTaxIDs(), dstFeatId, rows);
625  break;
626  case selectBothIds :
627  bc.SelectSeqIds(evt.GetIds(), dstFeatId, rows);
628  bc.SelectTaxIds(evt.GetTaxIDs(), dstFeatId, rows);
629  break;
630  case selectFeatures :
631  bc.SelectFeatures(*bioTreeSelection, srcFeatId, dstFeatId, rows);
632  break;
633  default:
634  break;
635  }
636 }
637 
638 void CTableSelectionBioTreeContainer::GetSelection (const ITableData& table, const vector<size_t>& rows, CSelectionEvent& evt) const
639 {
640  const CTableDataBioTreeContainer& bc = dynamic_cast<const CTableDataBioTreeContainer&>(table);
641  const CBioTreeContainer& biotree = dynamic_cast<const CBioTreeContainer&>(*bc.m_Object);
643  CBioTreeSelection::TNodeIdsVector &nodeIds = bioTreeSelection->GetNodeIds();
644  nodeIds.reserve(rows.size());
645  ITERATE(vector<size_t>, rowNum, rows) {
646  CConstRef<CNode> node = bc.GetNode(*rowNum);
647  if (node.IsNull())
648  continue;
649  if (!node->CanGetId())
650  continue;
651  nodeIds.push_back(node->GetId());
652  }
653  if (!nodeIds.empty())
654  evt.AddIndexed("tree", *bioTreeSelection);
655 
656  // Broadcast Seq-id objects
657  CFeatureDescr::TId seqidFeatId = bioTreeSelection->GetFeatureId("seq-id");
658  if ((CFeatureDescr::TId)-1 != seqidFeatId) {
659  TConstObjects objs;
660  ITERATE(CBioTreeSelection::TNodeIdsVector, iter, bioTreeSelection->GetNodeIds()) {
661  string feat_val = bioTreeSelection->GetFeatureValue(*iter, seqidFeatId);
662  if (feat_val.empty())
663  continue;
664  CRef<CSeq_id> id(new CSeq_id());
665  if (StringToSeqId(feat_val, id))
666  objs.push_back(CConstRef<CObject>(id));
667  }
668 
669  if (!objs.empty())
670  evt.AddObjectSelection(objs);
671  }
672 
673  // Broadcast tax-ids
674  CFeatureDescr::TId taxidFeatId = bioTreeSelection->GetFeatureId("tax-id");
675  if ((CFeatureDescr::TId)-1 == taxidFeatId)
676  taxidFeatId = bioTreeSelection->GetFeatureId("taxid"); // Common misspelling
677 
678  if ((CFeatureDescr::TId)-1 != taxidFeatId) {
679 
680  ITERATE(CBioTreeSelection::TNodeIdsVector, iter, bioTreeSelection->GetNodeIds()) {
681  string feat_val = bioTreeSelection->GetFeatureValue(*iter, taxidFeatId);
682  if (feat_val.empty())
683  continue;
684  try {
686  evt.AddTaxIDSelection(id);
687  }
688  catch(const CException&) {
689  }
690  }
691 
692  }
693 }
694 
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.
Defines CBioTreeSelection, class used to broadcast selected tree nodes between views.
const TNodeIdsVector & GetNodeIds() const
Returns const list of selected nodes.
std::vector< objects::CNode::TId > TNodeIdsVector
Vector of node IDs.
std::string GetFeatureValue(objects::CNode::TId nodeId, objects::CFeatureDescr::TId featureId) const
Gets the value of a feature for the specified node id.
objects::CFeatureDescr::TId GetFeatureId(const std::string &feature) const
Gets the id of the specified feature.
CConstRef< objects::CBioTreeContainer > GetBioTree() const
Returns the BioTree.
CConstRef –.
Definition: ncbiobj.hpp:1266
static void RegisterFactory(const string &interface_name, IInterfaceFactory *factory)
CNode –.
Definition: Node.hpp:66
CObject –.
Definition: ncbiobj.hpp:180
CSelectionEvent CSelectionEvent is used for broadcasting selection between views.
Definition: obj_event.hpp:68
vector< CConstRef< objects::CSeq_id > > TIds
Definition: obj_event.hpp:75
const TTaxIds & GetTaxIDs() const
Definition: obj_event.hpp:124
static bool sm_TreeBroadcastOneToOne
Node properties used to compare trees when broadcasting.
Definition: obj_event.hpp:216
void AddTaxIDSelection(TTaxId tid)
Definition: obj_event.cpp:306
void GetIndexed(const string &area_name, TConstObjects &objs) const
Get Objects from the private broadcasting area (caller has to make sure output objs is empty)
Definition: obj_event.cpp:240
static vector< string > sm_TreeBroadcastProperties
broadcast sel. between documents
Definition: obj_event.hpp:213
void AddIndexed(const string &area_name, const CObject &obj)
Add private selection broadcasting info.
Definition: obj_event.cpp:235
const TIds & GetIds() const
Definition: obj_event.hpp:122
bool AddObjectSelection(const CObject &obj)
Definition: obj_event.cpp:177
CStringException –.
Definition: ncbistr.hpp:4506
vector< pair< int, ColInfo > > m_FeatureDescr
CConstRef< CNode > GetNode(size_t row) const
virtual ColumnType GetColumnType(size_t col) const
virtual long GetIntValue(size_t row, size_t col) const
static CTableDataBioTreeContainer * CreateObject(SConstScopedObject &object, ICreateParams *params)
virtual void GetStringValue(size_t row, size_t col, string &value) const
virtual SConstScopedObject GetObjectValue(size_t row, size_t col) const
virtual string GetColumnLabel(size_t col) const
map< CNode::TId, size_t > TNodeIdRowMap
void SelectSeqIds(const CSelectionEvent::TIds &ids, CFeatureDescr::TId seqidFeatId, vector< size_t > &selectedNodes) const
virtual double GetRealValue(size_t row, size_t col) const
void SelectTaxIds(const CSelectionEvent::TTaxIds &tids, CFeatureDescr::TId taxidFeatId, vector< size_t > &selectedNodes) const
string x_GetNodeFeature(int feature_id, const CNode &node) const
void SelectFeatures(const CBioTreeSelection &selection, CFeatureDescr::TId srcFeatId, CFeatureDescr::TId dstFeatId, vector< size_t > &selectedNodes) const
static CTableSelectionBioTreeContainer * CreateObject(SConstScopedObject &object, ICreateParams *params)
virtual void GetRows(const ITableData &table, const CSelectionEvent &evt, vector< size_t > &rows) const
bool x_StringToSeqId(const string &seq_id, CRef< CSeq_id > &id) const
virtual void GetSelection(const ITableData &table, const vector< size_t > &rows, CSelectionEvent &evt) const
Class designed to hold a set of tax-ids represented as (on) bits in a bit vector.
bool IsSelected(TTaxId tid) const
bm::id_t TTaxId
const_iterator end() const
Definition: map.hpp:152
const_iterator find(const key_type &key) const
Definition: map.hpp:153
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:46
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
Definition: ncbidiag.hpp:226
void Error(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1197
static bool GetGIString(const string &sid, string *gi_str)
ad-hoc GI extraction (for misformed seq-id strings like: "gi|55823257|ref|YP_141698....
Definition: utils.cpp:2335
vector< CConstRef< CObject > > TConstObjects
Definition: objects.hpp:64
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
Definition: Seq_id.cpp:318
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.
@ e_YES
SeqIds compared, but are different.
Definition: Seq_id.hpp:583
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,...
sequence::ECompare Compare(const CSeq_loc &loc1, const CSeq_loc &loc2, CScope *scope)
Returns the sequence::ECompare containment relationship between CSeq_locs.
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
Definition: sequence.hpp:101
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
Definition: ncbiobj.hpp:1401
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
TObjectType * GetNonNullPointer(void) const
Get pointer value and throw a null pointer exception if pointer is null.
Definition: ncbiobj.hpp:1654
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static string SizetToString(size_t value, TNumToStringFlags flags=0, int base=10)
Convert size_t to string.
Definition: ncbistr.cpp:2751
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
Definition: ncbistr.cpp:630
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
Definition: ncbistr.cpp:106
static double StringToDouble(const CTempStringEx str, TStringToNumFlags flags=0)
Convert string to double.
Definition: ncbistr.cpp:1387
static double StringToDoublePosix(const char *str, char **endptr=0, TStringToNumFlags flags=0)
Convert string to double-precision value (analog of strtod function)
Definition: ncbistr.cpp:984
static long StringToLong(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to long.
Definition: ncbistr.cpp:653
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
Definition: ncbistr.cpp:642
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Definition: ncbistr.hpp:5353
TId GetId(void) const
Get the Id member data.
Definition: Node_.hpp:259
list< CRef< CFeatureDescr > > Tdata
bool CanGetParent(void) const
Check if it is safe to call GetParent method.
Definition: Node_.hpp:293
TParent GetParent(void) const
Get the Parent member data.
Definition: Node_.hpp:306
list< CRef< CNodeFeature > > Tdata
bool CanGetFeatures(void) const
Check if it is safe to call GetFeatures method.
Definition: Node_.hpp:340
list< CRef< CNode > > Tdata
Definition: NodeSet_.hpp:89
const Tdata & Get(void) const
Get the member data.
Definition: NodeSet_.hpp:164
const Tdata & Get(void) const
Get the member data.
const TFdict & GetFdict(void) const
Get the Fdict member data.
const TFeatures & GetFeatures(void) const
Get the Features member data.
Definition: Node_.hpp:346
const Tdata & Get(void) const
Get the member data.
const TNodes & GetNodes(void) const
Get the Nodes member data.
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
int i
yy_size_t n
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
EIPRangeType t
Definition: ncbi_localip.c:101
#define assert(x)
Definition: srv_diag.hpp:58
#define row(bind, expected)
Definition: string_bind.c:73
ColInfo(const string &n, ITableData::ColumnType t)
USING_SCOPE(objects)
void initCTableDataBioTreeContainer()
bool StringToSeqId(const string &seq_id, CRef< CSeq_id > &id)
static const char *const features[]
Modified on Wed Apr 17 13:08:26 2024 by modify_doxy.py rev. 669887