NCBI C++ ToolKit
unit_test_fasta_reader.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: unit_test_fasta_reader.cpp 94257 2021-07-14 13:06:53Z ludwigf $
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: Justin Foley
27 *
28 * File Description:
29 * Reader unit test.
30 *
31 * ===========================================================================
32 */
33 
34 #include <ncbi_pch.hpp>
35 
36 #include <corelib/ncbi_system.hpp>
37 #include <corelib/ncbiapp.hpp>
38 #include <corelib/ncbifile.hpp>
39 #include <objects/seq/Seq_inst.hpp>
40 #include <objects/seq/Bioseq.hpp>
47 
48 #include <cstdio>
49 
50 // This header must be included before all Boost.Test headers if there are any
51 #include <corelib/test_boost.hpp>
52 
53 
56 
57 // ============================================================================
58 // Customization data:
59 const string extConfig("cfg");
60 const string extInput("fsa");
61 const string extOutput("asn");
62 const string extErrors("errors");
63 const string extKeep("new");
64 const string dirTestFiles("fasta_reader_test_cases");
65 // !!!
66 // !!! Must also customize reader type in sRunTest !!!
67 // !!!
68 // ============================================================================
69 
70 static CFastaReader::TFlags s_StringToFastaFlag(const string& flag_string)
71 {
73  {
74  { "fAssumeNuc", CFastaReader::fAssumeNuc},
75  { "fAssumeProt", CFastaReader::fAssumeProt},
76  { "fForceType", CFastaReader::fForceType},
77  { "fNoParseID", CFastaReader::fNoParseID},
78  { "fParseGaps", CFastaReader::fParseGaps},
79  { "fOneSeq", CFastaReader::fOneSeq},
80  { "fNoSeqData", CFastaReader::fNoSeqData},
81  { "fRequireID", CFastaReader::fRequireID},
82  { "fDLOptional", CFastaReader::fDLOptional},
83  { "fParseRawID", CFastaReader::fParseRawID},
84  { "fSkipCheck", CFastaReader::fSkipCheck},
85  { "fNoSplit", CFastaReader::fNoSplit},
86  { "fValidate", CFastaReader::fValidate},
87  { "fUniqueIDs", CFastaReader::fUniqueIDs},
88  { "fStrictGuess", CFastaReader::fStrictGuess},
89  { "fLaxGuess", CFastaReader::fLaxGuess},
90  { "fAddMods", CFastaReader::fAddMods},
91  { "fLetterGaps", CFastaReader::fLetterGaps},
92  { "fNoUserObjs", CFastaReader::fNoUserObjs},
93  { "fLeaveAsText", CFastaReader::fLeaveAsText},
94  { "fQuickIDCheck", CFastaReader::fQuickIDCheck},
95  { "fUseIupacaa", CFastaReader::fUseIupacaa},
96  { "fHyphensIgnoreAndWarn", CFastaReader::fHyphensIgnoreAndWarn},
97  { "fDisableNoResidues", CFastaReader::fDisableNoResidues},
98  { "fDisableParseRange", CFastaReader::fDisableParseRange},
99  { "fIgnoreMods", CFastaReader::fIgnoreMods}
100  };
101 
102  auto it = sFlagsMap.find(flag_string);
103  if (it != end(sFlagsMap)) {
104  return static_cast<CFastaReader::TFlags>(it->second);
105  }
106 
107  string message = "Unrecognized FASTA flag : " + flag_string;
108  NCBI_THROW(CException, eUnknown, message);
109 
110  return 0;
111 }
112 
113 struct SConfigInfo
114 {
115  list<CFastaReader::TFlags> flags;
116  vector<string> excluded_mods;
117  enum class EEntryType {
118  eBioseq,
119  eBioset
120  };
122 };
123 
124 
126 {
127  for (string line; getline(ifstr, line);) {
128  NStr::TruncateSpaces(line);
129  if (line.empty()) {
130  continue;
131  }
132  list<string> tokens;
133  NStr::Split(line, " \t", tokens, NStr::fSplit_Tokenize);
134 
135  if (tokens.front() == "FLAGS") {
136  transform(next(begin(tokens)), end(tokens),
137  back_inserter(config.flags), s_StringToFastaFlag);
138  continue;
139  }
140 
141  if (tokens.front() == "EXCLUDED_MODS") {
142  copy(next(begin(tokens)), end(tokens),
143  back_inserter(config.excluded_mods));
144  continue;
145  }
146 
147  if (tokens.front() == "ENTRY_TYPE") {
148  if (tokens.back() == "Bioset") {
150  }
151  }
152  }
153 }
154 
155 struct STestInfo {
157  CFile mInFile;
158  CFile mOutFile;
160 };
161 
162 typedef string TTestName;
164 
166 public:
168  TTestNameToInfoMap& testNameToInfoMap,
169  const string& extConfig,
170  const string& extInput,
171  const string& extOutput,
172  const string& extErrors)
173  : m_TestNameToInfoMap(testNameToInfoMap),
178  { }
179 
180  void operator()( const CDirEntry & dirEntry ) {
181  if( ! dirEntry.IsFile() ) {
182  return;
183  }
184 
185  CFile file(dirEntry);
186  string name = file.GetName();
187  if (NStr::EndsWith(name, ".txt") || NStr::StartsWith(name, ".")) {
188  return;
189  }
190 
191  // extract info from the file name
192  const string sFileName = file.GetName();
193  vector<CTempString> vecFileNamePieces;
194  NStr::Split( sFileName, ".", vecFileNamePieces );
195  BOOST_REQUIRE(vecFileNamePieces.size() == 2);
196 
197  CTempString tsTestName = vecFileNamePieces[0];
198  BOOST_REQUIRE(!tsTestName.empty());
199  CTempString tsFileType = vecFileNamePieces[1];
200  BOOST_REQUIRE(!tsFileType.empty());
201 
202  STestInfo & test_info_to_load = m_TestNameToInfoMap[tsTestName];
203 
204  // figure out what type of file we have and set appropriately
205  if (tsFileType == mExtConfig) {
206  BOOST_REQUIRE( test_info_to_load.mConfigFile.GetPath().empty() );
207  test_info_to_load.mConfigFile = file;
208  }
209  else
210  if (tsFileType == mExtInput) {
211  BOOST_REQUIRE( test_info_to_load.mInFile.GetPath().empty() );
212  test_info_to_load.mInFile = file;
213  }
214  else if (tsFileType == mExtOutput) {
215  BOOST_REQUIRE( test_info_to_load.mOutFile.GetPath().empty() );
216  test_info_to_load.mOutFile = file;
217  }
218  else if (tsFileType == mExtErrors) {
219  BOOST_REQUIRE( test_info_to_load.mErrorFile.GetPath().empty() );
220  test_info_to_load.mErrorFile = file;
221  }
222 
223  else {
224  BOOST_FAIL("Unknown file type " << sFileName << ".");
225  }
226  }
227 
228 private:
229  // raw pointer because we do NOT own this
231  string mExtConfig;
232  string mExtInput;
233  string mExtOutput;
234  string mExtErrors;
235 };
236 
237 static bool
239  const string& fasta_file,
240  const string& config_file,
241  CRef<CSeq_entry>& pSeqEntry,
242  CMessageListenerBase* pMessageListener)
243 {
244  CNcbiIfstream ifstr(fasta_file.c_str());
245  CRef<ILineReader> pLineReader = ILineReader::New(ifstr);
246 
247  CFastaReader::TFlags fFlags = 0;
248  SConfigInfo config_info;
249  CNcbiIfstream cfgstr(config_file.c_str());
250  s_ReadConfig(
251  cfgstr,
252  config_info);
253  if (!config_info.flags.empty()) {
254  for (auto flag : config_info.flags) {
255  fFlags |= flag;
256  }
257  }
258 
259  try {
260  CFastaReader fasta_reader(*pLineReader, fFlags);
261  if (!config_info.excluded_mods.empty()) {
262  fasta_reader.SetExcludedMods(config_info.excluded_mods);
263  }
264  if (config_info.entry_type == SConfigInfo::EEntryType::eBioseq) {
265  pSeqEntry = fasta_reader.ReadOneSeq(pMessageListener);
266  }
267  else {
268  pSeqEntry = fasta_reader.ReadSet(100, pMessageListener);
269  }
270  }
271  catch (...) {
272  ifstr.close();
273  cfgstr.close();
274  throw;
275  }
276  return true;
277 }
278 
279 void sUpdateCase(CDir& test_cases_dir, const string& test_name)
280 {
281  string cfg = CDir::ConcatPath( test_cases_dir.GetPath(), test_name + "." + extConfig);
282  string input = CDir::ConcatPath( test_cases_dir.GetPath(), test_name + "." + extInput);
283  string output = CDir::ConcatPath( test_cases_dir.GetPath(), test_name + "." + extOutput);
284  string errors = CDir::ConcatPath( test_cases_dir.GetPath(), test_name + "." + extErrors);
285  if (!CFile(input).Exists()) {
286  BOOST_FAIL("input file " << input << " does not exist.");
287  }
288  if (!CFile(cfg).Exists()) {
289  BOOST_FAIL("config file " << cfg << " does not exist.");
290  }
291  cerr << "Creating new test case from " << input << " ..." << endl;
292 
293  // CNcbiIfstream ifstr(input.c_str());
294  unique_ptr<CMessageListenerBase> pMessageListener(new CMessageListenerLenient());
295  CRef<CSeq_entry> pSeqEntry;
296 
298  pSeqEntry, pMessageListener.get())) {
299 
300  BOOST_FAIL("Error: " << input << " failed during conversion.");
301  return;
302  }
303 
304  CNcbiOfstream ofstr(output.c_str());
305  ofstr << MSerial_AsnText << pSeqEntry;
306  ofstr.close();
307  cerr << " Produced new ASN1 file " << output << "." << endl;
308 
309  CNcbiOfstream errstr(errors.c_str());
310  if (pMessageListener->Count() > 0) {
311  pMessageListener->Dump(errstr);
312  }
313  errstr.close();
314  cerr << " Produced new error listing " << errors << "." << endl;
315  cerr << " ... Done." << endl;
316 }
317 
318 
319 void sUpdateAll(CDir& test_cases_dir) {
320 
321  const vector<string> kEmptyStringVec;
322  TTestNameToInfoMap testNameToInfoMap;
323  CTestNameToInfoMapLoader testInfoLoader(
324  testNameToInfoMap, extConfig, extInput, extOutput, extErrors);
326  test_cases_dir,
327  kEmptyStringVec,
328  kEmptyStringVec,
329  testInfoLoader,
331 
332  ITERATE(TTestNameToInfoMap, name_to_info_it, testNameToInfoMap) {
333  const string & sName = name_to_info_it->first;
334  sUpdateCase(test_cases_dir, sName);
335  }
336 }
337 
338 
339 void sRunTest(const string &sTestName, const STestInfo & testInfo, bool keep)
340 {
341  cerr << "Testing " <<
342  testInfo.mConfigFile.GetName() << " and " <<
343  testInfo.mInFile.GetName() << " against " <<
344  testInfo.mOutFile.GetName() << " and " <<
345  testInfo.mErrorFile.GetName() << endl;
346 
347  const string& logName = CDirEntry::GetTmpName();
348  CNcbiOfstream errstr(logName.c_str());
349  const string& resultName = CDirEntry::GetTmpName();
350  CNcbiOfstream ofstr(resultName.c_str());
351 
352 
353  unique_ptr<CMessageListenerBase> pMessageListener(new CMessageListenerLenient());
354  CRef<CSeq_entry> pSeqEntry;
355 
357  testInfo.mInFile.GetPath(),
358  testInfo.mConfigFile.GetPath(),
359  pSeqEntry,
360  pMessageListener.get())) {
361  BOOST_ERROR("Error: " << sTestName << " failed during conversion.");
362  return;
363  }
364 
365  ofstr << MSerial_AsnText << pSeqEntry;
366  if (pMessageListener->Count() > 0) {
367  pMessageListener->Dump(errstr);
368  }
369  ofstr.close();
370  errstr.close();
371 
372 
373  bool success = testInfo.mOutFile.CompareTextContents(resultName, CFile::eIgnoreWs);
374  if (!success) {
375  CDirEntry deResult = CDirEntry(resultName);
376  if (keep) {
377  deResult.Copy(testInfo.mOutFile.GetPath() + "." + extKeep);
378  }
379  deResult.Remove();
380  CDirEntry(logName).Remove();
381  BOOST_ERROR("Error: " << sTestName << " failed due to post processing diffs.");
382  }
383  CDirEntry(resultName).Remove();
384 
385  success = testInfo.mErrorFile.CompareTextContents(logName, CFile::eIgnoreWs);
386  if (!success) {
387  CDirEntry deErrors = CDirEntry(logName);
388  if (keep) {
389  deErrors.Copy(testInfo.mErrorFile.GetPath() + "." + extKeep);
390  }
391  deErrors.Remove();
392  BOOST_ERROR("Error: " << sTestName << " failed due to error handling diffs.");
393  }
394 };
395 
397 {
398 }
399 
400 
402 {
403  arg_descrs->AddDefaultKey("test-dir", "TEST_FILE_DIRECTORY",
404  "Set the root directory under which all test files can be found.",
406  dirTestFiles );
407  arg_descrs->AddDefaultKey("update-case", "UPDATE_CASE",
408  "Produce .asn and .error files from given name for new or updated test case.",
410  "" );
411  arg_descrs->AddFlag("update-all",
412  "Update all test cases to current reader code (dangerous).",
413  true );
414  arg_descrs->AddFlag("keep-diffs",
415  "Keep output files that are different from the expected.",
416  true );
417 }
418 
420 {
421 }
422 
424 {
425  const CArgs& args = CNcbiApplication::Instance()->GetArgs();
426 
427  CDir test_cases_dir( args["test-dir"].AsDirectory() );
428  BOOST_REQUIRE_MESSAGE( test_cases_dir.IsDir(),
429  "Cannot find dir: " << test_cases_dir.GetPath() );
430  bool update_all = args["update-all"].AsBoolean();
431  if (update_all) {
432  sUpdateAll(test_cases_dir);
433  return;
434  }
435 
436  string update_case = args["update-case"].AsString();
437  if (!update_case.empty()) {
438  sUpdateCase(test_cases_dir, update_case);
439  return;
440  }
441  const vector<string> kEmptyStringVec;
442  TTestNameToInfoMap testNameToInfoMap;
443  CTestNameToInfoMapLoader testInfoLoader(
444  testNameToInfoMap, extConfig, extInput, extOutput, extErrors);
446  test_cases_dir,
447  kEmptyStringVec,
448  kEmptyStringVec,
449  testInfoLoader,
451 
452  ITERATE(TTestNameToInfoMap, name_to_info_it, testNameToInfoMap) {
453  const string & sName = name_to_info_it->first;
454  const STestInfo & testInfo = name_to_info_it->second;
455  cout << "Verifying: " << sName << endl;
456  BOOST_REQUIRE_MESSAGE( testInfo.mConfigFile.Exists(),
457  extConfig + " file does not exist: " << testInfo.mConfigFile.GetPath() );
458  BOOST_REQUIRE_MESSAGE( testInfo.mInFile.Exists(),
459  extInput + " file does not exist: " << testInfo.mInFile.GetPath() );
460  BOOST_REQUIRE_MESSAGE( testInfo.mOutFile.Exists(),
461  extOutput + " file does not exist: " << testInfo.mOutFile.GetPath() );
462  BOOST_REQUIRE_MESSAGE( testInfo.mErrorFile.Exists(),
463  extErrors + " file does not exist: " << testInfo.mErrorFile.GetPath() );
464  }
465  ITERATE(TTestNameToInfoMap, name_to_info_it, testNameToInfoMap) {
466  const string & sName = name_to_info_it->first;
467  const STestInfo & testInfo = name_to_info_it->second;
468 
469  cout << "Running test: " << sName << endl;
470 
471  BOOST_CHECK_NO_THROW(sRunTest(sName, testInfo, args["keep-diffs"]));
472  }
473 }
void transform(Container &c, UnaryFunction *op)
Definition: chainer.hpp:86
CArgs –.
Definition: ncbiargs.hpp:379
CDirEntry –.
Definition: ncbifile.hpp:262
CDir –.
Definition: ncbifile.hpp:1695
Base class for reading FASTA sequences.
Definition: fasta.hpp:80
CFile –.
Definition: ncbifile.hpp:1604
static CNcbiApplication * Instance(void)
Singleton method.
Definition: ncbiapp.cpp:264
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Definition: tempstr.hpp:65
TTestNameToInfoMap & m_TestNameToInfoMap
void operator()(const CDirEntry &dirEntry)
CTestNameToInfoMapLoader(TTestNameToInfoMap &testNameToInfoMap, const string &extConfig, const string &extInput, const string &extOutput, const string &extErrors)
const_iterator find(const key_type &key) const
Definition: map.hpp:153
Definition: map.hpp:338
Operators to edit gaps in sequences.
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
Definition: dlist.tmpl.h:56
static SQLCHAR output[256]
Definition: print.c:5
static int RunTests(void)
Code to iterate through all tests to run.
Definition: testodbc.c:397
static char test_name[128]
Definition: utf8_2.c:34
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
Definition: ncbiapp.cpp:305
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
@ eString
An arbitrary string.
Definition: ncbiargs.hpp:589
@ eDirectory
Name of file directory.
Definition: ncbiargs.hpp:598
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
void FindFilesInDir(const CDir &dir, const vector< string > &masks, const vector< string > &masks_subdir, TFindFunc &find_func, TFindFiles flags=fFF_Default)
Find files in the specified directory.
Definition: ncbifile.hpp:3022
virtual bool Remove(TRemoveFlags flags=eRecursive) const
Remove a directory entry.
Definition: ncbifile.cpp:2595
bool IsDir(EFollowLinks follow=eFollowLinks) const
Check whether a directory entry is a directory.
Definition: ncbifile.hpp:3946
bool CompareTextContents(const string &file, ECompareText mode, size_t buf_size=0) const
Compare files contents in text form.
Definition: ncbifile.cpp:3565
bool IsFile(EFollowLinks follow=eFollowLinks) const
Check whether a directory entry is a file.
Definition: ncbifile.hpp:3940
static string GetTmpName(ETmpFileCreationMode mode=eTmpFileGetName)
Get temporary file name.
Definition: ncbifile.cpp:2903
static string ConcatPath(const string &first, const string &second)
Concatenate two parts of the path for the current OS.
Definition: ncbifile.cpp:776
string GetName(void) const
Get the base entry name with extension (if any).
Definition: ncbifile.hpp:3916
const string & GetPath(void) const
Get entry path.
Definition: ncbifile.hpp:3910
virtual bool Copy(const string &new_path, TCopyFlags flags=fCF_Default, size_t buf_size=0) const
Copy the entry to a location specified by "new_path".
Definition: ncbifile.cpp:2428
virtual bool Exists(void) const
Check existence of file.
Definition: ncbifile.hpp:4038
@ fFF_Recursive
descend into sub-dirs
Definition: ncbifile.hpp:3012
@ fFF_Default
default behavior
Definition: ncbifile.hpp:3014
@ eIgnoreWs
Definition: ncbifile.hpp:1668
@ eUnknown
Definition: app_popup.hpp:72
#define MSerial_AsnText
I/O stream manipulators –.
Definition: serialbase.hpp:696
virtual CRef< CSeq_entry > ReadOneSeq(ILineErrorListener *pMessageListener=nullptr)
Read a single effective sequence, which may turn out to be a segmented set.
Definition: fasta.cpp:312
CRef< CSeq_entry > ReadSet(int max_seqs=kMax_Int, ILineErrorListener *pMessageListener=nullptr)
Read multiple sequences (by default, as many as are available.)
Definition: fasta.cpp:442
static CRef< ILineReader > New(const string &filename)
Return a new ILineReader object corresponding to the given filename, taking "-" (but not "....
Definition: line_reader.cpp:49
long TFlags
binary OR of EFlags
Definition: fasta.hpp:117
void SetExcludedMods(const vector< string > &excluded_mods)
Definition: fasta.cpp:1991
@ fNoParseID
Generate an ID (whole defline -> title)
Definition: fasta.hpp:90
@ fQuickIDCheck
Just check local IDs' first characters.
Definition: fasta.hpp:110
@ fDLOptional
Don't require a leading defline.
Definition: fasta.hpp:96
@ fLaxGuess
Use legacy heuristic for guessing seq. type.
Definition: fasta.hpp:103
@ fHyphensIgnoreAndWarn
When a hyphen is encountered in seq data, ignore it but warn.
Definition: fasta.hpp:112
@ fRequireID
Reject deflines that lack IDs.
Definition: fasta.hpp:95
@ fSkipCheck
Skip (rudimentary) body content check.
Definition: fasta.hpp:98
@ fDisableNoResidues
If no residues found do not raise an error.
Definition: fasta.hpp:113
@ fUniqueIDs
Forbid duplicate IDs.
Definition: fasta.hpp:101
@ fLetterGaps
Parse runs of Ns when splitting data.
Definition: fasta.hpp:105
@ fIgnoreMods
Ignore mods entirely. Incompatible with fAddMods.
Definition: fasta.hpp:115
@ fAddMods
Parse defline mods and add to SeqEntry.
Definition: fasta.hpp:104
@ fNoUserObjs
Don't save raw deflines in User-objects.
Definition: fasta.hpp:106
@ fForceType
Force specified type regardless of accession.
Definition: fasta.hpp:89
@ fParseRawID
Try to identify raw accessions.
Definition: fasta.hpp:97
@ fNoSplit
Don't split out ambiguous sequence regions.
Definition: fasta.hpp:99
@ fUseIupacaa
If Prot, use iupacaa instead of the default ncbieaa.
Definition: fasta.hpp:111
@ fAssumeNuc
Assume nucs unless accns indicate otherwise.
Definition: fasta.hpp:87
@ fParseGaps
Make a delta sequence if gaps found.
Definition: fasta.hpp:91
@ fValidate
Check (alphabetic) residue validity.
Definition: fasta.hpp:100
@ fOneSeq
Just read the first sequence found.
Definition: fasta.hpp:92
@ fLeaveAsText
Don't reencode at all, just parse.
Definition: fasta.hpp:109
@ fAssumeProt
Assume prots unless accns indicate otherwise.
Definition: fasta.hpp:88
@ fNoSeqData
Parse the deflines but skip the data.
Definition: fasta.hpp:94
@ fStrictGuess
Assume no typos when guessing sequence type.
Definition: fasta.hpp:102
@ fDisableParseRange
No ranges in seq-ids. Ranges part of seq-id instead.
Definition: fasta.hpp:114
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
Definition: ncbistre.hpp:500
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
Definition: ncbistre.hpp:439
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
Definition: ncbistr.cpp:3461
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
Definition: ncbistr.hpp:5430
bool empty(void) const
Return true if the represented string is empty (i.e., the length is zero)
Definition: tempstr.hpp:334
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
Definition: ncbistr.hpp:5412
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string.
Definition: ncbistr.cpp:3186
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
Definition: ncbistr.hpp:2508
FILE * file
static int input()
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
Definition: njn_matrix.hpp:613
SConfigInfo –.
vector< string > excluded_mods
list< CFastaReader::TFlags > flags
Utility stuff for more convenient using of Boost.Test library.
BOOST_AUTO_TEST_CASE(RunTests)
USING_SCOPE(objects)
static void s_ReadConfig(CNcbiIfstream &ifstr, SConfigInfo &config)
static bool sReadInputAndGenerateAsn(const string &fasta_file, const string &config_file, CRef< CSeq_entry > &pSeqEntry, CMessageListenerBase *pMessageListener)
const string extErrors("errors")
void sUpdateAll(CDir &test_cases_dir)
map< TTestName, STestInfo > TTestNameToInfoMap
const string extOutput("asn")
const string dirTestFiles("fasta_reader_test_cases")
void sUpdateCase(CDir &test_cases_dir, const string &test_name)
NCBITEST_AUTO_INIT()
const string extConfig("cfg")
static CFastaReader::TFlags s_StringToFastaFlag(const string &flag_string)
const string extKeep("new")
void sRunTest(const string &sTestName, const STestInfo &testInfo, bool keep)
NCBITEST_AUTO_FINI()
const string extInput("fsa")
NCBITEST_INIT_CMDLINE(arg_descrs)
string TTestName
Modified on Wed Apr 17 13:08:54 2024 by modify_doxy.py rev. 669887