A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/cn3d__cache_8cpp_source.html below:

NCBI C++ ToolKit: src/app/cn3d/cn3d_cache.cpp Source File

49 #include <wx/msw/winundef.h> 52 #include <wx/datetime.h> 54 #include <wx/filename.h> 71

cacheFile.Printf(

"%s%c%i.%i"

, cachePath.c_str(), wxFILE_SEP_PATH, mmdbID, modelType);

72

cachePath = cacheFile.c_str();

74  ERRORMSG

(

"Can't get cache folder from registry"

);

82  if

(wxDirExists(cacheFolder.c_str()))

return true

;

83  bool

okay = wxMkdir(cacheFolder.c_str());

84  TRACEMSG

((okay ?

"created"

:

"failed to create"

) <<

" folder "

<< cacheFolder);

90

list < CRef < CSeq_entry > >::iterator e, ee = seqEntries.end();

91  for

(e=seqEntries.begin(); e!=ee; ++e) {

103  ERRORMSG

(

"ExtractBiostrucAndBioseqs() - expecting strucseq mime"

);

122  INFOMSG

(

"looking for "

<< mmdbID <<

" (model type "

<< (

int

) modelType <<

") in cache:"

);

130

<<

" (model type "

<< (

int

) modelType <<

") from cache: "

<< err);

135  INFOMSG

(

"loaded "

<< cacheFile);

136

wxFileName fn(cacheFile.c_str());

148  const string

& uid,

int

mmdbID,

EModel_type

modelType,

int

assemblyId = 0)

150  string

host, path, args;

152  if

