utils.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:11k
- /*
- * ===========================================================================
- * PRODUCTION $Log: utils.hpp,v $
- * PRODUCTION Revision 1000.0 2004/06/01 19:56:12 gouriano
- * PRODUCTION PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.6
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_OBJUTILS___UTILS__HPP
- #define GUI_OBJUTILS___UTILS__HPP
- /* $Id: utils.hpp,v 1000.0 2004/06/01 19:56:12 gouriano Exp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Authors: Mike DiCuccio
- *
- * File Description:
- * General utility classes for GUI projects.
- */
- #include <corelib/ncbistd.hpp>
- #include <gui/objutils/feature.hpp>
- #include <objmgr/bioseq_handle.hpp>
- /** @addtogroup GUI_OBJUTILS
- *
- * @{
- */
- BEGIN_NCBI_SCOPE
- //
- // Main utilities class
- //
- class NCBI_GUIOBJUTILS_EXPORT CSeqUtils
- {
- public:
- // flags controlling feature retrieval
- enum {
- fFeature_LinkFeatures = 0x1,
- fFeature_Default = 0
- };
- typedef int TFeatureFlags;
- // request an annotation selector for a given type
- static objects::SAnnotSelector
- GetAnnotSelector(void);
- static objects::SAnnotSelector
- GetAnnotSelector(objects::SAnnotSelector::TAnnotType choice);
- static objects::SAnnotSelector
- GetAnnotSelector(objects::SAnnotSelector::TFeatType);
- static objects::SAnnotSelector
- GetAnnotSelector(objects::SAnnotSelector::TFeatSubtype);
- // Request a list of landmark features from a bioseq.
- static void GetLandmarkFeatures(const objects::CBioseq_Handle& handle,
- const TSeqRange& range,
- size_t max_feats,
- CLayoutFeat::TFeatList& info);
- // Request a list of features from a bioseq.
- static void GetFeatures(const objects::CBioseq_Handle& handle,
- const TSeqRange& range,
- objects::CSeqFeatData::E_Choice feat_type,
- CLayoutFeat::TFeatList& info,
- TFeatureFlags flags = fFeature_Default);
- static void GetFeatures(const objects::CBioseq_Handle& handle,
- const TSeqRange& range,
- objects::SAnnotSelector sel,
- CLayoutFeat::TFeatList& feats,
- TFeatureFlags flags = fFeature_Default);
- // Link features into a hierarchical list. This function will transform a
- // linear, feature-order-sorted list of CLayoutFeat objects into a
- // hierarchically arranged list in which genes are linked to mRNAs, mRNAs
- // to CDSs, etc.
- static void LinkFeatures(CLayoutFeat::TFeatList& features);
- // Request a list of alignments from a bioseq.
- enum EAlignFlags {
- fAlign_LinkMatePairs = 0x1,
- fAlign_MatedAlignsAsPwAlign = 0x2,
- fAlign_Default = 0x0
- };
- typedef int TAlignFlags;
- static void GetAlignments(const objects::CBioseq_Handle& handle,
- const TSeqRange& range,
- CLayoutEngine::TObjects& info,
- TAlignFlags flags = fAlign_Default);
- // Request a list of alignments as smears from a bioseq. Here, 'window'
- // is the number of bases per bin to place in the smeared alignment
- static void GetAlignmentSmears(const objects::CBioseq_Handle& handle,
- const TSeqRange& range,
- TSeqPos window,
- CLayoutEngine::TObjects& aligns);
- // Request a list of graphs from a bioseq.
- static void GetGraphs(const objects::CBioseq_Handle& handle,
- const TSeqRange& range,
- CLayoutEngine::TObjects& graphs);
- // remap a location to a parent location. The child location is split
- // such that all of its relative positions will map correctly to the
- // parent location's positions
- static CRef<objects::CSeq_loc>
- RemapChildToParent(const objects::CSeq_loc& parent,
- const objects::CSeq_loc& child,
- objects::CScope* scope = NULL);
- // check to see if two seq-ids are identical. If provided with a scope,
- // this function will use the synonyms available through a scope to check
- // for identicality. Note that this may require network access, and may
- // be slow.
- static bool Match(const objects::CSeq_id& id1,
- const objects::CSeq_id& id2,
- objects::CScope* scope = NULL);
- };
- END_NCBI_SCOPE
- /* @} */
- /*
- * ===========================================================================
- * $Log: utils.hpp,v $
- * Revision 1000.0 2004/06/01 19:56:12 gouriano
- * PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.6
- *
- * Revision 1.6 2004/05/14 14:24:47 dicuccio
- * Added new pure virtual requirement on CLayoutObject(): GetType(), returns enum
- * defined in CLayoutObject
- *
- * Revision 1.5 2004/05/10 00:00:38 dicuccio
- * Added flags to control retrieval of alignments
- *
- * Revision 1.4 2004/05/07 15:44:32 dicuccio
- * Removed GetLabel()
- *
- * Revision 1.3 2004/05/03 13:34:54 dicuccio
- * FIxed include guards, doxygen groups
- *
- * Revision 1.2 2004/05/03 12:41:35 dicuccio
- * Fixed #includes and export specifiers
- *
- * Revision 1.1 2004/04/30 11:52:53 dicuccio
- * Split out from gui/utils
- *
- * Revision 1.32 2004/04/16 14:27:17 dicuccio
- * Added doxygen module tag
- *
- * Revision 1.31 2004/04/16 13:30:39 lebedev
- * Do not link features by default
- *
- * Revision 1.30 2004/04/12 16:49:32 dicuccio
- * Dropped getMatePairs() as separate API - folded into GetAlignments()
- *
- * Revision 1.29 2004/04/07 12:40:53 dicuccio
- * Changed GetAnnotSelector() - for feature types, separated feature type and
- * subtype into different functions. Changed Match() - scope is now an optional
- * (default null) pointer
- *
- * Revision 1.28 2004/04/06 18:28:26 dicuccio
- * Added GetMatePairs(). Cosmetic changes.
- *
- * Revision 1.27 2004/04/02 16:12:59 yazhuk
- * Added Match() function for comparing CSeq_id-s
- *
- * Revision 1.26 2004/03/23 13:36:14 dicuccio
- * Removed lots of dead functions. Moved #include of alignment_smear.hpp to .cpp
- *
- * Revision 1.25 2004/03/22 16:39:35 rsmith
- * add GetAlignmentSmears()
- *
- * Revision 1.24 2004/03/11 17:20:23 dicuccio
- * Use gui/gui instead of gui/types. Use TSeqRange instead of TRange
- *
- * Revision 1.23 2004/02/17 17:17:17 dicuccio
- * Added flags to feature retrieval
- *
- * Revision 1.22 2004/02/04 18:05:30 grichenk
- * Added annotation filtering by set of types/subtypes.
- * Renamed *Choice to *Type in SAnnotSelector.
- *
- * Revision 1.21 2004/01/30 17:12:59 dicuccio
- * Added GetLabel() - moved from plugin_utils.[h,c]pp
- *
- * Revision 1.20 2003/10/28 15:23:47 lebedev
- * GetFeatures method that takes a selector added
- *
- * Revision 1.19 2003/10/22 15:40:57 dicuccio
- * Added API to create a dummy seq-entry to wrap a seq-annot
- *
- * Revision 1.18 2003/10/14 15:42:15 dicuccio
- * Changed API for RemapChildToParent() to accept an optional scope
- *
- * Revision 1.17 2003/10/14 12:19:47 dicuccio
- * Added RemapChildToParent() for remapping seq-locs
- *
- * Revision 1.16 2003/09/29 15:20:08 dicuccio
- * Deprecated gui/scope.hpp. Merged gui/core/types.hpp into gui/types.hpp
- *
- * Revision 1.15 2003/09/24 18:17:23 dicuccio
- * Add additional GetAnnotSelector prototype
- *
- * Revision 1.14 2003/09/17 16:19:25 dicuccio
- * Removed SetResolveDepth(). Added new functions for formatting annotation
- * selectors in standard ways
- *
- * Revision 1.13 2003/08/22 15:57:11 dicuccio
- * Removed 'USING_SCOPE(objects)'. Removed export specifier from inline structs
- *
- * Revision 1.12 2003/08/18 14:53:26 dicuccio
- * Changed nales: CFeature -> CLayoutFeat; CAlignment -> CLayoutAlign; CGraph ->
- * CLayoutGraph; CProtProduct -> CLayoutProtProd.
- * Removed USING_SCOPE(objects);
- *
- * Revision 1.11 2003/08/15 19:33:11 dicuccio
- * Added SetResolveDepth() for determining the correct depth of annotations
- *
- * Revision 1.10 2003/07/29 13:38:37 lebedev
- * GetGraphs method added
- *
- * Revision 1.9 2003/07/18 13:33:22 lebedev
- * Method to retrieve alignments added
- *
- * Revision 1.8 2003/06/23 13:18:49 dicuccio
- * Merged functionality in from seq_utils.hpp
- *
- * Revision 1.7 2003/06/10 13:32:21 dicuccio
- * Added new API for retrieving landmark features. Cleaned up a lot of dead code.
- *
- * Revision 1.6 2003/06/02 16:01:30 dicuccio
- * Rearranged include/objects/ subtree. This includes the following shifts:
- * - include/objects/alnmgr --> include/objtools/alnmgr
- * - include/objects/cddalignview --> include/objtools/cddalignview
- * - include/objects/flat --> include/objtools/flat
- * - include/objects/objmgr/ --> include/objmgr/
- * - include/objects/util/ --> include/objmgr/util/
- * - include/objects/validator --> include/objtools/validator
- *
- * Revision 1.5 2003/01/15 20:58:38 dicuccio
- * Added interface functions for linking and packing features. Removed old
- * bitmask feature types in favor of toolkit standard CSeqFeatData::E_Choice
- * types.
- *
- * Revision 1.4 2003/01/13 13:11:42 dicuccio
- * Namespace clean-up. Retired namespace gui -> converted to namespace ncbi.
- * Moved all FLUID-generated code into namespace ncbi.
- *
- * Revision 1.3 2003/01/09 14:48:21 dicuccio
- * Use 'const CBioseq_Handle&' instead of 'CBioseq_Handle&'
- *
- * Revision 1.2 2002/12/19 18:13:03 dicuccio
- * Added export specifiers for Win32.
- *
- * Revision 1.1 2002/11/29 15:28:10 dicuccio
- * Initial revision - moved from gui/core/view/graphic
- *
- * ===========================================================================
- */
- #endif // GUI_OBJUTILS___UTILS__HPP