file_loader.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:9k
- /*
- * ===========================================================================
- * PRODUCTION $Log: file_loader.hpp,v $
- * PRODUCTION Revision 1000.4 2004/06/01 20:57:40 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.23
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_PLUGINS_DOC_BASIC___FILE_LOADER__HPP
- #define GUI_PLUGINS_DOC_BASIC___FILE_LOADER__HPP
- /* $Id: file_loader.hpp,v 1000.4 2004/06/01 20:57:40 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:
- * CDataPlugin_FileLoader - load sequence information from a file.
- */
- #include <gui/core/doc_loader.hpp>
- #include <gui/plugin/MessageStatus.hpp>
- #include <gui/plugin/PluginInfo.hpp>
- #include <objmgr/scope.hpp>
- #include <objects/seq/Bioseq.hpp>
- #include <objects/seq/Seq_annot.hpp>
- #include <objects/seqfeat/Seq_feat.hpp>
- #include <objects/seqalign/Seq_align.hpp>
- #include <objects/seqset/Seq_entry.hpp>
- #include <objects/seqset/Bioseq_set.hpp>
- #include <objects/submit/Seq_submit.hpp>
- BEGIN_NCBI_SCOPE
- class IDocument;
- class CObjectInfo;
- class CDataPlugin_FileLoader : public CDocLoader<CDataPlugin_FileLoader>
- {
- public:
- /// enum defining the formats we support
- enum EFormat {
- ///< autodetect will try to guess which of the
- ///< following formats applies.
- eFormat_Autodetect,
- ///< force ASN binary
- eFormat_AsnBinary,
- ///< force ASN text
- eFormat_AsnText,
- ///< force XML
- eFormat_XML,
- ///< force FASTA
- eFormat_FastA,
- ///< force generic text alignment
- eFormat_TextAlign,
- ///< force Newick format phylogenetic tree
- eFormat_NewickTree
- };
- CDataPlugin_FileLoader();
- ~CDataPlugin_FileLoader();
- /// virtual hook: load a document
- void Load(objects::CPluginMessage& msg);
- /// virtual hook: import data into a document
- void Import(objects::CPluginMessage& msg);
- /// Subversion of Load called when any suspected object is read
- void Load(const CObjectInfo& info, IDocument* doc,
- objects::CPluginReply& reply);
- static void GetInfo(objects::CPluginInfo& info);
- private:
- /// Internal version of load - here we iterate through the various file
- /// types looking for a match.
- void x_LoadFile(const string& fname, EFormat fmt, IDocument* doc,
- objects::CPluginReply& reply);
- void x_LoadStream(CNcbiIstream& input, EFormat fmt, IDocument* doc,
- objects::CPluginReply& reply);
- /// sub-versions of load, called for each object that is read
- void x_Load(objects::CSeq_entry& entry, IDocument* doc,
- objects::CPluginReply& reply);
- void x_Load(objects::CBioseq_set& bioseq_set, IDocument* doc,
- objects::CPluginReply& reply);
- void x_Load(objects::CBioseq& bioseq, IDocument* doc,
- objects::CPluginReply& reply);
- void x_Load(objects::CSeq_annot& annot, IDocument* doc,
- objects::CPluginReply& reply);
- void x_Load(objects::CSeq_align& align, IDocument* doc,
- objects::CPluginReply& reply);
- void x_Load(objects::CSeq_align_set& align, IDocument* doc,
- objects::CPluginReply& reply);
- void x_Load(objects::CSeq_submit& submit, IDocument* doc,
- objects::CPluginReply& reply);
- /// Convert a single Seq-entry to a single bioseq handle
- objects::CBioseq_Handle
- x_SeqEntryToBioseqHandle(objects::CSeq_entry& entry,
- objects::CScope& scope);
- /// internal load-into function to add an annotation to a document
- objects::EMessageStatus
- x_LoadAnnotation(IDocument* doc, CRef<objects::CSeq_annot>& annot);
- };
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: file_loader.hpp,v $
- * Revision 1000.4 2004/06/01 20:57:40 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.23
- *
- * Revision 1.23 2004/05/25 17:21:59 dicuccio
- * Modified class names. Fonts to 12 point
- *
- * Revision 1.22 2004/04/05 14:27:10 dicuccio
- * Added check to make sure the file exists before opening. Added support for
- * seq-align-set conversions
- *
- * Revision 1.21 2004/03/23 22:09:01 jcherry
- * Isolate stream operations from file stuff
- *
- * Revision 1.20 2004/03/01 15:12:04 dicuccio
- * Added support for CLUSTAL alignments. Added handling of type specification in
- * plugin args. Added support for Newic format phylogenetic trees.
- *
- * Revision 1.19 2003/11/18 17:49:01 dicuccio
- * Added standard processing of return values
- *
- * Revision 1.18 2003/11/04 17:49:24 dicuccio
- * Changed calling parameters for plugins - pass CPluginMessage instead of paired
- * CPluginCommand/CPluginReply
- *
- * Revision 1.17 2003/10/10 17:17:28 dicuccio
- * Added Import() method - split out from Load()
- *
- * Revision 1.16 2003/09/29 15:39:10 dicuccio
- * Header file clean-up. Deprecated gui/scope.hpp and gui/core/types.hpp. Added
- * GenBank data loader management dialog
- *
- * Revision 1.15 2003/09/16 14:07:28 dicuccio
- * Removed Save function - split into separate plugin class
- *
- * Revision 1.14 2003/09/04 14:51:01 dicuccio
- * Use IDocument instead of CDocument
- *
- * Revision 1.13 2003/07/14 11:16:38 shomrat
- * Plugin messageing system related changes
- *
- * Revision 1.12 2003/06/20 14:52:57 dicuccio
- * Revised plugin registration - moved GetInfo() into the plugin handler
- *
- * Revision 1.11 2003/06/17 19:14:56 dicuccio
- * Cleaned up and re-enabled file importing
- *
- * Revision 1.10 2003/06/10 14:59:13 kuznets
- * File opening reimplemented using CObjectsSniffer(obj_sniff.hpp)
- *
- * Revision 1.9 2003/06/02 16:06:22 dicuccio
- * Rearranged src/objects/ subtree. This includes the following shifts:
- * - src/objects/asn2asn --> arc/app/asn2asn
- * - src/objects/testmedline --> src/objects/ncbimime/test
- * - src/objects/objmgr --> src/objmgr
- * - src/objects/util --> src/objmgr/util
- * - src/objects/alnmgr --> src/objtools/alnmgr
- * - src/objects/flat --> src/objtools/flat
- * - src/objects/validator --> src/objtools/validator
- * - src/objects/cddalignview --> src/objtools/cddalignview
- * In addition, libseq now includes six of the objects/seq... libs, and libmmdb
- * replaces the three libmmdb? libs.
- *
- * Revision 1.8 2003/04/24 16:39:08 dicuccio
- * Updated to reflect changes in plugin API. Changed location of document marshal
- * from framework to plugin
- *
- * Revision 1.7 2003/02/24 13:03:16 dicuccio
- * Renamed classes in plugin spec:
- * CArgSeg --> CPluginArgSet
- * CArgument --> CPluginArg
- * CPluginArgs --> CPluginCommand
- * CPluginCommands --> CPluginCommandSet
- *
- * Revision 1.6 2003/02/20 19:49:56 dicuccio
- * Created new plugin architecture, based on ASN.1 spec. Moved GBENCH frameowrk
- * over to use new plugin architecture.
- *
- * Revision 1.5 2003/02/05 19:55:53 dicuccio
- * Reworked file loading to handle more types
- *
- * Revision 1.4 2003/01/13 13:10:07 dicuccio
- * Namespace clean-up. Retired namespace gui -> converted all to namespace
- * ncbi. Moved all FLUID-generated code into namespace ncbi.
- *
- * Revision 1.3 2002/12/30 17:55:42 dicuccio
- * Added new virtual requirement: Save() (not handled by some plugins; return
- * values should be obeyed)
- *
- * Revision 1.2 2002/12/09 20:35:59 dicuccio
- * Large revision to file loading code - added ability to read more object
- * types, added ability to import annotations into current document.
- *
- * Revision 1.1 2002/11/25 20:51:01 dicuccio
- * Initial revision.
- *
- * ===========================================================================
- */
- #endif /// GUI_PLUGINS_DOC_BASIC___FILE_LOADER__HPP