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

Go to the SVN repository for this file.

1 /* $Id: cn3d_tools.cpp 92484 2021-01-26 18:35:07Z grichenk $
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 * Authors: Paul Thiessen
27 *
28 * File Description:
29 * Miscellaneous utility functions
30 *
31 * ===========================================================================
32 */
33 #include <ncbi_pch.hpp>
34 #include <corelib/ncbistd.hpp>
35 
36 #if defined(__WXMSW__)
37 #include <windows.h>
38 #include <shellapi.h> // for ShellExecute, needed to launch browser
39 
40 #elif defined(__WXGTK__)
41 #include <unistd.h>
42 
43 #elif defined(__WXMAC__)
44 // full paths used to avoid adding extra -I option to point at FlatCarbon to compile flags for all modules...
45 // Under OSX 10.6 and earlier, /Developer was a root-level directory. With 10.8, it is buried under XCode's tools.
46 //#include "/Developer/Headers/FlatCarbon/Types.h"
47 //#include "/Developer/Headers/FlatCarbon/InternetConfig.h"
48 #include "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/Headers/InternetConfig.h"
49 #endif
50 
51 #include <corelib/ncbistd.hpp>
52 #include <corelib/ncbireg.hpp>
53 
54 #include <objects/seq/Bioseq.hpp>
57 
59 
60 #ifdef __WXMSW__
61 #include <windows.h>
62 #include <wx/msw/winundef.h>
63 #endif
64 #include <wx/wx.h>
65 #include <wx/file.h>
66 #include <wx/fileconf.h>
67 
68 #include "cn3d_tools.hpp"
69 #include "asn_reader.hpp"
70 
71 #include <memory>
72 
75 
76 
77 BEGIN_SCOPE(Cn3D)
78 
79 ///// Registry stuff /////
80 
84 
86 {
87  // default log window startup
94 
95  // default animation controls
99 
100  // default quality settings
109 
110  if (IsWindowedMode()) {
111  // default font for OpenGL (structure window)
112  wxFont *font = wxFont::New(
113 #if defined(__WXMSW__)
114  12,
115 #elif defined(__WXGTK__)
116  14,
117 #elif defined(__WXMAC__)
118  14,
119 #endif
120  wxSWISS, wxNORMAL, wxBOLD, false);
121  if (font && font->Ok())
123  else
124  ERRORMSG("Can't create default structure window font");
125 
126  if (font) delete font;
127 
128  // default font for sequence viewers
129  font = wxFont::New(
130 #if defined(__WXMSW__)
131  10,
132 #elif defined(__WXGTK__)
133  14,
134 #elif defined(__WXMAC__)
135  12,
136 #endif
137  wxROMAN, wxNORMAL, wxNORMAL, false);
138  if (font && font->Ok())
140  else
141  ERRORMSG("Can't create default sequence window font");
142  if (font) delete font;
143  }
144 
145  // default cache settings
147  if (GetPrefsDir().size() > 0)
149  else
152 
153  // default advanced options
155 #ifdef __WXGTK__
156  RegistrySetString(REG_ADVANCED_SECTION, REG_BROWSER_LAUNCH,
157  // for launching netscape in a separate window
158  "( netscape -noraise -remote 'openURL(<URL>,new-window)' || netscape '<URL>' ) >/dev/null 2>&1 &"
159  // for launching netscape in an existing window
160 // "( netscape -raise -remote 'openURL(<URL>)' || netscape '<URL>' ) >/dev/null 2>&1 &"
161  );
162 #endif
165 
166  // default stereo options
169 }
170 
171 void LoadRegistry(void)
172 {
173  // first set up defaults, then override any/all with stuff from registry file
175 
176  if (GetPrefsDir().size() > 0)
177  registryFile = GetPrefsDir() + "Preferences";
178  else
179  registryFile = GetProgramDir() + "Preferences";
180  unique_ptr<CNcbiIfstream> iniIn(new CNcbiIfstream(registryFile.c_str(), IOS_BASE::in | IOS_BASE::binary));
181  if (*iniIn) {
182  TRACEMSG("loading program registry " << registryFile);
184  }
185 
186  registryChanged = false;
187 }
188 
189 void SaveRegistry(void)
190 {
191  if (registryChanged) {
192  unique_ptr<CNcbiOfstream> iniOut(new CNcbiOfstream(registryFile.c_str(), IOS_BASE::out));
193  if (*iniOut) {
194 // TESTMSG("saving program registry " << registryFile);
195  registry.Write(*iniOut);
196  }
197  }
198 }
199 
200 bool RegistryIsValidInteger(const string& section, const string& name)
201 {
202  long value;
203  wxString regStr = registry.Get(section, name).c_str();
204  return (regStr.size() > 0 && regStr.ToLong(&value));
205 }
206 
207 bool RegistryIsValidDouble(const string& section, const string& name)
208 {
209  double value;
210  wxString regStr = registry.Get(section, name).c_str();
211  return (regStr.size() > 0 && regStr.ToDouble(&value));
212 }
213 
214 bool RegistryIsValidBoolean(const string& section, const string& name)
215 {
216  string regStr = registry.Get(section, name);
217  return (regStr.size() > 0 && (
218  toupper((unsigned char) regStr[0]) == 'T' || toupper((unsigned char) regStr[0]) == 'F' ||
219  toupper((unsigned char) regStr[0]) == 'Y' || toupper((unsigned char) regStr[0]) == 'N'));
220 }
221 
222 bool RegistryIsValidString(const string& section, const string& name)
223 {
224  string regStr = registry.Get(section, name);
225  return (regStr.size() > 0);
226 }
227 
228 bool RegistryGetInteger(const string& section, const string& name, int *value)
229 {
230  wxString regStr = registry.Get(section, name).c_str();
231  long l;
232  if (regStr.size() == 0 || !regStr.ToLong(&l)) {
233  WARNINGMSG("Can't get long from registry: " << section << ", " << name);
234  return false;
235  }
236  *value = (int) l;
237  return true;
238 }
239 
240 bool RegistryGetDouble(const string& section, const string& name, double *value)
241 {
242  wxString regStr = registry.Get(section, name).c_str();
243  if (regStr.size() == 0 || !regStr.ToDouble(value)) {
244  WARNINGMSG("Can't get double from registry: " << section << ", " << name);
245  return false;
246  }
247  return true;
248 }
249 
250 bool RegistryGetBoolean(const string& section, const string& name, bool *value)
251 {
252  string regStr = registry.Get(section, name);
253  if (regStr.size() == 0 || !(
254  toupper((unsigned char) regStr[0]) == 'T' || toupper((unsigned char) regStr[0]) == 'F' ||
255  toupper((unsigned char) regStr[0]) == 'Y' || toupper((unsigned char) regStr[0]) == 'N')) {
256  WARNINGMSG("Can't get boolean from registry: " << section << ", " << name);
257  return false;
258  }
259  *value = (toupper((unsigned char) regStr[0]) == 'T' || toupper((unsigned char) regStr[0]) == 'Y');
260  return true;
261 }
262 
263 bool RegistryGetString(const string& section, const string& name, string *value)
264 {
265  string regStr = registry.Get(section, name);
266  if (regStr.size() == 0) {
267  WARNINGMSG("Can't get string from registry: " << section << ", " << name);
268  return false;
269  }
270  *value = regStr;
271  return true;
272 }
273 
274 bool RegistrySetInteger(const string& section, const string& name, int value)
275 {
276  bool okay = registry.Set(section, name, NStr::IntToString(value), CNcbiRegistry::ePersistent);
277  if (!okay)
278  ERRORMSG("registry Set(" << section << ", " << name << ") failed");
279  else
280  registryChanged = true;
281  return okay;
282 }
283 
284 bool RegistrySetDouble(const string& section, const string& name, double value)
285 {
286  bool okay = registry.Set(section, name, NStr::DoubleToString(value), CNcbiRegistry::ePersistent);
287  if (!okay)
288  ERRORMSG("registry Set(" << section << ", " << name << ") failed");
289  else
290  registryChanged = true;
291  return okay;
292 }
293 
294 bool RegistrySetBoolean(const string& section, const string& name, bool value, bool useYesOrNo)
295 {
296  string regStr;
297  if (useYesOrNo)
298  regStr = value ? "yes" : "no";
299  else
300  regStr = value ? "true" : "false";
301  bool okay = registry.Set(section, name, regStr, CNcbiRegistry::ePersistent);
302  if (!okay)
303  ERRORMSG("registry Set(" << section << ", " << name << ") failed");
304  else
305  registryChanged = true;
306  return okay;
307 }
308 
309 bool RegistrySetString(const string& section, const string& name, const string& value)
310 {
311  bool okay = registry.Set(section, name, value, CNcbiRegistry::ePersistent);
312  if (!okay)
313  ERRORMSG("registry Set(" << section << ", " << name << ") failed");
314  else
315  registryChanged = true;
316  return okay;
317 }
318 
319 
320 ///// Misc stuff /////
321 
322 // global strings for various directories - will include trailing path separator character
323 static string
324  workingDir, // current working directory
325  programDir, // directory where Cn3D executable lives
326  dataDir, // 'data' directory with external data files
327  prefsDir; // application preferences directory
328 const string& GetWorkingDir(void) { return workingDir; }
329 const string& GetProgramDir(void) { return programDir; }
330 const string& GetDataDir(void) { return dataDir; }
331 const string& GetPrefsDir(void) { return prefsDir; }
332 
333 void SetUpWorkingDirectories(const char* argv0)
334 {
335  // set up working directories
336  workingDir = wxGetCwd().c_str();
337 #ifdef __WXGTK__
338  if (getenv("CN3D_HOME") != NULL)
339  programDir = getenv("CN3D_HOME");
340  else
341 #endif
342  if (wxIsAbsolutePath(argv0))
343  programDir = wxPathOnly(argv0).c_str();
344  else if (wxPathOnly(argv0) == "")
346  else
347  programDir = workingDir + wxFILE_SEP_PATH + WX_TO_STD(wxPathOnly(argv0));
348  workingDir = workingDir + wxFILE_SEP_PATH;
349  programDir = programDir + wxFILE_SEP_PATH;
350 
351  // find or create preferences folder
352  wxString localDir;
353  wxFileName::SplitPath(wxFileConfig::GetLocalFileName("unused"), &localDir, NULL, NULL);
354  wxString prefsDirLocal = localDir + wxFILE_SEP_PATH + "Cn3D_User";
355  wxString prefsDirProg = wxString(programDir.c_str()) + wxFILE_SEP_PATH + "Cn3D_User";
356  if (wxDirExists(prefsDirLocal))
357  prefsDir = prefsDirLocal.c_str();
358  else if (wxDirExists(prefsDirProg))
359  prefsDir = prefsDirProg.c_str();
360  else {
361  // try to create the folder
362  if (wxMkdir(prefsDirLocal) && wxDirExists(prefsDirLocal))
363  prefsDir = prefsDirLocal.c_str();
364  else if (wxMkdir(prefsDirProg) && wxDirExists(prefsDirProg))
365  prefsDir = prefsDirProg.c_str();
366  }
367  if (prefsDir.size() == 0)
368  WARNINGMSG("Can't create Cn3D_User folder at either:"
369  << "\n " << prefsDirLocal
370  << "\nor " << prefsDirProg);
371  else
372  prefsDir += wxFILE_SEP_PATH;
373 
374  // set data dir, and register the path in C toolkit registry (mainly for BLAST code)
375 #ifdef __WXMAC__
376  dataDir = programDir + "../Resources/data/";
377 #else
378  dataDir = programDir + "data" + wxFILE_SEP_PATH;
379 #endif
380 
381  TRACEMSG("working dir: " << workingDir.c_str());
382  TRACEMSG("program dir: " << programDir.c_str());
383  TRACEMSG("data dir: " << dataDir.c_str());
384  TRACEMSG("prefs dir: " << prefsDir.c_str());
385 }
386 
387 #ifdef __WXMSW__
388 // code borrowed (and modified) from Nlm_MSWin_OpenDocument() in vibutils.c
389 static bool MSWin_OpenDocument(const char* doc_name)
390 {
391  int status = (int) ShellExecute(0, "open", doc_name, NULL, NULL, SW_SHOWNORMAL);
392  if (status <= 32) {
393  ERRORMSG("Unable to open document \"" << doc_name << "\", error = " << status);
394  return false;
395  }
396  return true;
397 }
398 #endif
399 
400 #ifdef __WXMAC__
401 // CJL Hack ... pass the length of the string
402 static OSStatus MacLaunchURL(ConstStr255Param urlStr, long int len)
403 {
404  OSStatus err;
405  ICInstance inst;
406  long int startSel;
407  long int endSel;
408 
409  err = ICStart(&inst, 'Cn3D');
410  if (err == noErr) {
411 #if !TARGET_CARBON
412  err = ICFindConfigFile(inst, 0, nil);
413 #endif
414  if (err == noErr) {
415  startSel = 0;
416 // endSel = strlen(urlStr); // OSX didn't like this: invalid conversion from
417 // 'const unsigned char*' to 'const char*' compiler error.
418 // ConstStr255Param is an unsigned char*. Mac developer docs do not seem to indicate the '255'
419 // means there are any length restrictions on such strings, and that implementations have some
420 // backing store for longer strings. But to be safe, I'm truncating this to 255.
421 // As used in Cn3D none of the URLs are terribly long ... except when multiple annotations are selected.
422 // (Also see CoreFoundation header CFBase.h; used in ncbi_os_mac.hpp Pstrncpy)
423  endSel = (len > 0 && len <= 255) ? len : 255;
424  err = ICLaunchURL(inst, "\p", urlStr, endSel, &startSel, &endSel);
425  }
426  ICStop(inst);
427  }
428  return err;
429 }
430 #endif
431 
432 void LaunchWebPage(const char *url)
433 {
434  if(!url) return;
435  INFOMSG("launching url " << url);
436 
437 #if defined(__WXMSW__)
438  if (!MSWin_OpenDocument(url)) {
439  ERRORMSG("Unable to launch browser");
440  }
441 
442 #elif defined(__WXGTK__)
443  string command;
444  RegistryGetString(REG_ADVANCED_SECTION, REG_BROWSER_LAUNCH, &command);
445  size_t pos = 0;
446  while ((pos=command.find("<URL>", pos)) != string::npos)
447  command.replace(pos, 5, url);
448  TRACEMSG("launching browser with: " << command);
449  system(command.c_str());
450 
451 #elif defined(__WXMAC__)
452  // CJL: hack of dubious generality to get the string length
453  // of a 'ConstStr255Param' type.
454  // Unclear if strings longer than 255 characters are safe. See notes above in MacLaunchURL.
455  unsigned int i = 0, l = strlen(url);
456  unsigned char uc_url[l+1];
457  for (; i < l && i < 255; ++i) uc_url[i] = (unsigned char) *(url + i);
458  uc_url[i] = '\0';
459  MacLaunchURL(uc_url, l);
460 #endif
461 }
462 
464 {
465  CSeq_entry seqEntry;
466  string err;
467  static const string host("eutils.ncbi.nlm.nih.gov"), path("/entrez/eutils/efetch.fcgi");
468  string args = string("rettype=asn.1&retmode=binary&maxplex=1&id=") + id;
469 
470  // efetch doesn't seem to care whether db is protein or nucleotide, when using gi or accession... but that may change in the future
471  CRef < CBioseq > bioseq;
472  for (unsigned int round=1; round<=2 && bioseq.Empty(); ++round) {
473  string db = (round == 1) ? "protein" : "nucleotide";
474  INFOMSG("Trying to load sequence from URL " << host << path << '?' << (args + "&db=" + db));
475 
476  bool ok = GetAsnDataViaHTTPS(host, path, (args + "&db=" + db), &seqEntry, &err);
477  if (ok) {
478  if (seqEntry.IsSeq())
479  bioseq.Reset(&(seqEntry.SetSeq()));
480  else if (seqEntry.IsSet() && seqEntry.GetSet().GetSeq_set().front()->IsSeq())
481  bioseq.Reset(&(seqEntry.SetSet().SetSeq_set().front()->SetSeq()));
482  else
483  WARNINGMSG("FetchSequenceViaHTTP() - confused by SeqEntry format");
484  } else {
485  WARNINGMSG("FetchSequenceViaHTTP() - HTTP Bioseq retrieval failed, err: " << err);
486  }
487  }
488  return bioseq;
489 }
490 
491 static const string NCBIStdaaResidues("-ABCDEFGHIKLMNPQRSTVWXYZU*OJ");
492 
493 // gives NCBIStdaa residue number for a character (or value for 'X' if char not found)
495 {
496  typedef map < char, unsigned char > Char2UChar;
497  static Char2UChar charMap;
498 
499  if (charMap.size() == 0) {
500  for (unsigned int i=0; i<NCBIStdaaResidues.size(); ++i)
501  charMap[NCBIStdaaResidues[i]] = (unsigned char) i;
502  }
503 
504  Char2UChar::const_iterator n = charMap.find(toupper((unsigned char) r));
505  if (n != charMap.end())
506  return n->second;
507  else
508  return charMap.find('X')->second;
509 }
510 
512 {
513  if (n <= 27)
514  return NCBIStdaaResidues[n];
515  ERRORMSG("LookupCharacterFromNCBIStdaaNumber() - valid values are 0 - 27");
516  return '?';
517 }
518 
519 bool Prosite2Regex(const string& prosite, string *regex, int *nGroups)
520 {
521  try {
522  // check allowed characters ('#' isn't ProSite, but is a special case used to match an 'X' residue character)
523  static const string allowed = "-ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789[],(){}<>.#";
524  unsigned int i;
525  for (i=0; i<prosite.size(); ++i)
526  if (allowed.find(toupper((unsigned char) prosite[i])) == string::npos) break;
527  if (i != prosite.size()) throw "invalid ProSite character";
528  if (prosite[prosite.size() - 1] != '.') throw "ProSite pattern must end with '.'";
529 
530  // translate into real regex syntax;
531  regex->erase();
532  *nGroups = 0;
533 
534  bool inGroup = false;
535  for (unsigned int i=0; i<prosite.size(); ++i) {
536 
537  // handle grouping and termini
538  bool characterHandled = true;
539  switch (prosite[i]) {
540  case '-': case '.': case '>':
541  if (inGroup) {
542  *regex += ')';
543  inGroup = false;
544  }
545  if (prosite[i] == '>') *regex += '$';
546  break;
547  case '<':
548  *regex += '^';
549  break;
550  default:
551  characterHandled = false;
552  break;
553  }
554  if (characterHandled) continue;
555  if (!inGroup && (
556  (isalpha((unsigned char) prosite[i]) && toupper((unsigned char) prosite[i]) != 'X') ||
557  prosite[i] == '[' || prosite[i] == '{' || prosite[i] == '#')) {
558  *regex += '(';
559  ++(*nGroups);
560  inGroup = true;
561  }
562 
563  // translate syntax
564  switch (prosite[i]) {
565  case '(':
566  *regex += '{';
567  break;
568  case ')':
569  *regex += '}';
570  break;
571  case '{':
572  *regex += "[^";
573  break;
574  case '}':
575  *regex += ']';
576  break;
577  case 'X': case 'x':
578  *regex += '.';
579  break;
580  case '#':
581  *regex += 'X';
582  break;
583  default:
584  *regex += toupper((unsigned char) prosite[i]);
585  break;
586  }
587  }
588  }
589 
590  catch (const char *err) {
591  ERRORMSG("Prosite2Regex() - " << err);
592  return false;
593  }
594 
595  return true;
596 }
597 
598 unsigned int PrositePatternLength(const string& prosite)
599 {
600  // ('#' isn't ProSite, but is a special case used to match an 'X' residue character)
601  static const string allowed = "-ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789[],(){}<>.#";
602 
603  // check allowed characters
604  unsigned int i;
605  for (i=0; i<prosite.size(); ++i)
606  if (allowed.find(toupper((unsigned char) prosite[i])) == string::npos) break;
607  if (i != prosite.size()) return 0;
608 
609  bool hasOnlyX = true, stopParsing = false;
610  bool inBraces = false, inBrackets = false, inParens = false;
611  unsigned int length = 0;
612  int nFromParens;
613  string betweenParens;
614 
615  for (i=0; i < prosite.size() && !stopParsing; ++i) {
616 
617  // handle grouping and termini
618  bool characterHandled = true;
619  switch (prosite[i]) {
620  case '-': case '.': case '>': case '<':
621  break;
622  default:
623  characterHandled = false;
624  break;
625  }
626  if (inParens && prosite[i] != ')' && !characterHandled) betweenParens += prosite[i];
627  if (characterHandled) continue;
628 
629  if (hasOnlyX && isalpha((unsigned char) prosite[i]) && toupper((unsigned char) prosite[i]) != 'X') {
630  hasOnlyX = false;
631  }
632 
633  // translate syntax
634  switch (prosite[i]) {
635  case '(':
636  inParens = true;
637  break;
638  case ')':
639  nFromParens = NStr::StringToInt(betweenParens, NStr::fConvErr_NoThrow);
640 
641  // Do not allow a variable number of repetitions.
642  // Also, length has already been incremented by 1 for whatever the (...) references
643  if (nFromParens > 0)
644  length += nFromParens - 1;
645  else
646  stopParsing = true;
647 
648  inParens = false;
649  betweenParens.erase();
650  break;
651  case '{':
652  inBraces = true;
653  break;
654  case '}':
655  ++length;
656  inBraces = false;
657  break;
658  case '[':
659  inBrackets = true;
660  break;
661  case ']':
662  ++length;
663  inBrackets = false;
664  break;
665  default:
666  if (!inParens && !inBraces && !inBrackets) ++length;
667  break;
668  }
669  }
670 
671  // Invalid pattern: Appear to have missed a closing parenthesis/brace/bracket.
672  if (inParens || inBrackets || inBraces) length = 0;
673 
674  // Invalid pattern: Appear to have all 'X' characters.
675  if (hasOnlyX) length = 0;
676 
677  // If there was some parsing error or prosite pattern allowed
678  // a match of indeterminate length, return 0.
679  if (stopParsing) length = 0;
680 
681  return length;
682 }
683 
684 END_SCOPE(Cn3D)
#define static
T round(const T &v)
bool GetAsnDataViaHTTPS(const std::string &host, const std::string &path, const std::string &args, ASNClass *asnObject, std::string *err, bool binaryData=true)
Definition: asn_reader.hpp:182
CMemoryRegistry –.
Definition: ncbireg.hpp:584
Definition: Seq_entry.hpp:56
Definition: map.hpp:338
bool IsWindowedMode(void)
Definition: cn3d_app.cpp:92
USING_SCOPE(objects)
void SetUpWorkingDirectories(const char *argv0)
Definition: cn3d_tools.cpp:333
unsigned char LookupNCBIStdaaNumberFromCharacter(char r)
Definition: cn3d_tools.cpp:494
bool RegistryIsValidString(const string &section, const string &name)
Definition: cn3d_tools.cpp:222
static string programDir
Definition: cn3d_tools.cpp:325
bool RegistryGetDouble(const string &section, const string &name, double *value)
Definition: cn3d_tools.cpp:240
void LoadRegistry(void)
Definition: cn3d_tools.cpp:171
void SaveRegistry(void)
Definition: cn3d_tools.cpp:189
bool RegistryIsValidInteger(const string &section, const string &name)
Definition: cn3d_tools.cpp:200
const string & GetProgramDir(void)
Definition: cn3d_tools.cpp:329
CRef< CBioseq > FetchSequenceViaHTTP(const string &id)
Definition: cn3d_tools.cpp:463
const string & GetDataDir(void)
Definition: cn3d_tools.cpp:330
bool RegistryGetInteger(const string &section, const string &name, int *value)
Definition: cn3d_tools.cpp:228
static const string NCBIStdaaResidues("-ABCDEFGHIKLMNPQRSTVWXYZU*OJ")
const string & GetPrefsDir(void)
Definition: cn3d_tools.cpp:331
const string & GetWorkingDir(void)
Definition: cn3d_tools.cpp:328
bool RegistrySetBoolean(const string &section, const string &name, bool value, bool useYesOrNo)
Definition: cn3d_tools.cpp:294
static string dataDir
Definition: cn3d_tools.cpp:326
static bool registryChanged
Definition: cn3d_tools.cpp:83
bool RegistryGetBoolean(const string &section, const string &name, bool *value)
Definition: cn3d_tools.cpp:250
bool RegistrySetDouble(const string &section, const string &name, double value)
Definition: cn3d_tools.cpp:284
static CMemoryRegistry registry
Definition: cn3d_tools.cpp:81
void LaunchWebPage(const char *url)
Definition: cn3d_tools.cpp:432
static string registryFile
Definition: cn3d_tools.cpp:82
unsigned int PrositePatternLength(const string &prosite)
Definition: cn3d_tools.cpp:598
bool Prosite2Regex(const string &prosite, string *regex, int *nGroups)
Definition: cn3d_tools.cpp:519
bool RegistrySetInteger(const string &section, const string &name, int value)
Definition: cn3d_tools.cpp:274
static string workingDir
Definition: cn3d_tools.cpp:324
static string prefsDir
Definition: cn3d_tools.cpp:327
USING_NCBI_SCOPE
Definition: cn3d_tools.cpp:73
bool RegistryGetString(const string &section, const string &name, string *value)
Definition: cn3d_tools.cpp:263
char LookupCharacterFromNCBIStdaaNumber(unsigned char n)
Definition: cn3d_tools.cpp:511
static void SetRegistryDefaults(void)
Definition: cn3d_tools.cpp:85
bool RegistryIsValidDouble(const string &section, const string &name)
Definition: cn3d_tools.cpp:207
bool RegistryIsValidBoolean(const string &section, const string &name)
Definition: cn3d_tools.cpp:214
bool RegistrySetString(const string &section, const string &name, const string &value)
Definition: cn3d_tools.cpp:309
static const std::string REG_FOOTPRINT_RES
Definition: cn3d_tools.hpp:197
static const std::string REG_SPIN_DELAY
Definition: cn3d_tools.hpp:168
static const std::string REG_QUALITY_ATOM_STACKS
Definition: cn3d_tools.hpp:174
static const std::string REG_QUALITY_ATOM_SLICES
Definition: cn3d_tools.hpp:173
static const std::string REG_MAX_N_STRUCTS
Definition: cn3d_tools.hpp:196
static const std::string REG_SPIN_INCREMENT
Definition: cn3d_tools.hpp:169
static const std::string REG_CONFIG_SECTION
Definition: cn3d_tools.hpp:158
static const std::string REG_QUALITY_SECTION
Definition: cn3d_tools.hpp:172
static const std::string REG_SEQUENCE_FONT_SECTION
Definition: cn3d_tools.hpp:183
#define TRACEMSG(stream)
Definition: cn3d_tools.hpp:83
#define INFOMSG(stream)
Definition: cn3d_tools.hpp:84
static const std::string REG_PROJECTION_TYPE
Definition: cn3d_tools.hpp:180
static const std::string REG_QUALITY_BOND_SIDES
Definition: cn3d_tools.hpp:175
static const std::string REG_MT_DIALOG_POS_Y
Definition: cn3d_tools.hpp:163
static const std::string REG_HIGHLIGHTS_ON
Definition: cn3d_tools.hpp:179
static const std::string REG_QUALITY_WORM_SIDES
Definition: cn3d_tools.hpp:176
static const std::string REG_CACHE_MAX_SIZE
Definition: cn3d_tools.hpp:189
static const std::string REG_PROXIMAL_STEREO
Definition: cn3d_tools.hpp:199
static const std::string REG_CACHE_FOLDER
Definition: cn3d_tools.hpp:188
static const std::string REG_FAVORITES_NAME
Definition: cn3d_tools.hpp:159
static const std::string REG_QUALITY_HELIX_SIDES
Definition: cn3d_tools.hpp:178
static const std::string REG_OPENGL_FONT_SECTION
Definition: cn3d_tools.hpp:182
static const std::string REG_CACHE_ENABLED
Definition: cn3d_tools.hpp:187
#define WARNINGMSG(stream)
Definition: cn3d_tools.hpp:85
static const std::string REG_ANIMATION_SECTION
Definition: cn3d_tools.hpp:167
static const std::string REG_ADVANCED_SECTION
Definition: cn3d_tools.hpp:191
static const std::string REG_CDD_ANNOT_READONLY
Definition: cn3d_tools.hpp:192
static const std::string REG_FRAME_DELAY
Definition: cn3d_tools.hpp:170
static const std::string REG_FONT_NATIVE_FONT_INFO
Definition: cn3d_tools.hpp:184
#define WX_TO_STD(wxstring)
Definition: cn3d_tools.hpp:285
static const std::string REG_QUALITY_WORM_SEGMENTS
Definition: cn3d_tools.hpp:177
static const std::string REG_MT_DIALOG_SIZE_H
Definition: cn3d_tools.hpp:165
#define ERRORMSG(stream)
Definition: cn3d_tools.hpp:86
static const std::string NO_FAVORITES_FILE
Definition: cn3d_tools.hpp:160
static const std::string REG_STEREO_SEPARATION
Definition: cn3d_tools.hpp:198
static const std::string REG_MT_DIALOG_POS_X
Definition: cn3d_tools.hpp:162
static const std::string REG_MT_DIALOG_SIZE_W
Definition: cn3d_tools.hpp:164
static const std::string REG_CACHE_SECTION
Definition: cn3d_tools.hpp:186
static const std::string REG_SHOW_LOG_ON_START
Definition: cn3d_tools.hpp:161
Include a standard set of the NCBI C++ Toolkit most basic headers.
std::ofstream out("events_result.xml")
main entry point for tests
#define false
Definition: bool.h:36
string
Definition: cgiapp.hpp:687
#define NULL
Definition: ncbistd.hpp:225
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
Definition: ncbiobj.hpp:719
virtual const string & Get(const string &section, const string &name, TFlags flags=0) const
Get the parameter value.
Definition: ncbireg.cpp:262
IRWRegistry * Read(CNcbiIstream &is, TFlags flags=0, const string &path=kEmptyStr)
Read and parse the stream "is", and merge its content with current Registry entries.
Definition: ncbireg.cpp:605
bool Write(CNcbiOstream &os, TFlags flags=0) const
Write the registry content to output stream.
Definition: ncbireg.cpp:196
bool Set(const string &section, const string &name, const string &value, TFlags flags=0, const string &comment=kEmptyStr)
Set the configuration parameter value.
Definition: ncbireg.cpp:826
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
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 string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
Definition: ncbistr.hpp:5187
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
Definition: ncbistr.cpp:630
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
@ fConvErr_NoThrow
Do not throw an exception on error.
Definition: ncbistr.hpp:285
TSet & SetSet(void)
Select the variant.
Definition: Seq_entry_.cpp:130
const TSet & GetSet(void) const
Get the variant data.
Definition: Seq_entry_.cpp:124
bool IsSeq(void) const
Check if variant Seq is selected.
Definition: Seq_entry_.hpp:257
bool IsSet(void) const
Check if variant Set is selected.
Definition: Seq_entry_.hpp:263
const TSeq_set & GetSeq_set(void) const
Get the Seq_set member data.
TSeq & SetSeq(void)
Select the variant.
Definition: Seq_entry_.cpp:108
TSeq_set & SetSeq_set(void)
Assign a value to Seq_set data member.
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
int i
yy_size_t n
int len
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
int isalpha(Uchar c)
Definition: ncbictype.hpp:61
int toupper(Uchar c)
Definition: ncbictype.hpp:73
Process information in the NCBI Registry, including working with configuration files.
const char * command
std::istream & in(std::istream &in_, double &x_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
Modified on Thu May 23 12:25:06 2024 by modify_doxy.py rev. 669887