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

Go to the SVN repository for this file.

1 /* $Id: seqtable_graph_track.cpp 42211 2019-01-11 19:53:22Z 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: Liangshou Wu
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
42 
43 
46 
47 
48 ///////////////////////////////////////////////////////////////////////////////
49 /// CSeqTableGraphTrack
50 
51 CTrackTypeInfo CSeqTableGraphTrack::m_TypeInfo("seqtable_graph_track",
52  "Sequence table graph track");
53 
55  CRenderingContext* r_cntx)
56  : CGraphTrack(ds, r_cntx)
57 {
58  // initialize annotation selector
60 }
61 
62 
64 {
65  return m_TypeInfo;
66 }
67 
68 
69 ///////////////////////////////////////////////////////////////////////////////
70 /// CSeqTableGraphTrackFactory methods
71 
74  ISGDataSourceContext* ds_context,
75  CRenderingContext* r_cntx,
76  const SExtraParams& params,
77  const TAnnotMetaDataList& /*src_annots*/) const
78 {
79  TTrackMap tracks;
80  TAnnotNameTitleMap annots;
81 
82  if (params.m_SkipGenuineCheck && !params.m_Annots.empty()) {
83  ITERATE (SExtraParams::TAnnots, iter, params.m_Annots) {
84  annots.insert(TAnnotNameTitleMap::value_type(*iter, ""));
85  }
86  } else {
87  // collect non-NA tracks
88  CIRef<ISGDataSource> ds = ds_context->GetDS(
89  typeid(CSGGraphDSType).name(), object);
90  CSGGraphDS* graph_ds = dynamic_cast<CSGGraphDS*>(ds.GetPointer());
91  graph_ds->SetDepth(params.m_Level);
92  graph_ds->SetAdaptive(params.m_Adaptive);
93 
94  SAnnotSelector sel;
95  if (params.m_Annots.empty()) {
97  sel.ExcludeNamedAnnots("SNP");
98  graph_ds->GetSeqtableAnnots(sel, r_cntx->GetVisSeqRange(), annots);
99  } else {
101  sel.ExcludeNamedAnnots("SNP");
102  graph_ds->GetAnnotNames(sel, r_cntx->GetVisSeqRange(), annots, true);
103  }
104  }
105 
106  // create feature tracks
107  ITERATE (TAnnotNameTitleMap, iter, annots) {
109  ds_context->GetDS(typeid(CSGGraphDSType).name(), object);
110  CSGGraphDS* graph_ds = dynamic_cast<CSGGraphDS*>(ds.GetPointer());
111  graph_ds->SetDepth(params.m_Level);
112  graph_ds->SetAdaptive(params.m_Adaptive);
113  graph_ds->SetSeqTable(true);
114  graph_ds->SetGraphLevels(iter->first);
115 
116  CRef<CSeqTableGraphTrack> track(new CSeqTableGraphTrack(graph_ds, r_cntx));
117  track->SetAnnot(iter->first);
118  if ( !iter->second.empty() ) {
119  track->SetTitle(iter->second);
120  }
121  tracks[iter->first] = track.GetPointer();
122  }
123 
124  return tracks;
125 }
126 
127 
129 {
131 }
132 
133 
135 {
137 }
138 
139 
CGraphTrack –.
Definition: graph_track.hpp:55
objects::SAnnotSelector & x_GetAnnotSelector()
CRef –.
Definition: ncbiobj.hpp:618
CRenderingContext offers the basic context and utility methods for rendering layout objects in featur...
const TSeqRange & GetVisSeqRange() const
void SetGraphLevels(const string &annot)
void SetDepth(int depth)
Set the annotation selector resolving depth.
void SetAdaptive(bool flag)
CSGGraphDSType.
void GetSeqtableAnnots(objects::SAnnotSelector &sel, const TSeqRange &range, TAnnotNameTitleMap &names) const
void SetSeqTable(bool f)
inline methods
void GetAnnotNames(objects::SAnnotSelector &sel, const TSeqRange &range, TAnnotNameTitleMap &names, bool seq_table=false) const
virtual TTrackMap CreateTracks(SConstScopedObject &object, ISGDataSourceContext *ds_context, CRenderingContext *r_cntx, const SExtraParams &params=SExtraParams(), const TAnnotMetaDataList &src_annots=TAnnotMetaDataList()) const
create a layout track based on the input objects and extra parameters.
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
CSeqTableGraphTrack –.
CSeqTableGraphTrack(CSGGraphDS *ds, CRenderingContext *r_cntx)
virtual const CTrackTypeInfo & GetTypeInfo() const
static CTrackTypeInfo m_TypeInfo
CSeqTableGraphTrack.
CTrackTypeInfo - holds description of a layout track type.
const string & GetDescr() const
const string & GetId() const
ISGDSManager is seqgraphic data source manage that serves as an data source context.
virtual CIRef< ISGDataSource > GetDS(const string &type, SConstScopedObject &object)=0
Get a seqgraphic data source instance of the specified type.
iterator_bool insert(const value_type &val)
Definition: map.hpp:165
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
static objects::SAnnotSelector GetAnnotSelector(TAnnotFlags flags=0)
request an annotation selector for a given type
Definition: utils.cpp:168
SAnnotSelector & ExcludeNamedAnnots(const CAnnotName &name)
Add named annot to set of annots names to exclude.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
USING_SCOPE(objects)
extra parameter for initializing a track.
bool m_Adaptive
Adaptive/Exact selector.
TAnnots m_Annots
particular annotations the track will be looking at.
int m_Level
layout level that limits feature retrieving used by annotation selector.
bool m_SkipGenuineCheck
Flag indicating if track verification is required.
SAnnotSelector –.
Modified on Fri Sep 20 14:58:21 2024 by modify_doxy.py rev. 669887