seqdbvol.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:4k
- /*
- * ===========================================================================
- * PRODUCTION $Log: seqdbvol.hpp,v $
- * PRODUCTION Revision 1000.0 2004/04/15 15:06:27 gouriano
- * PRODUCTION PRODUCTION: IMPORTED [CATCHUP_003] Dev-tree R1.11
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef OBJTOOLS_READERS_SEQDB__SEQDBVOL_HPP
- #define OBJTOOLS_READERS_SEQDB__SEQDBVOL_HPP
- /* $Id: seqdbvol.hpp,v 1000.0 2004/04/15 15:06:27 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.
- *
- * ===========================================================================
- *
- * Author: Kevin Bealer
- *
- */
- /// CSeqDBVol class
- ///
- /// This object defines access to one database volume.
- #include <iostream>
- #include <objtools/readers/seqdb/seqdb.hpp>
- #include "seqdbfile.hpp"
- #include <sstream>
- #include <objects/seq/NCBI2na.hpp>
- #include <objects/seq/NCBI4na.hpp>
- #include <objects/seq/NCBIstdaa.hpp>
- #include <objects/seq/Seq_data.hpp>
- #include <objects/seq/Seq_descr.hpp>
- #include <objects/seq/Seqdesc.hpp>
- #include <objects/seq/Seq_inst.hpp>
- #include <serial/objistr.hpp>
- #include <serial/serial.hpp>
- #include <corelib/ncbimtx.hpp>
- BEGIN_NCBI_SCOPE
- using namespace ncbi::objects;
- class CSeqDBVol : public CObject {
- public:
- CSeqDBVol(CSeqDBMemPool & mempool,
- const string & name,
- char prot_nucl,
- bool use_mmap)
- : m_MemPool(mempool),
- m_VolName(name),
- m_Idx(mempool, name, prot_nucl, use_mmap),
- m_Seq(mempool, name, prot_nucl, use_mmap),
- m_Hdr(mempool, name, prot_nucl, use_mmap)
- {
- }
-
- Int4 GetSeqLength(Uint4 oid, bool approx) const;
-
- Int4 GetSeqLengthApprox(Uint4 oid) const;
-
- CRef<CBlast_def_line_set> GetHdr(Uint4 oid) const;
-
- char GetSeqType(void) const;
-
- CRef<CBioseq> GetBioseq(Int4 oid,
- bool use_objmgr,
- bool insert_ctrlA) const;
-
- Int4 GetSequence(Int4 oid, const char ** buffer) const;
-
- Int4 GetAmbigSeq(Int4 oid,
- char ** buffer,
- Uint4 nucl_code,
- ESeqDBAllocType alloc_type) const;
-
- list< CRef<CSeq_id> > GetSeqIDs(Uint4 oid) const;
-
- string GetTitle(void) const;
-
- string GetDate(void) const;
-
- Uint4 GetNumSeqs(void) const;
-
- Uint8 GetTotalLength(void) const;
-
- Uint4 GetMaxLength(void) const;
-
- string GetVolName(void) const
- {
- return m_VolName;
- }
-
- private:
- CRef<CBlast_def_line_set> x_GetHdr(Uint4 oid) const;
- char x_GetSeqType(void) const;
- bool x_GetAmbChar(Uint4 oid, vector<Int4> ambchars) const;
- Int4 x_GetSequence(Int4 oid, const char ** buffer) const;
- Int4 x_GetAmbigSeq(Int4 oid,
- char ** buffer,
- Uint4 nucl_code,
- ESeqDBAllocType alloc_type) const;
-
- char * x_AllocType(Uint4 length,
- ESeqDBAllocType alloc_type) const;
-
- CSeqDBMemPool & m_MemPool;
- string m_VolName;
- mutable CFastMutex m_Lock;
- CSeqDBIdxFile m_Idx;
- CSeqDBSeqFile m_Seq;
- CSeqDBHdrFile m_Hdr;
- };
- END_NCBI_SCOPE
- #endif // OBJTOOLS_READERS_SEQDB__SEQDBVOL_HPP