(assemblyId == 0) {

155 #ifdef _USE_TEST_MMDBSRV_ 160

host =

"dev.ncbi.nlm.nih.gov"

;

161

path =

"/Structure/pdbtest/mmdb/mmdbsrv.cgi"

;

164

host =

"www.ncbi.nlm.nih.gov"

;

165

path =

"/Structure/mmdb/mmdbsrv.cgi"

;

168

args =

"save=Save&dopt=j&uid="

;

173

args +=

"&Complexity="

;

179

args +=

"2"

;

break

;

184

args +=

"&sanitize=0"

;

186 #ifdef _USE_TEST_MMDBSRV_ 195

host =

"www.ncbi.nlm.nih.gov"

;

196

path =

"/Structure/mmdb/mmdb_strview.cgi"

;

197

args =

"program=cn3d&display=1&uid="

;

202

args +=

"&complexity="

;

209

args +=

"2"

;

break

;

215  INFOMSG

(

"Trying to load structure data from "

<< host << path <<

'?'

<< args);

220

!mime->IsStrucseq()) {

221  ERRORMSG

(

"Failed to read structure "

<< uid <<

" from network\nreason: "

<< err);

227  if

(mime->GetStrucseq().GetStructure().GetId().front()->IsMmdb_id())

228

mmdbID = mime->GetStrucseq().GetStructure().GetId().front()->GetMmdb_id().Get();

230  ERRORMSG

(

"Can't get MMDB ID from Biostruc!"

);

240  INFOMSG

(

"stored "

<< mmdbID <<

" (model type "

<< (

int

) modelType <<

") in cache"

);

246  WARNINGMSG

(

"Failed to write structure to cache folder"

);

247  if

(err.size() > 0)

WARNINGMSG

(

"reason: "

<< err);

259  if

(uid.size() == 4 && (

isalpha

((

unsigned char

) uid[1]) ||

isalpha

((

unsigned char

) uid[2]) ||

isalpha

((

unsigned char

) uid[3]))) {

263  if

(wxString(uid.c_str()).ToULong(&

tmp

)) {

266  ERRORMSG

(

"LoadStructureViaCache() - invalid uid "

<< uid);

269  TRACEMSG

(

"Fetching MMDB "

<< mmdbID);

303

!wxDirExists(cacheFolder.c_str())) {

307  INFOMSG

(

"truncating cache to "

<< maxSize <<

" MB"

);

309

wxString cacheFolderFiles;

310

cacheFolderFiles.Printf(

"%s%c*"

, cacheFolder.c_str(), wxFILE_SEP_PATH);

315  while

((

f

=wxFindFirstFile(cacheFolderFiles, wxFILE)).

size

() > 0) {

316  if

(!wxRemoveFile(

f

))

323  unsigned long

totalSize = 0;

324

wxString oldestFileName;

329  if

(totalSize > 0 && !wxRemoveFile(oldestFileName))

330  WARNINGMSG

(

"can't remove file "

<< oldestFileName);

334

time_t oldestFileDate = wxDateTime::GetTimeNow(), date;

335

wxString

file

= wxFindFirstFile(cacheFolderFiles, wxFILE);

336  for

(;

file

.size() > 0;

file

= wxFindNextFile()) {

337

date = wxFileModificationTime(

file

);

338  if

(date < oldestFileDate) {

339

oldestFileDate = date;

340

oldestFileName =

file

;

342

wxFile wx_file(

file

, wxFile::read);

343  if

(wx_file.IsOpened()) {

344

totalSize += wx_file.Length();

349  INFOMSG

(

"total size: "

<< totalSize <<

" oldest file: "

<< oldestFileName.c_str());

351

}

while

(totalSize > maxSize * 1024 * 1024);

User-defined methods of the data storage class.

User-defined methods of the data storage class.

User-defined methods of the data storage class.

User-defined methods of the data storage class.

bool GetAsnDataViaHTTPS(const std::string &host, const std::string &path, const std::string &args, ASNClass *asnObject, std::string *err, bool binaryData=true)

void TruncateCache(unsigned int maxSize)

static CNcbi_mime_asn1 * GetStructureFromCacheFolder(int mmdbID, EModel_type modelType)

bool ExtractBiostrucAndBioseqs(CNcbi_mime_asn1 &mime, CRef< CBiostruc > &biostruc, BioseqRefList *sequences)

static CNcbi_mime_asn1 * GetStructureViaHTTPAndAddToCache(const string &uid, int mmdbID, EModel_type modelType, int assemblyId=0)

static string GetCacheFilePath(int mmdbID, EModel_type modelType)

static void ExtractBioseqs(list< CRef< CSeq_entry > > &seqEntries, BioseqRefList *sequences)

static bool CreateCacheFolder(void)

CNcbi_mime_asn1 * LoadStructureViaCache(const std::string &uid, ncbi::objects::EModel_type modelType, int assemblyId)

std::list< ncbi::CRef< ncbi::objects::CBioseq > > BioseqRefList

Include a standard set of the NCBI C++ Toolkit most basic headers.

static bool ReadASNFromFile(const char *filename, ASNClass *ASNobject, bool isBinary, std::string *err)

static bool WriteASNToFile(const char *filename, const ASNClass &ASNobject, bool isBinary, std::string *err, ncbi::EFixNonPrint fixNonPrint=ncbi::eFNP_Default)

EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)

Set the threshold severity for posting the messages.

@ eDiag_Info

Informational message.

@ eDiag_Fatal

Fatal error – guarantees exit(or abort)

TObjectType * GetPointer(void) THROWS_NONE

Get pointer,.

void Reset(void)

Reset reference object.

bool NotEmpty(void) const THROWS_NONE

Check if CRef is not empty – pointing to an object and has a non-null value.

TObjectType * Release(void)

Release a reference to the object and return a pointer to the object.

#define END_SCOPE(ns)

End the previously defined scope.

#define BEGIN_SCOPE(ns)

Define a new scope.

static string IntToString(int value, TNumToStringFlags flags=0, int base=10)

Convert int to string.

EModel_type

Access to EModel_type's attributes (values, names) as defined in spec.

@ eModel_type_ncbi_all_atom

@ eModel_type_ncbi_backbone

@ eModel_type_ncbi_vector

void SetStructure(TStructure &value)

Assign a value to Structure data member.

TStrucseq & SetStrucseq(void)

Select the variant.

bool IsStrucseq(void) const

Check if variant Strucseq is selected.

TSequences & SetSequences(void)

Assign a value to Sequences data member.

unsigned int

A callback function used to compare two keys in a database.

const struct ncbi::grid::netcache::search::fields::SIZE size


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4