NCBI C++ ToolKit
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
CSeqDBAliasSets Class Reference

Search Toolkit Book for CSeqDBAliasSets

CSeqDBAliasSets class. More...

#include "seqdbalias.hpp"
(Private to src/objtools/blast/seqdb_reader.)

+ Collaboration diagram for CSeqDBAliasSets:

Public Member Functions

 CSeqDBAliasSets (CSeqDBAtlas &atlas)
 Constructor. More...
 
bool ReadAliasFile (const CSeqDB_Path &dbpath, const char **bp, const char **ep, CSeqDBLockHold &locked)
 Read an alias file given the path. More...
 
bool FindAliasPath (const CSeqDB_Path &dbpath, CSeqDB_Path *resolved, CSeqDBLockHold &locked)
 Resolve the alias file path. More...
 
bool FindBlastDBPath (const CSeqDB_Path &dbname, CSeqDB_Path &resolved)
 Find a file given a partial path and name. More...
 
bool FindBlastDBPath (const CSeqDB_BasePath &dbname, char dbtype, CSeqDB_BasePath &resolved)
 Find a file given a partial path and name. More...
 

Private Types

typedef map< string, stringTAliasGroup
 Aggregated alias file - maps filename to file contents. More...
 
typedef map< string, TAliasGroupTAliasGroupMap
 Full index filename to aggregated alias file. More...
 

Private Member Functions

bool x_FindBlastDBPath (const string &dbname, char dbtype, bool exact, string &resolved)
 Find a file given a partial path and name. More...
 
void x_DbToIndexName (const CSeqDB_Path &fname, CSeqDB_Path &index_name, CSeqDB_FileName &alias_name)
 Find the path of a group index from an alias file name. More...
 
void x_ReadAliasSetFile (const CSeqDB_Path &group_fname, CSeqDBLockHold &locked)
 Read the contents of the group alias file. More...
 
CSeqDBAliasSetsoperator= (const CSeqDBAliasSets &)
 Disable copy operator. More...
 
 CSeqDBAliasSets (const CSeqDBAliasSets &)
 Disable copy constructor. More...
 

Private Attributes

CSeqDBAtlasm_Atlas
 Reference to the memory management layer. More...
 
TAliasGroupMap m_Groups
 Alias groups. More...
 
map< string, stringm_PathLookup
 Caches results of FindBlastDBPath. More...
 

Detailed Description

CSeqDBAliasSets class.

This acts as a layer between the alias processing code and the atlas code in the case where a combined alias is used. It intercepts calls to find and use individual alias files and uses combined alias files instead.

Definition at line 229 of file seqdbalias.hpp.

Member Typedef Documentation

◆ TAliasGroup

Aggregated alias file - maps filename to file contents.

Definition at line 385 of file seqdbalias.hpp.

◆ TAliasGroupMap

Full index filename to aggregated alias file.

Definition at line 388 of file seqdbalias.hpp.

Constructor & Destructor Documentation

◆ CSeqDBAliasSets() [1/2]

CSeqDBAliasSets::CSeqDBAliasSets ( CSeqDBAtlas atlas)
inline

Constructor.

Definition at line 232 of file seqdbalias.hpp.

◆ CSeqDBAliasSets() [2/2]

CSeqDBAliasSets::CSeqDBAliasSets ( const CSeqDBAliasSets )
private

Disable copy constructor.

Member Function Documentation

◆ FindAliasPath()

bool CSeqDBAliasSets::FindAliasPath ( const CSeqDB_Path dbpath,
CSeqDB_Path resolved,
CSeqDBLockHold locked 
)

Resolve the alias file path.

Given a partial path and name designating a particular db alias file, this method finds the absolute path of the group index file for that alias file, or if that is not found, the individual alias file.

Parameters
dbpathThe path to the file. [in]
resolvedThe resolved path is returned here. [out]
lockedThe lock holder object for this thread. [in]
Returns
True if the path was found.

Definition at line 206 of file seqdbalias.cpp.

References FindBlastDBPath(), CSeqDB_Path::FindDirName(), CSeqDB_FileName::GetFileNameSub(), ReadAliasFile(), and x_DbToIndexName().

Referenced by CSeqDBAliasNode::x_ExpandAliases(), and CSeqDBAliasNode::x_ResolveNames().

◆ FindBlastDBPath() [1/2]

bool CSeqDBAliasSets::FindBlastDBPath ( const CSeqDB_BasePath dbname,
char  dbtype,
CSeqDB_BasePath resolved 
)
inline

Find a file given a partial path and name.

Given a path designating a particular disk file, this method finds the absolute path of that file. The filename is assumed to not contain an extension. Instead, the user indicates the type of database (p or n) and the function will search for that kind of database volume or alias file ('pin' or 'pal' for protein, 'nin' or 'nal' for nucleotide.)

Parameters
dbnameThe partial path to the file. [in]
dbtypeThe type of sequences used. [in]
resolvedThe resolved path is returned here. [out]
lockedThe lock holder object for this thread. [in]
Returns
True if the path was found.

Definition at line 316 of file seqdbalias.hpp.

References CSeqDB_BasePath::Assign(), and dbname().

◆ FindBlastDBPath() [2/2]

bool CSeqDBAliasSets::FindBlastDBPath ( const CSeqDB_Path dbname,
CSeqDB_Path resolved 
)
inline

Find a file given a partial path and name.

Given a path designating a particular disk file, this method finds the absolute path of that file. The filename is assumed to contain the correct extension.

Parameters
dbnameThe partial path to the file, with extension. [in]
resolvedThe resolved path is returned here. [out]
lockedThe lock holder object for this thread. [in]
Returns
True if the path was found.

