NCBI C++ ToolKit
taxid_set.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: taxid_set.hpp 96196 2022-02-22 19:32:10Z boratyng $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Author: Kevin Bealer
27 *
28 */
29 
30 /** @file taxid_set.hpp
31  * Class which defines sequence id to taxid mapping.
32  */
33 
34 #ifndef OBJTOOLS_BLAST_SEQDB_WRITER___TAXID_SET__HPP
35 #define OBJTOOLS_BLAST_SEQDB_WRITER___TAXID_SET__HPP
36 
37 #include <corelib/ncbistd.hpp>
38 
39 // Blast databases
42 
44 
46 
48 public:
49  static const TTaxId kTaxIdNotSet;
50 
51  CTaxIdSet(TTaxId global_taxid = kTaxIdNotSet)
52  : m_GlobalTaxId(global_taxid),
53  m_Matched(true) {}
54 
55  void SetMappingFromFile(CNcbiIstream & f);
56 
57  /// Check that each defline has the specified taxid; if not,
58  /// replace the defline and set the taxid.
59  /// @param deflines Deflines to fix taxIDs [in|out]
60  void FixTaxId(CRef<objects::CBlast_def_line_set> deflines);
61 
62  bool HasEverFixedId() const { return m_Matched; };
63 
64  void AddTaxId(const objects::CSeq_id& seqid, const TTaxId& taxid);
65 
66 private:
69  bool m_Matched;
70 
71  /// Selects the most suitable tax id for the input passed in, checking the
72  /// global taxid first, then the mapping provided by an input file, and
73  /// finally what's found in the defline argument
74  TTaxId x_SelectBestTaxid(const objects::CBlast_def_line & defline);
75 
76 };
77 
79 
80 #endif // OBJTOOLS_BLAST_SEQDB_WRITER___TAXID_SET__HPP
81 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
#define true
Definition: bool.h:35
CObject –.
Definition: ncbiobj.hpp:180
CRef –.
Definition: ncbiobj.hpp:618
static const TTaxId kTaxIdNotSet
Definition: taxid_set.hpp:49
CTaxIdSet(TTaxId global_taxid=kTaxIdNotSet)
Definition: taxid_set.hpp:51
bool m_Matched
Definition: taxid_set.hpp:69
map< string, TTaxId > m_TaxIdMap
Definition: taxid_set.hpp:68
bool HasEverFixedId() const
Definition: taxid_set.hpp:62
TTaxId m_GlobalTaxId
Definition: taxid_set.hpp:67
Include a standard set of the NCBI C++ Toolkit most basic headers.
SStrictId_Tax::TId TTaxId
Taxon id type.
Definition: ncbimisc.hpp:1048
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
Definition: ncbistre.hpp:146
#define NCBI_XOBJWRITE_EXPORT
Definition: ncbi_export.h:1347
double f(double x_, const double &y_)
Definition: njn_root.hpp:188
Modified on Mon Feb 26 04:02:05 2024 by modify_doxy.py rev. 669887