109 static void GetAnnotNames(
const objects::CBioseq_Handle& handle,
130 return is_gaps[
row / 8] & 0x01 << (8 -
row % 8);
149 objects::CScope& scope,
TJobToken token);
184 , m_IsChromosome(
true)
304 const CSeq_id&
id =
dynamic_cast<const CSeq_id&
>(
object.object.GetObject());
311 static string sid(
"seqgraphic_segment_map_ds_type");
318 static string slabel(
"Graphical View Segment Map Data Source Type");
353 int total_levels = 0;
354 for (
int level = 0; level < 2; ++level) {
360 bool isMaxSegmentsReached{
false};
361 while (start <= stop) {
369 if(isMaxSegmentsReached) {
373 if(isMaxSegmentsReached) {
392 level =
min(level, max_level);
401 for (
int l = start_l;
l <= end_l; ++
l) {
407 if (seg)
return true;
426 bool over_limit =
false;
439 for (
size_t levels = 0; levels < 4; ++levels) {
451 size_t seg_count = 0;
474 if (over_limit)
break;
498 TSeqPos seg_from = seg.GetPosition();
499 TSeqPos seg_to = seg.GetEndPosition() - 1;
502 TSeqPos ref_from = seg.GetRefPosition();
503 TSeqPos ref_to = seg.GetRefEndPosition() - 1;
515 bool neg = seg.GetRefMinusStrand();
520 seg_r, neg, length));
528 seg_maps.push_back(seqmap);
537 "exception in retrieval of seq-maps: " << e.
GetMsg());
542 if (seg_maps.size()) {
561 if (over_limit &&
result->m_ObjectList.empty()) {
562 string msg =
"There are more than ";
564 msg +=
" segments for the given range. Segment map is not shown at this zooming level!";
568 result->m_ObjectList.push_back(message_glyph);
573 }
catch (std::exception& ex) {
587 typedef pair<const TSeqRange, CRef<CSegmentGlyph> > CSegMapPair;
589 CSegMapMap merge_map;
601 merge_map.insert( CSegMapPair(
range, segmap) );
611 pair<CSegMapMap::iterator, CSegMapMap::iterator> the_bounds;
612 the_bounds = merge_map.equal_range(*iter);
617 for (CSegMapMap::iterator it = the_bounds.first;
618 it != the_bounds.second; it++)
620 CSegMapPair pair = *it;
624 comp_range.
insert(*cr_it);
627 mapped_range.
insert(*mr_it);
630 ref.
Reset(pair.second.GetPointer());
633 ref->SetComponentRanges(comp_range);
634 ref->SetMappedRanges(mapped_range);
638 objs.push_back(obj_ref);
665 objects::CBioseq_Handle handle,
676 , m_SeqVector(seq_vec)
688 objects::SAnnotSelector& sel,
691 sel.SetCollectNames();
697 if (iter->IsNamed()) {
698 if (iter->GetName().find(
"@@") == string::npos) {
710 while (pre != annots.
end()) {
713 if (iter != annots.
end()
716 && pre->first.substr(0, 11) == iter->first.substr(0, 11)) {
738 "failed to retrieve map from cache: " << e.
GetMsg());
773 perfLog.
AddParameter (
"description",
"Load segment smear map from delta seqs");
780 int depth = is_chromosome ? 1 : 0;
787 unique_ptr<CSegmentSmearGlyph::CSegMap>
795 using TSegData =
struct {
800 vector<TSegData>
data;
810 TSeqPos seg_from = seg.GetPosition();
811 TSeqPos seg_to = seg.GetEndPosition() - 1;
812 if (pre_to < seg_from) {
813 data.push_back({
TSeqRange(pre_to, seg_from - 1), gap_val, 0});
815 ids.push_back(seg.GetRefSeqid());
821 if (seg.GetEndPosition() > r_to) {
829 auto handles =
m_Handle.GetScope().GetBioseqHandles(ids);
832 for (
auto& d :
data) {
833 if (d.val != gap_val) {
842 the_map->AddRange(d.range, d.val,
false);
852 result->m_ObjectList.push_back(glyph);
863 perfLog.
AddParameter (
"description",
"Loading segment smear map from NA");
877 unique_ptr<CSegmentSmearGlyph::CSegMap> the_map(
890 col_to.
TryGet(annot, rows - 1, to);
895 col_from.
TryGet(annot, 0, from);
896 if (r_to < (
TSeqPos)from)
break;
903 if ((*iter)->GetHeader().CanGetField_name() &&
904 (*iter)->GetHeader().GetField_name() ==
"is_gap") {
905 col_gap = iter->GetPointer();
909 if ( !col_gap )
return eFailed;
920 size_t r_end = rows - 1;
923 row = (r_start + r_end) / 2;
927 }
while ((
TSeqPos)from != r_from && r_start < r_end - 1);
930 for (
row = (r_start + r_end) / 2; (size_t)
row < rows; ++
row) {
935 if ((
TSeqPos)from > r_to)
break;
941 the_map->AddRange(
TSeqRange(from, to), (TValType)qual,
false);
952 result->m_ObjectList.push_back(hist);
965 perfLog.
AddParameter (
"description",
"Loading segment smear map from NetCache");
970 unique_ptr<CSegmentSmearGlyph::CSegMap> the_map(
975 the_map->Deserialize(*reader);
980 result->m_ObjectList.push_back(hist);
997 "failed to store map to cache: " << e.
GetMsg());
1019 objects::CScope& scope,
1039 ids.reserve(
m_Objs.size());
1040 for (
auto&& iter :
m_Objs) {
1053 _ASSERT(bshs.size() == ids.size());
1054 if (bshs.size() != ids.size())
1057 for (
auto&& iter :
m_Objs) {
1060 if (bshs[
i] && bshs[
i].CanGetInst_Mol()) {
1117 all_objs.push_back(sp);
1120 result->m_ObjectList.swap(all_objs);
static CRef< CScope > m_Scope
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
const TAnnotNames & GetAnnotNames(void) const
CAppJobError Default implementation for IAppJobError - encapsulates a text error message.
CJobResultBase – the basic job result class holding a token.
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
class CRegistryReadView provides a nested hierarchical view at a particular key.
objects::SAnnotSelector m_Sel
our annotation selector
TSeqRange m_Range
target range
objects::CBioseq_Handle m_Handle
target sequence
TJobID x_LaunchJob(IAppJob &job, int report_period=1, const string &pool="ObjManagerEngine")
Launch either a background or foreground job.
int m_Depth
annotation resolving depth
objects::CScope & GetScope(void) const
Get the scope from the handle.
void SetDepth(int depth)
Set the annotation selector resolving depth.
objects::CBioseq_Handle m_Handle
CSGJobResult – the data structure holding the seqgraphic job results.
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" )
virtual ISGDataSource * CreateDS(SConstScopedObject &object) const
create an instance of the layout track type using default settings.
virtual bool IsSharable() const
check if the data source can be shared.
bool IsChromosome() const
bool HasComponent(const TSeqRange &range) const
void LoadSegmentMap(const TSeqRange &range, int cutoff, TJobToken token)
static void SetICacheClient(ICache *pCache)
Set cache client to use.
static bool GetEnabled()
Indicates if the segment map is enabled.
void SetSegmentLevel(ESegmentLevel level)
Set which segment level to show.
void LoadSegmentSmear(const TSeqRange &range, TModelUnit scale, const objects::CSeqVector *seq_vec=nullptr)
Used in sequence track for showing segment color.
int GetSegmentMapLevels(const TSeqRange &range) const
Get total number of segment map levels.
bool HasSegmentMap(int level, const TSeqRange &range) const
Query if there is segment maps for given level.
int x_ConceptualToRealDepth(ESegmentLevel level) const
Convert conceptual segment level to real segment depth.
static ICache * m_Cache
Cache, used to store segment smear.
bool m_IsChromosome
Flag to indicate if the sequence is a chromosome sequence.
ESegmentLevel
It is not technically correct to name a specific segment level as config/scaffold and component becau...
static bool m_Enabled
Indicates if the segment map is enabled.
void GetAnnotNames(objects::SAnnotSelector &sel, const TSeqRange &range, TAnnotNameTitleMap &names) const
void LoadSegmentMapSeqIDs(CSeqGlyph::TObjects &objs, TJobToken token)
static void SetEnabled(bool enabled=true)
Enables/disables the segment map.
string m_Annot
The named annotation storing segment map data.
CSGSegmentMapDS(objects::CScope &scope, const objects::CSeq_id &id)
bool HasScaffold(const TSeqRange &range) const
CSGSegmentMapJob declaration.
static bool HasSegmentMap(const objects::CBioseq_Handle &Handle, int level, const TSeqRange &range)
objects::CBioseq_Handle m_Handle
target sequence
int m_Cutoff
limit of number of segments we want to show.
TSeqRange m_Range
target range
virtual EJobState x_Execute()
method truly doing the job.
CSGSegmentMapJob(const string &desc, objects::CBioseq_Handle handle, const TSeqRange &range, int depth, int cutoff, TJobToken token)
CSGSegmentMapJob implementation.
bool x_AdaptiveDepth() const
static int GetSegmentMapLevels(const objects::CBioseq_Handle &handle, const TSeqRange &range)
IAppJob::EJobState x_MergeSeqSegments(CSegmentGlyph::TSeqMapList &seg_maps, CSeqGlyph::TObjects &objs)
merge equal segment maps into one map.
int m_Depth
Resolve depth for selector.
CSGSegmentSmearJob declaration.
void x_WriteToCache(const string &key, const CSegmentSmearGlyph::CSegMap &density_map)
string m_Annot
annotation storing the segments
static void GetAnnotNames(const objects::CBioseq_Handle &handle, const TSeqRange &range, objects::SAnnotSelector &sel, TAnnotNameTitleMap &annots)
ICache * m_Cache
cache to store segment ranges
const CSeqVector * m_SeqVector
IAppJob::EJobState x_LoadFromNetCache(const string &key)
TModelUnit m_Scale
bases per pixel
IAppJob::EJobState x_LoadFromNA()
bool x_IsGap(vector< char > is_gaps, int row) const
virtual EJobState x_Execute()
method truly doing the job.
CSGSegmentSmearJob(const string &desc, objects::CBioseq_Handle handle, const TSeqRange &range, TModelUnit scale, const string &annot, ICache *cache=0, const CSeqVector *seq_vec=nullptr)
CSGSegmentSmearJob implementation.
string x_GetCacheKey() const
IAppJob::EJobState x_LoadFromDeltaSeqs()
CSGSegmentsSeqIDJob declaration.
objects::CScope & m_Scope
scope for retrieving the CBioseq
CSGSegmentsSeqIDJob(const string &desc, CSeqGlyph::TObjects &objs, objects::CScope &scope, TJobToken token)
CSGSegmentsSeqIDJob implementation.
virtual EJobState x_Execute()
method truly doing the job.
CSeqGlyph::TObjects m_Objs
objects for post-processing
CSGSwitchPointJob declaration.
objects::CBioseq_Handle m_Handle
target sequence
virtual EJobState x_Execute()
method truly doing the job.
CSGSwitchPointJob(const string &desc, objects::CBioseq_Handle handle)
CSGSwitchPointJob implementation.
static bool IsChromosome(const objects::CBioseq_Handle &handle, objects::CScope &scope)
void SetSeqQuality(CSegmentConfig::TSegMapQuality quality)
const objects::CSeq_loc & GetLocation(void) const
access the position of this object.
vector< CRef< CSegmentGlyph > > TSeqMapList
void Serialize(IWriter &writer) const
class CSeqGlyph defines an interface that wraps a rectilinear abstract object.
list< CRef< CSeqGlyph > > TObjects
CSeqGraphicJob – the base class of seqgraphic job for handling the job status such as reporting the p...
virtual void SetTaskTotal(int total)
virtual void SetTaskName(const string &name)
virtual void SetTaskCompleted(int completed)
set total finished task number.
void SetToken(TJobToken token)
CSeqGraphicJob inline methods.
TJobToken m_Token
Job token recognizable by job listener.
CRef< CAppJobError > m_Error
bool TryGetBool(size_t row, bool &v) const
bool TryGet(const CFeat_CI &feat_ci, Value &v) const
BLOB cache read/write/maintenance interface.
virtual IWriter * GetWriteStream(const string &key, TBlobVersion version, const string &subkey, unsigned int time_to_live=0, const string &owner=kEmptyStr)=0
Return sequential stream interface to write BLOB data.
virtual bool HasBlobs(const string &key, const string &subkey)=0
Check if any BLOB exists (any version)
virtual IReader * GetReadStream(const string &key, TBlobVersion version, const string &subkey)=0
Return sequential stream interface to read BLOB data.
container_type::iterator iterator
const_iterator begin() const
const_iterator end() const
iterator_bool insert(const value_type &val)
container_type::value_type value_type
iterator_bool insert(const value_type &val)
static unsigned char depth[2 *(256+1+29)+1]
bool Empty(const CNcbiOstrstream &src)
static const struct name_t names[]
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
const string & GetMsg(void) const
Get message string.
void Warning(CExceptionArgs_Base &args)
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void Info(CExceptionArgs_Base &args)
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 int GetMaxSearchSegments(const CRegistryReadView &view)
static objects::SAnnotSelector::EMaxSearchSegmentsAction GetMaxSearchSegmentsAction(const CRegistryReadView &view)
static const string & GetUnnamedAnnot()
Get the commonly used symbol representing a unnnamed annotation.
static CRegistryReadView GetSelectorRegistry()
helper functions to read selector-related tune-up info (mostly segment limits) from registry:
static void SetResolveDepth(objects::SAnnotSelector &sel, bool adaptive, int depth=-1)
help function for setting selector resolve depth.
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 ...
CGlPoint< TModelUnit > TModelPoint
virtual bool IsCanceled() const override
EJobState
Job states (describe FSM)
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
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.
@ eContent
Untagged human-readable accession or the like.
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,...
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
vector< CBioseq_Handle > TBioseqHandles
vector< CSeq_id_Handle > TIds
@ eGetBioseq_Loaded
Search in all loaded TSEs in the scope.
@ eGetBioseq_All
Search bioseq, load if not loaded yet.
TSeqPos GetBioseqLength(void) const
CConstRef< CSeq_annot > GetCompleteSeq_annot(void) const
Complete and return const reference to the current seq-annot.
size_t GetSeq_tableNumRows(void) const
bool CanGetInst_Mol(void) const
SSeqMapSelector & SetResolveCount(size_t res_cnt)
Set max depth of resolving seq-map.
CSeqMap::ESegmentType GetType(void) const
TSeqPos GetPosition(void) const
return position of current segment in sequence
const CSeqMap_CI & GetCurrentSeqMap_CI() const
vector< CRef< CSeqMapSwitchPoint > > TSeqMapSwitchPoints
TSeqMapSwitchPoints GetAllSwitchPoints(const CBioseq_Handle &seq, const TSeqMapSwitchAligns &aligns)
@ eSeqRef
reference to Bioseq
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
position_type GetLength(void) const
CRange< TSeqPos > TSeqRange
typedefs for sequence ranges
static TThisType GetWhole(void)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
const TColumns & GetColumns(void) const
Get the Columns member data.
vector< CRef< CSeqTable_column > > TColumns
@ eField_id_location_to
interval to
@ eField_id_location_from
interval from
bool IsLocal(void) const
Check if variant Local is selected.
list< CRef< CSeq_align > > TAssembly
const TInst & GetInst(void) const
Get the Inst member data.
bool IsSetAssembly(void) const
how was this assembled? Check if a value has been assigned to Assembly data member.
bool IsSetHist(void) const
sequence history Check if a value has been assigned to Hist data member.
TTech GetTech(void) const
Get the Tech member data.
bool IsSetInst(void) const
the sequence data Check if a value has been assigned to Inst data member.
const TAssembly & GetAssembly(void) const
Get the Assembly member data.
const THist & GetHist(void) const
Get the Hist member data.
const TSeq_table & GetSeq_table(void) const
Get the variant data.
bool IsSetTech(void) const
Check if a value has been assigned to Tech data member.
const TData & GetData(void) const
Get the Data member data.
const TMolinfo & GetMolinfo(void) const
Get the variant data.
@ eTech_htgs_2
ordered High Throughput sequence contig
@ eTech_htgs_3
finished High Throughput sequence
@ eTech_htgs_1
unordered High Throughput sequence contig
@ eTech_wgs
whole genome shotgun sequencing
@ e_Molinfo
info on the molecule and techniques
Interfaces for a local cache of versioned binary large objects (BLOBS).
range(_Ty, _Ty) -> range< _Ty >
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
Defines NCBI C++ API for timing-and-logging, classes, and macros.
CSegmentConfig::ESequenceQuality SGetSeqQuality(CMolInfo_Base::TTech tech)
utility function
const int kSegmentLoadLimit
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
#define row(bind, expected)
Selector used in CSeqMap methods returning iterators.