Definition at line 285 of file seqdbalias.hpp.

References CSeqDB_Path::Assign(), and dbname().

Referenced by FindAliasPath(), CSeqDBAliasNode::x_ExpandAliases(), and CSeqDBAliasNode::x_ResolveNames().

◆ operator=()

CSeqDBAliasSets& CSeqDBAliasSets::operator= ( const CSeqDBAliasSets )
private

Disable copy operator.

◆ ReadAliasFile()

bool CSeqDBAliasSets::ReadAliasFile ( const CSeqDB_Path dbpath,
const char **  bp,
const char **  ep,
CSeqDBLockHold locked 
)

Read an alias file given the path.

This finds an alias file, or an equivalent section of a group alias file, given a filename. The contents of the file (or of the corresponding part of the group file) are returned as a pair of pointers to the start and end of the buffer stored in the string that contains this data. This code triggers the parsing of the entire group alias file if it exists and has not hithereto been read. Group alias files could replace individual alias files, but at the moment, both will always be present. If the group alias file does exist, it is assumed to be authoritative and complete.

Parameters
dbpathThe name of the alias file (if it exists).
bpThe start of the alias file contents. [out]
epThe end of the alias file contents. [out]
lockedThe lock holder object for this thread. [in]
Returns
True if an alias file (or equivalent data) was found.

Definition at line 595 of file seqdbalias.cpp.

References _ASSERT, CSeqDBAtlas::DoesFileExist(), map_checker< Container >::end(), map_checker< Container >::find(), CSeqDB_FileName::GetFileNameS(), CSeqDB_Path::GetPathS(), m_Atlas, m_Groups, x_DbToIndexName(), and x_ReadAliasSetFile().

Referenced by FindAliasPath(), and CSeqDBAliasNode::x_ReadAliasFile().

◆ x_DbToIndexName()

void CSeqDBAliasSets::x_DbToIndexName ( const CSeqDB_Path fname,
CSeqDB_Path index_name,
CSeqDB_FileName alias_name 
)
private

Find the path of a group index from an alias file name.

This method takes the path of an alias file as input. The filename is extracted and returned in alias_name. The name of the associated group index file is computed and returned in index_path. This consists of the directory of the alias file combined with the standard group index filename.

Parameters
fnameLocation of the individual alias file. [in]
index_nameLocation of the group index file. [out]
alias_nameFilename portion of the alias file. [out]

Definition at line 451 of file seqdbalias.cpp.

References CSeqDB_FileName::Assign(), CSeqDB_Path::FindFileName(), kSeqDBGroupAliasFileName, and CSeqDB_Path::ReplaceFilename().

Referenced by FindAliasPath(), and ReadAliasFile().

◆ x_FindBlastDBPath()

bool CSeqDBAliasSets::x_FindBlastDBPath ( const string dbname,
char  dbtype,
bool  exact,
string resolved 
)
private

Find a file given a partial path and name.

Given a path designating a particular disk file, this method finds the absolute path of that file. The user indicates the type of database (p or n) to find appropriate extensions for index or alias files, or specifies exact=true if the filename already has the correct extension. Before the filesystem is consulted, however, the m_PathLookup map is checked to see if an answer to this query already exists.

Parameters
dbnameThe partial path to the file. [in]
dbtypeThe type of sequences in the DB. [in]
exactSpecify true if dbname contains the extension. [in]
resolvedThe resolved path is returned here. [out]
lockedThe lock holder object for this thread. [in]
Returns
True if the path was found.

Definition at line 182 of file seqdbalias.cpp.

References dbname(), map_checker< Container >::empty(), map_checker< Container >::end(), map_checker< Container >::find(), i, m_Atlas, m_PathLookup, and SeqDB_FindBlastDBPath().

◆ x_ReadAliasSetFile()

void CSeqDBAliasSets::x_ReadAliasSetFile ( const CSeqDB_Path group_fname,
CSeqDBLockHold locked 
)
private

Read the contents of the group alias file.

This reads a group alias file. The individual alias file contents are stored in m_Groups, but are not parsed yet.

Parameters
group_fnameThe filename for the group file. [in]
lockedThe lock holder object for this thread. [in]

Definition at line 546 of file seqdbalias.cpp.

References CSeqDBFileMemMap::GetFileDataPtr(), CSeqDBAtlas::GetFileSizeL(), CSeqDB_Path::GetPathS(), i, ncbi::grid::netcache::search::fields::key, m_Atlas, m_Groups, NCBI_THROW, NStr::NumericToString(), s_SeqDB_FindOffsets(), s_SeqDB_ReadLine(), and value.

Referenced by ReadAliasFile().

Member Data Documentation

◆ m_Atlas

CSeqDBAtlas& CSeqDBAliasSets::m_Atlas
private

Reference to the memory management layer.

Definition at line 382 of file seqdbalias.hpp.

Referenced by ReadAliasFile(), x_FindBlastDBPath(), and x_ReadAliasSetFile().

◆ m_Groups

TAliasGroupMap CSeqDBAliasSets::m_Groups
private

Alias groups.

Definition at line 391 of file seqdbalias.hpp.

Referenced by ReadAliasFile(), and x_ReadAliasSetFile().

◆ m_PathLookup

map<string, string> CSeqDBAliasSets::m_PathLookup
private

Caches results of FindBlastDBPath.

Definition at line 394 of file seqdbalias.hpp.

Referenced by x_FindBlastDBPath().


The documentation for this class was generated from the following files:
Modified on Sun Mar 03 03:14:13 2024 by modify_doxy.py rev. 669887