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

Go to the SVN repository for this file.

1 #ifndef __TABLE2ASN_CONTEXT_HPP_INCLUDED__
2 #define __TABLE2ASN_CONTEXT_HPP_INCLUDED__
3 
4 #include <corelib/ncbistl.hpp>
7 #include <mutex>
8 #include <optional>
9 
10 #include "fileset.hpp"
11 #include "table2asn_validator.hpp" // RW-2262 - Must fix this
12 
14 
15 namespace objects
16 {
17 class CSeq_entry;
18 class CSeq_submit;
19 class CBioseq;
20 class CBioseq_set;
21 class CSeq_descr;
22 class ILineErrorListener;
23 class CUser_object;
24 class CBioSource;
25 class CScope;
26 class CObjectManager;
28 class CSeq_feat;
29 class CSourceModParser;
30 class CSeq_id;
31 class CFeat_CI;
32 class CFixSuspectProductName;
33 
34 namespace edit
35 {
36  class CRemoteUpdater;
37 }
38 
39 }
40 
41 #include <objects/seq/Seqdesc.hpp>
42 
43 enum class eFiles
44 {
45  asn,
46  log,
47  ecn,
48  gbf,
49  val,
50  dr,
51  stats,
53 };
54 
55 template<typename _enum, _enum ... _options>
56 class TMultiFileSet;
57 
58 template<typename _enum, _enum ... _options>
59 class TMultiFileSet: public TMultiSourceFileSet<_enum, _options...>
60 {
61 public:
62  using _MyBase = TMultiSourceFileSet<_enum, _options...>;
63  using enum_type = typename _MyBase::enum_type;
64  //static constexpr size_t enum_size = _MyBase::enum_size;
65  //std::ostream& operator[](enum_type);
66  //void Close(enum_type);
67  //void Close();
68 private:
69 };
70 
72  //eFiles::asn,
77  eFiles::dr,
80 >;
81 
84 >;
85 
87 
88 // command line parameters are mapped into the context
89 // those with only only symbol still needs to be implemented
91 {
92 public:
95  CNcbiOstream* m_output{ nullptr };
97  string m_base_name;
101  string m_Comment;
103  string m_ft_url;
104  string m_ft_url_mod;
106  string F;
107  string A;
109  string m_validate;
110  bool m_delay_genprodset { false };
111  string G;
112  bool R{ false };
113  bool S{ false };
114  string Q;
115  bool L{ false };
116  bool W{ false };
117  bool m_t{ false };
118  bool m_save_bioseq_set{ false };
119  string c;
120  string zOufFile;
121  string X;
123  string m;
124  string m_cleanup;
128  bool m_RemoteTaxonomyLookup{ false };
129  bool m_RemotePubLookup{ false };
130  bool m_HandleAsSet{ false };
131  objects::CBioseq_set::TClass m_ClassValue{ objects::CBioseq_set::eClass_genbank };
132  bool m_SetIDFromFile{ false };
133 
137  objects::CGapsEditor::TEvidenceSet m_DefaultEvidence;
138  objects::CGapsEditor::TCountToEvidenceMap m_GapsizeToEvidence;
139 
140  int m_gap_type{ -1 };
141  bool m_fcs_trim{ false };
142  bool m_split_log_files{ false };
143  bool m_postprocess_pubs{ false };
148  bool m_eukaryote{ false };
149  bool m_di_fasta{ false };
150  bool m_d_fasta{ false };
151  bool m_allow_accession{ false };
152  bool m_verbose{ false };
153 
154  struct SPrtAlnOptions {
155  bool refineAlignment { false };
156  bool intronless { false };
158  };
160 
161  bool m_make_flatfile{ false };
162  bool m_run_discrepancy{ false };
163  bool m_split_discrepancy{ false };
164  bool m_accumulate_mods{ false };
165  bool m_binary_asn1_output { false };
166  bool m_can_use_huge_files { false };
167  bool m_huge_files_mode { false };
168  bool m_disable_huge_files{ false };
169  optional<size_t> m_use_threads {};
170 
171 
173 
174  unique_ptr<objects::edit::CRemoteUpdater> m_remote_updater;
175 
176  unique_ptr<objects::CFixSuspectProductName> m_suspect_rules;
177 
178 
179 /////////////
182 
183  static
184  void AddUserTrack(objects::CSeq_descr& SD, const string& type, const string& label, const string& data);
185  void SetOrganismData(objects::CSeq_descr& SD, int genome_code, const string& taxname, int taxid, const string& strain) const;
186 
187  std::ostream& GetOstream(eFiles suffix);
188 
189  void SetOutputFilename(eFiles kind, const string& filename);
190  void SetOutputFile(eFiles kind, ostream& ostr);
191  //void OpenOutputs();
192  void OpenDiagnosticOutputs();
193  void OpenDataOutputs();
194  void DeleteOutputs();
195  void CloseDiagnosticOutputs();
196  void CloseDataOutputs();
197 
198  string GenerateOutputFilename(eFiles kind, string_view basename = kEmptyStr) const;
199 
200  static
201  objects::CUser_object& SetUserObject(objects::CSeq_descr& descr, const CTempString& type);
202  bool ApplyCreateUpdateDates(objects::CSeq_entry& entry) const;
203  void ApplyUpdateDate(objects::CSeq_entry& entry) const;
204  void ApplyAccession(objects::CSeq_entry& entry) const;
205  void ApplyFileTracks(objects::CSeq_entry& entry) const;
206  void ApplyComments(objects::CSeq_entry& entry) const;
209  CRef<objects::CSeq_submit>& submit) const;
213 
214  void MergeWithTemplate(objects::CSeq_entry& entry) const;
215  void SetSeqId(objects::CSeq_entry& entry) const;
216  void CopyFeatureIdsToComments(objects::CSeq_entry& entry) const;
217  void RemoveUnnecessaryXRef(objects::CSeq_entry& entry) const;
218  void SmartFeatureAnnotation(objects::CSeq_entry& entry) const;
219 
220  void CorrectCollectionDates(objects::CSeq_entry& entry) const;
221 
222  void MakeGenomeCenterId(objects::CSeq_entry& entry) const;
223  void RenameProteinIdsQuals(objects::CSeq_feat& feature) const;
224  void RemoveProteinIdsQuals(objects::CSeq_feat& feature) const;
225  static bool IsDBLink(const objects::CSeqdesc& desc);
226 
227 
230  objects::ILineErrorListener* m_logger{ nullptr };
231  unique_ptr<CValidMessageHandler> pValMsgHandler;
232 
235 
236  static bool GetOrgName(string& name, const objects::CSeq_entry& entry);
237  static CRef<objects::COrg_ref> GetOrgRef(objects::CSeq_descr& descr);
238  static void UpdateTaxonFromTable(objects::CBioseq& bioseq);
239 
240  static void MergeSeqDescr(objects::CSeq_entry& dest, const objects::CSeq_descr& src, bool only_set);
241  mutable std::mutex m_mutex;
242 
243 private:
244  static void x_ApplyAccession(const CTable2AsnContext& context, objects::CBioseq& bioseq);
247  // these are used in single threaded mode
250 };
251 
252 void g_LoadLinkageEvidence(const string& linkageEvidenceFilename,
253  objects::CGapsEditor::TCountToEvidenceMap& gapsizeToEvidence,
254  objects::ILineErrorListener* pMessageListener);
255 void g_LogDiagMessage(objects::ILineErrorListener*, EDiagSev, const string& msg);
256 
258 
259 
260 #endif
CFeat_CI –.
Definition: feat_ci.hpp:64
CObjectManager –.
CScope –.
Definition: scope.hpp:92
@Seq_descr.hpp User-defined methods of the data storage class.
Definition: Seq_descr.hpp:55
CSeq_entry_Handle –.
Definition: Seq_entry.hpp:56
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
void ApplyUpdateDate(objects::CSeq_entry &entry) const
CDiagnosticFileSet mDiagnosticWriters
static bool GetOrgName(string &name, const objects::CSeq_entry &entry)
CRef< objects::CObjectManager > m_ObjMgr
CDataFileSet::fileset_type mCurrentDataOutputs
void SetSeqId(objects::CSeq_entry &entry) const
void ApplyFileTracks(objects::CSeq_entry &entry) const
CNcbiOstream * m_output
static void x_ApplyAccession(const CTable2AsnContext &context, objects::CBioseq &bioseq)
unique_ptr< objects::edit::CRemoteUpdater > m_remote_updater
void SetOutputFilename(eFiles kind, const string &filename)
void ApplyAccession(objects::CSeq_entry &entry) const
objects::ILineErrorListener * m_logger
CRef< objects::CSeq_id > m_accession
SPrtAlnOptions prtAlnOptions
static objects::CUser_object & SetUserObject(objects::CSeq_descr &descr, const CTempString &type)
objects::CGapsEditor::TEvidenceSet m_DefaultEvidence
void SetOutputFile(eFiles kind, ostream &ostr)
static CRef< objects::COrg_ref > GetOrgRef(objects::CSeq_descr &descr)
CRef< CSerialObject > CreateSubmitFromTemplate(CRef< objects::CSeq_entry > &object, CRef< objects::CSeq_submit > &submit) const
NDiscrepancy::EGroup m_discrepancy_group
CRef< objects::CSeq_entry > m_entry_template
static void AddUserTrack(objects::CSeq_descr &SD, const string &type, const string &label, const string &data)
void CorrectCollectionDates(objects::CSeq_entry &entry) const
CDiagnosticFileSet::fileset_type mCurrentDiagnosticOutputs
void SmartFeatureAnnotation(objects::CSeq_entry &entry) const
optional< size_t > m_use_threads
CRef< objects::CSeq_submit > m_submit_template
string GenerateOutputFilename(eFiles kind, string_view basename=kEmptyStr) const
void MergeWithTemplate(objects::CSeq_entry &entry) const
void SetOrganismData(objects::CSeq_descr &SD, int genome_code, const string &taxname, int taxid, const string &strain) const
unique_ptr< CValidMessageHandler > pValMsgHandler
void RenameProteinIdsQuals(objects::CSeq_feat &feature) const
void ApplyComments(objects::CSeq_entry &entry) const
objects::CGapsEditor::TCountToEvidenceMap m_GapsizeToEvidence
void UpdateSubmitObject(CRef< objects::CSeq_submit > &submit) const
CRef< CSerialObject > CreateSeqEntryFromTemplate(CRef< objects::CSeq_entry > object) const
std::ostream & GetOstream(eFiles suffix)
bool ApplyCreateUpdateDates(objects::CSeq_entry &entry) const
void RemoveProteinIdsQuals(objects::CSeq_feat &feature) const
static void MergeSeqDescr(objects::CSeq_entry &dest, const objects::CSeq_descr &src, bool only_set)
objects::CBioseq_set::TClass m_ClassValue
static bool IsDBLink(const objects::CSeqdesc &desc)
unique_ptr< objects::CFixSuspectProductName > m_suspect_rules
static void UpdateTaxonFromTable(objects::CBioseq &bioseq)
void CopyFeatureIdsToComments(objects::CSeq_entry &entry) const
void MakeGenomeCenterId(objects::CSeq_entry &entry) const
void RemoveUnnecessaryXRef(objects::CSeq_entry &entry) const
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Definition: tempstr.hpp:65
CTime –.
Definition: ncbitime.hpp:296
typename fileset_type::enum_type enum_type
Definition: fileset.hpp:137
EGroup
@ eOncaller
#define basename(path)
Definition: replacements.h:116
char data[12]
Definition: iconv.c:80
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
EDiagSev
Severity level for the posted diagnostics.
Definition: ncbidiag.hpp:650
#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::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
#define kEmptyStr
Definition: ncbistr.hpp:123
static const char label[]
Definition: fix_pub.hpp:45
The NCBI C++/STL use hints.
#define SD
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
Definition: type.c:6
void g_LogDiagMessage(objects::ILineErrorListener *, EDiagSev, const string &msg)
@ fixedproducts
void g_LoadLinkageEvidence(const string &linkageEvidenceFilename, objects::CGapsEditor::TCountToEvidenceMap &gapsizeToEvidence, objects::ILineErrorListener *pMessageListener)
static CS_CONTEXT * context
Definition: will_convert.c:21
Modified on Fri Sep 20 14:58:12 2024 by modify_doxy.py rev. 669887