1 #ifndef GUI_OBJUTILS___UTILS__HPP
2 #define GUI_OBJUTILS___UTILS__HPP
87 const objects::CSeq_feat&
GetFeature()
const {
return m_Feat.GetOriginalFeature(); }
96 void AddChild(
const objects::CMappedFeat& feat)
119 #define __GUI_SEQ_UTILS_DEFINED__
123 typedef vector< CRef<objects::CSeq_loc> >
TLocVec;
146 fFeature_LinkFeatures = 0x1,
155 fAnnot_UnsetNamed = 0x01,
158 fAnnot_UnsetDepth = 0x02
173 static objects::SAnnotSelector
176 static objects::SAnnotSelector
180 static objects::SAnnotSelector
184 static objects::SAnnotSelector
190 static objects::SAnnotSelector
191 GetAnnotSelector(
const vector<string>& annots);
193 static objects::SAnnotSelector
194 GetAnnotSelector(
const vector<string>& annots,
195 bool adaptive,
int depth);
198 static void SetAnnot(objects::SAnnotSelector& sel,
const string& annot);
203 static objects::SAnnotSelector::EMaxSearchSegmentsAction GetMaxSearchSegmentsAction(
const CRegistryReadView& view);
208 static bool CheckMaxSearchSegments(
int actual,
int max, objects::SAnnotSelector::EMaxSearchSegmentsAction action);
216 static void SetResolveDepth(objects::SAnnotSelector& sel,
217 bool adaptive,
int depth = -1);
234 RemapChildToParent(
const objects::CSeq_loc& parent,
235 const objects::CSeq_loc& child,
236 objects::CScope* scope =
NULL);
242 static bool Match(
const objects::CSeq_id& id1,
243 const objects::CSeq_id& id2,
244 objects::CScope* scope =
NULL);
246 static bool Match(
const objects::CSeq_id_Handle& id1,
247 const objects::CSeq_id_Handle& id2,
248 objects::CScope* scope =
NULL);
252 CreateSeq_loc(
const objects::CSeq_id&
id,
258 static bool GetRangeCollection(
const objects::CSeq_id&
id,
259 const objects::CHandleRangeMap&
map,
267 const objects::CSeq_loc& loc);
272 MixLocToLoc(
const objects::CSeq_loc& mix_loc,
273 const objects::CBioseq_Handle& handle);
275 static string GetAnnotName(
const objects::CSeq_annot_Handle& annot_handle);
286 static bool IsNAA(
const string& annot,
bool isStrict =
false);
288 static bool IsNAA_Name(
const string& annot);
292 static bool IsExtendedNAA(
const string& annot,
bool isStrict =
false);
295 static bool IsExtendedNAA_Name(
const string& annot);
298 static bool IsAlignDb(
const string& annot);
300 static string GetAlignDbBatch(
const string& annot);
302 static string GetAlignDbIsQuery(
const string& annot);
305 static string MakeRmtAnnotName(
const string& sSuffix);
307 static bool isRmtAnnotName(
const string& sAnnotname);
310 static bool isRmtPipelineFileType(
const string& sFileType);
313 static bool IsUnnamed(
const string& annot);
316 static const string& GetUnnamedAnnot();
319 static bool IsVDBAccession(
const string& acc);
321 static bool IsPseudoFeature(
const objects::CSeq_feat& feat);
322 static bool IsPartialFeature(
const objects::CSeq_feat& feat);
323 static bool IsPartialStart(
const objects::CSeq_loc& loc);
324 static bool IsPartialStop(
const objects::CSeq_loc& loc);
325 static bool IsSameStrands(
const objects::CSeq_loc& loc);
326 static bool IsException(
const objects::CSeq_feat& feat);
327 static string GetNcbiBaseUrl();
330 static string CreateTableStart();
331 static string CreateTableEnd();
332 static string CreateTableRow(
const string&
tag =
"",
const string&
value =
"");
333 static string CreateSectionRow(
const string&
tag);
334 static string CreateLinkRow(
const string&
tag,
335 const string&
label,
const string& url);
339 static bool isQuasiLocal(
const objects::CBioseq_Handle& handle);
347 static bool CanHavePlacements(
const objects::CSeq_id& seqid);
360 static TLocVec GetLocPlacements(
const objects::CSeq_loc& loc,
int time_out_sec = 1);
364 static bool StringToRange(
const string& range_str,
long& from,
long& to);
373 static string GetChrGI(
TGi gi);
376 static string GetChrId(
const string& id_str, objects::CScope& scope);
389 static void GetAssmAccs_Gi(
TAccs& accs,
TGi gi);
397 static bool isTopLevel(
const objects::CSeq_id& seq_id,
const string& assm_acc, objects::CScope* scope =
NULL);
401 static TMappingInfo GetRnaMappingInfo(
const objects::CSeq_loc& feat_loc,
402 const objects::CMappedFeat& feat,
403 const objects::CBioseq_Handle& handle);
410 const objects::CSeq_feat& rna_feat,
411 const objects::CMappedFeat& mapped_cds_feat,
412 const objects::CSeq_loc& feat_loc,
413 objects::CScope& scope,
414 const int feat_offset = 0);
420 const objects::CSeq_loc &feat_loc,
421 const objects::CSeq_id &product_id,
422 const int feat_offset = 0);
428 static objects::CMappedFeat GetMrnaForCds(
const objects::CMappedFeat &cds_feat,
const string &named_acc =
string());
431 static void GetMappingInfo(
const objects::CMappedFeat &mapped_feat,
const objects::CBioseq_Handle& bsh,
TMappingInfo &
info,
const string &annot =
string());
440 static bool GetGIString(
const string& sid,
string* gi_str);
443 template<
class T>
static string CreateIdStr(
const vector<T>& uids);
448 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()");
450 static void ELinkQuery(
const string &db_from,
const string &db_to,
const TSeqIdHandles& uids_from,
TEntrezIds& uids_to,
const string &
cmd =
"neighbor",
const string &xpath =
"//Link/Id/text()");
453 static void ELinkQuery(
const string &db_from,
const string &db_to,
const TEntrezIds &uids_from,
xml::document& linkset,
const string &
cmd =
"neighbor");
455 static void ELinkQuery(
const string &db_from,
const string &db_to,
const TSeqIdHandles& uids_from,
xml::document& linkset,
const string &
cmd =
"neighbor");
459 static void ESearchQuery(
const string &db,
const string &term,
TEntrezIds&uids,
size_t &
count,
const int ret_max,
const string &xpath =
"//IdList/Id/text()");
462 static void ESearchQuery(
const string &db,
const string &term,
const string &web_env,
const string &query_key,
TEntrezIds&uids,
size_t &
count,
int retstart = 0,
const string &xpath =
"//IdList/Id/text()");
465 static void ESearchQuery(
const string &db,
const string &term,
const string &web_env,
const string &query_key,
xml::document &searchset,
int retstart = 0);
471 static int GetGenCode(
const objects::CBioseq_Handle& handle);
473 static void CreateCoverageAnnotName(
const string& annot_name,
string& coverage_annot);
474 static bool IsCoverageAnnotName(
const string& annot_name);
481 static void ParseRanges(
const string& sRanges,
TRanges& ranges);
485 fBlastTrackShowFlag_Original = (1 << 1),
486 fBlastTrackShowFlag_Cleaned = (1 << 2)
491 static void SetAnnotShown(objects::CSeq_annot& annot,
bool isShown);
495 static bool GetAnnotShown(
const objects::CSeq_annot& annot);
514 virtual objects::CSeq_id_Handle
Map(
const objects::CSeq_id_Handle& idh)
override;
536 static string kUnnamedAnnot =
"Unnamed";
537 return kUnnamedAnnot;
543 coverage_annot = annot_name;
544 coverage_annot +=
" ";
558 size_t count = uids.size();
562 idstrm <<
',' << uids[
i];
Adapter class to convert CGencollIdMapper to IIdMapper interface.
class CRegistryReadView provides a nested hierarchical view at a particular key.
Base class for all serializable objects.
General IdMapper interface.
Task clients implement this callback interface.
The xml::document class is used to hold the XML tree and various bits of information about it.
The xml::node class is used to hold information about one XML node.
Include a standard set of the NCBI C++ Toolkit most basic headers.
static unsigned char depth[2 *(256+1+29)+1]
static const char * str(char *buf, int n)
TSignedSeqRange StringToRange(const string &s)
CRange< Position > Map(const CRange< Position > &target, const CRange< Position > &range)
unsigned int THTTP_Flags
Bitwise OR of EHTTP_Flag.
@ fHTTP_AutoReconnect
See HTTP_CreateConnectorEx()
virtual void SetTaskName(const string &name)=0
virtual void SetTaskCompleted(int completed)=0
set total finished task number.
void AddChild(const objects::CMappedFeat &feat)
static const string kCoverageStr
const objects::CSeq_feat & GetFeature() const
CLinkedFeature(const objects::CMappedFeat &feat)
static bool Match(const objects::CSeq_id_Handle &id1, const objects::CSeq_id_Handle &id2, objects::CScope *scope=NULL)
list< CRef< CLinkedFeature > > TLinkedFeats
vector< CRef< objects::CSeq_loc > > TLocVec
TLinkedFeats & GetChildren()
static objects::SAnnotSelector GetAnnotSelector(objects::SAnnotSelector::TFeatSubtype, TAnnotFlags flags=0)
static bool IsCoverageAnnotName(const string &annot_name)
objects::CBioseq_Handle GetBioseqForSeqFeat(const objects::CSeq_feat &f, objects::CScope &scope)
static bool IsCrossOrigin(const objects::CSeq_loc &loc)
static string GetAnnotName(const objects::CSeq_annot &annot)
static objects::SAnnotSelector GetAnnotSelector(objects::SAnnotSelector::TFeatType, TAnnotFlags flags=0)
static bool IsCrossOrigin(const objects::CSeq_align &align)
pair< TProdInterval, TGenomicInterval > TMappedInt
objects::CMappedFeat & GetMappedFeature()
vector< TEntrezId > TEntrezIds
EBlastTrackShowFlags
flags controlling BLAST track default visibility
static string GetAnnotComment(const objects::CSeq_annot &annot)
vector< objects::CSeq_id_Handle > TSeqIdHandles
static string GetAnnotName(const objects::CSeq_annot_Handle &annot_handle)
static void CreateCoverageAnnotName(const string &annot_name, string &coverage_annot)
CGencollIdMapper::SIdSpec m_Spec
virtual ~ISeqTaskProgressCallback()
objects::CSeq_entry_Handle GetTopSeqEntryFromScopedObject(SConstScopedObject &obj)
EAnnotationNameType TAnnotNameType
static const string & GetUnnamedAnnot()
Get the commonly used symbol representing a unnnamed annotation.
void AddChild(CLinkedFeature *feat)
vector< const objects::CFeatListItem * > GetSortedFeatList(objects::CSeq_entry_Handle seh, size_t max=numeric_limits< size_t >::max())
virtual void SetTaskTotal(int total)=0
static string CreateIdStr(const vector< T > &uids)
Convert a list of ids into a comma-delimited string.
static bool IsUnnamed(const string &annot)
check if a given annotation is a unnamed annotation.
static objects::SAnnotSelector GetAnnotSelector(objects::SAnnotSelector::TAnnotType choice, TAnnotFlags flags=0)
static string GetAnnotComment(const objects::CSeq_annot_Handle &annot_handle)
CConstRef< objects::CBioseq > GetBioseqForSeqdesc(CRef< objects::CScope > scope, const objects::CSeqdesc &seq_desc)
CRef< objects::CSeq_interval > TGenomicInterval
vector< TSeqRange > TRanges
CRef< objects::CSeq_interval > TProdInterval
CRef< CGencollIdMapper > m_Mapper
static void x_GetAssmIds_GI(string &gc_ids, TGi gi)
get all assembly ids associated with 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.
objects::CSeq_feat_Handle GetSeqFeatHandleForBadLocFeature(const objects::CSeq_feat &feat, objects::CScope &scope)
virtual bool StopRequested() const =0
EAnnotationNameType
flags for classifying annotation names.
vector< TMappedInt > TMappingInfo
const TLinkedFeats & GetChildren() const
objects::CMappedFeat m_Feat
virtual void AddTaskCompleted(int delta)=0
set to add newly finished task number.
const objects::CMappedFeat & GetMappedFeature() const
objects::CSeq_entry_Handle GetSeqEntryForPubdesc(CRef< objects::CScope > scope, const objects::CPubdesc &pubdesc)
@ eAnnot_Unnamed
unnamed annotation
@ eAnnot_All
all annotations
@ eAnnot_Named
all named annotations
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
@ eNocase
Case insensitive compare.
#define NCBI_GUIOBJUTILS_EXPORT
static const char label[]
CRef< objects::CBioseq > SeqLocToBioseq(const objects::CSeq_loc &loc, objects::CScope &scope)
const GenericPointer< typename T::ValueType > T2 value
Miscellaneous common-use basic types and functionality.
Int4 delta(size_t dimension_, const Int4 *score_)