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

Go to the SVN repository for this file.

1 /* $Id: gui_object_info_bioseq_set.cpp 41372 2018-07-18 20:45:38Z rudnev $
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 
36 #include <gui/objutils/label.hpp>
37 #include <gui/objutils/tooltip.hpp>
38 
40 #include <objmgr/align_ci.hpp>
41 
43 
46 
48 {
50  typeid(IGuiObjectInfo).name(),
51  CBioseq_set::GetTypeInfo(),
53 }
54 
56  SConstScopedObject& object, ICreateParams* /*params*/)
57 {
59  gui_info->m_Object = object.object;
60  gui_info->m_Scope = object.scope;
61  return gui_info;
62 }
63 
64 static bool s_HasAlignment(const CBioseq_set& bst, CScope* scope)
65 {
66  if(scope) {
67  CBioseq_set_Handle bsh = scope->GetBioseq_setHandle(bst);
68  if(bsh) {
70 
71  SAnnotSelector sel;
72  sel.SetMaxSize(1);
73  sel.SetLimitTSE(tse);
74  CAlign_CI align_it(tse, sel);
75  if (align_it.GetSize() != 0) {
76  return true;
77  }
78  }
79  }
80  return false;
81 }
82 
84 {
85  const CBioseq_set& bioseq_set = dynamic_cast<const CBioseq_set&>(*m_Object);
86  bool aln;
87 
88  switch(bioseq_set.GetClass()) {
90  return "DNA + Protein Translation (Nuc-Prot)";
92  return "Segmented Sequence";
94  return "Genomic Products";
96  aln = s_HasAlignment(bioseq_set, m_Scope);
97  return aln ? "Population Study" : "Population Study (Aligned)";
99  aln = s_HasAlignment(bioseq_set, m_Scope);
100  return aln ? "Phylogenetic Study" : "Phylogenetic Study (Aligned)";
102  aln = s_HasAlignment(bioseq_set, m_Scope);
103  return aln ? "Ecological Study" : "Ecological Study (Aligned)";
105  aln = s_HasAlignment(bioseq_set, m_Scope);
106  return aln ? "Mutation Study" : "Mutation Study (Aligned)";
107  default:
108  break;
109  }
110 
111  return "";
112 }
113 
115 {
116  string label;
118  return label;
119 }
120 
121 void CGuiObjectInfoBioseq_set::GetToolTip(ITooltipFormatter& tooltip, string& /*t_title*/, TSeqPos /*at_p*/, bool* isGeneratedBySvc) const
122 {
123  string t_text;
125  tooltip.AddRow(t_text);
126  if(isGeneratedBySvc) {
127  *isGeneratedBySvc = false;
128  }
129 }
130 
CAlign_CI –.
Definition: align_ci.hpp:63
size_t GetSize(void) const
CBioseq_set_Handle –.
static void RegisterFactory(const string &interface_name, IInterfaceFactory *factory)
CScope –.
Definition: scope.hpp:92
CSeq_entry_Handle –.
primitive interface to arrange tabular data in the tooltips
Definition: tooltip.hpp:55
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
Definition: label.cpp:140
virtual void AddRow(const string &sContents="", unsigned colspan=2)=0
add a row with a cell, spanning across all columns
static CGuiObjectInfoBioseq_set * CreateObject(SConstScopedObject &object, ICreateParams *params)
virtual void GetToolTip(ITooltipFormatter &tooltip, string &t_title, TSeqPos at_p=(TSeqPos) -1, bool *isGeneratedBySvc=NULL) const
Get tooltip.
@ eDescriptionBrief
Definition: label.hpp:67
CBioseq_set_Handle GetBioseq_setHandle(const CBioseq_set &seqset, EMissing action=eMissing_Default)
Definition: scope.cpp:176
CSeq_entry_Handle GetTopLevelEntry(void) const
Return a handle for the top-level seq-entry.
SAnnotSelector & SetMaxSize(TMaxSize max_size)
Set maximum number of annotations to find.
SAnnotSelector & SetLimitTSE(const CTSE_Handle &limit)
Limit annotations to those from the TSE only.
#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 const char label[]
TClass GetClass(void) const
Get the Class member data.
@ eClass_pop_set
population study
@ eClass_phy_set
phylogenetic study
@ eClass_mut_set
set of mutations
@ eClass_eco_set
ecological sample study
@ eClass_nuc_prot
nuc acid and coded proteins
Definition: Bioseq_set_.hpp:99
@ eClass_gen_prod_set
genomic products, chrom+mRNA+protein
@ eClass_segset
segmented sequence + parts
USING_SCOPE(objects)
static bool s_HasAlignment(const CBioseq_set &bst, CScope *scope)
void initCGuiObjectInfoBioseq_set()
SAnnotSelector –.
Modified on Mon Feb 26 04:03:12 2024 by modify_doxy.py rev. 669887