📄 context.hpp
字号:
/* * =========================================================================== * PRODUCTION $Log: context.hpp,v $ * PRODUCTION Revision 1000.1 2004/06/01 19:38:24 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.18 * PRODUCTION * =========================================================================== */#ifndef OBJTOOLS_FORMAT___CONTEXT__HPP#define OBJTOOLS_FORMAT___CONTEXT__HPP/* $Id: context.hpp,v 1000.1 2004/06/01 19:38:24 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: Aaron Ucko, Mati Shomrat** File Description:* new (early 2003) flat-file generator -- context needed when (pre)formatting**/#include <corelib/ncbistd.hpp>#include <corelib/ncbiobj.hpp>#include <objects/seq/Bioseq.hpp>#include <objects/seq/Seq_inst.hpp>#include <objects/seq/MolInfo.hpp>#include <objects/seqloc/Seq_loc.hpp>#include <objects/seqloc/Seq_id.hpp>#include <objects/submit/Submit_block.hpp>#include <objmgr/bioseq_handle.hpp>#include <objmgr/seq_entry_handle.hpp>#include <objmgr/annot_selector.hpp>#include <objmgr/seq_loc_mapper.hpp>#include <util/range.hpp>#include <objtools/format/flat_file_config.hpp>#include <objtools/format/items/reference_item.hpp>#include <memory>BEGIN_NCBI_SCOPEBEGIN_SCOPE(objects)class CScope;class CMasterContext;class CFlatFileContext;///////////////////////////////////////////////////////////////////////////////// CBioseqContext//// information on the bioseq being formattedclass CBioseqContext : public CObject{public: // types typedef CRef<CReferenceItem> TRef; typedef vector<TRef> TReferences; typedef CRange<TSeqPos> TRange; // constructor CBioseqContext(const CBioseq_Handle& seq, CFlatFileContext& ffctx, CMasterContext* mctx = 0); // destructor ~CBioseqContext(void); // Get the bioseq's handle CBioseq_Handle& GetHandle(void) { return m_Handle; } CScope& GetScope(void) { return m_Handle.GetScope(); } // -- id information CSeq_id* GetPrimaryId(void) { return m_PrimaryId; } const CSeq_id& GetPreferredSynonym(const CSeq_id& id) const; const string& GetAccession(void) const { return m_Accession; } int GetGI(void) const { return m_Gi; } // molecular type (nucleotide / protein) bool IsProt(void) const { return m_IsProt; } bool IsNuc (void) const { return !m_IsProt; } CSeq_inst::TRepr GetRepr (void) const { return m_Repr; } CSeq_inst::TMol GetMol (void) const { return m_Mol; } const CMolInfo* GetMolinfo(void) const { return m_Molinfo; } CMolInfo::TTech GetTech (void) const; CMolInfo::TBiomol GetBiomol (void) const; const CBioseq::TId& GetBioseqIds(void) const; // segmented bioseq bool IsSegmented(void) const { return m_Repr == CSeq_inst::eRepr_seg; } bool HasParts(void) const { return m_HasParts; } // part of a segmented bioseq bool IsPart(void) const { return m_IsPart; } SIZE_TYPE GetPartNumber (void) const { return m_PartNumber; } SIZE_TYPE GetTotalNumParts(void) const; CMasterContext& GetMaster (void) { return *m_Master; } void SetMaster(CMasterContext& mctx); // delta sequence bool IsDelta(void) const { return m_Repr == CSeq_inst::eRepr_delta; } bool IsDeltaLitOnly(void) const { return m_IsDeltaLitOnly; } // Whole Genome Shotgun bool IsWGS (void) const { return m_IsWGS; } bool IsWGSMaster(void) const { return m_IsWGSMaster; } const string& GetWGSMasterAccn(void) const { return m_WGSMasterAccn; } const string& GetWGSMasterName(void) const { return m_WGSMasterName; } TReferences& SetReferences(void) { return m_References; } const TReferences& GetReferences(void) const { return m_References; } // range on the bioseq to be formatted. the location is either // whole or an interval (no complex locations allowed) const CSeq_loc& GetLocation(void) const { return *m_Location; } CSeq_loc_Mapper* GetMapper(void) { return m_Mapper; } bool DoContigStyle(void) const; bool ShowGBBSource(void) const { return m_ShowGBBSource; } bool IsInGPS (void) const { return m_IsInGPS; } // Is in a gene-prod set? bool IsInNucProt(void) const { return m_IsInNucProt; } // Is in a nuc-prot set? // type of bioseq? bool IsGED (void) const { return m_IsGED; } // Genbank, EMBL or DDBJ bool IsEMBL (void) const { return m_IsEMBL; } // EMBL bool IsPDB (void) const { return m_IsPDB; } // PDB bool IsSP (void) const { return m_IsSP; } // SwissProt bool IsTPA (void) const { return m_IsTPA; } // Third-Party Annotation bool IsPatent (void) const { return m_IsPatent; } bool IsGbGenomeProject(void) const { return m_IsGbGenomeProject; } // AE bool IsNcbiCONDiv (void) const { return m_IsNcbiCONDiv; } // CH // RefSeq ID queries bool IsRefSeq(void) const { return m_IsRefSeq; } bool IsRSCompleteGenomic (void) const; // NC_ bool IsRSIncompleteGenomic(void) const; // NG_ bool IsRSMRna (void) const; // NM_ bool IsRSNonCodingRna (void) const; // NR_ bool IsRSProtein (void) const; // NP_ bool IsRSContig (void) const; // NT_ bool IsRSIntermedWGS (void) const; // NW_ bool IsRSPredictedMRna (void) const; // XM_ bool IsRSPredictedNCRna (void) const; // XR_ bool IsRSPredictedProtein (void) const; // XP_ bool IsRSWGSNuc (void) const; // NZ_ bool IsRSWGSProt (void) const; // ZP_ bool IsHup(void) const { return m_IsHup; } // !!! should move to global? // global data from CFlatFileContext const CSubmit_block* GetSubmitBlock(void) const; const CSeq_entry_Handle& GetEntry(void) const; const CFlatFileConfig& Config(void) const; const SAnnotSelector* GetAnnotSelector(void) const; const CSeq_loc* GetMasterLocation(void) const; bool IsGenbankFormat(void) const;private: void x_Init(const CBioseq_Handle& seq, const CSeq_loc* user_loc); void x_SetId(void); bool x_HasParts(void) const; bool x_IsDeltaLitOnly(void) const; bool x_IsPart(void) const; CBioseq_Handle x_GetMasterForPart(void) const; SIZE_TYPE x_GetPartNumber(void); bool x_IsInGPS(void) const; bool x_IsInNucProt(void) const; void x_SetLocation(const CSeq_loc* user_loc = 0); CSeq_inst::TRepr x_GetRepr(void) const; const CMolInfo* x_GetMolInfo(void) const; // data CBioseq_Handle m_Handle; CRef<CSeq_id> m_PrimaryId; string m_Accession; string m_WGSMasterAccn; string m_WGSMasterName; CSeq_inst::TRepr m_Repr; CSeq_inst::TMol m_Mol; CConstRef<CMolInfo> m_Molinfo; // segmented bioseq bool m_HasParts; // part of a segmented bioseq bool m_IsPart; SIZE_TYPE m_PartNumber; // delta bioseq bool m_IsDeltaLitOnly; bool m_IsProt; // Protein bool m_IsInGPS; // Gene-Prod Set bool m_IsInNucProt; // Nuc-Prot Set bool m_IsGED; // Genbank, Embl or Ddbj bool m_IsEMBL; // EMBL bool m_IsPDB; // PDB bool m_IsSP; // SwissProt bool m_IsTPA; // Third Party Annotation bool m_IsRefSeq; unsigned int m_RefseqInfo; bool m_IsGbGenomeProject; // GenBank Genome project data bool m_IsNcbiCONDiv; // NCBI CON division bool m_IsPatent; bool m_IsGI; bool m_IsWGS; bool m_IsWGSMaster; bool m_IsHup; int m_Gi; bool m_ShowGBBSource; TReferences m_References; CConstRef<CSeq_loc> m_Location; CRef<CSeq_loc_Mapper> m_Mapper; CFlatFileContext& m_FFCtx; CRef<CMasterContext> m_Master;};///////////////////////////////////////////////////////////////////////////////// CMasterContext//// When formatting segmented bioseq CMasterContext holds information// on the Master bioseq.class CMasterContext : public CObject{public: // constructor CMasterContext(const CBioseq_Handle& master); // destructor ~CMasterContext(void); // Get the segmented bioseq's handle const CBioseq_Handle& GetHandle(void) const { return m_Handle; } // Get the number of parts SIZE_TYPE GetNumParts (void) const { return m_NumParts; } // Get the base name const string& GetBaseName (void) const { return m_BaseName; } // Find the serial number of a part in the segmented bioseq SIZE_TYPE GetPartNumber(const CBioseq_Handle& part);private: void x_SetBaseName(void); void x_SetNumParts(void); // data CBioseq_Handle m_Handle; string m_BaseName; SIZE_TYPE m_NumParts;};///////////////////////////////////////////////////////////////////////////////// CFlatFileContextclass CFlatFileContext : public CObject{public: // types typedef CRef<CBioseqContext> TSection; typedef vector< CRef<CBioseqContext> > TSections; // constructor
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -