Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_taxonomyfile Class Reference

Use this class in order to read in a taxonomy file. More...

#include <ms_taxonomyfile.hpp>

Inheritance diagram for ms_taxonomyfile:
Collaboration diagram for ms_taxonomyfile:

Public Member Functions

 ms_taxonomyfile ()
 Default constructor.
 
 ms_taxonomyfile (const char *filename, const matrix_science::ms_connection_settings *cs=0)
 Immediate-action constructor that reads the given file on construction.
 
 ms_taxonomyfile (const ms_taxonomyfile &src)
 Copying constructor.
 
 ~ms_taxonomyfile ()
 Destructor.
 
void appendEntry (const ms_taxonomychoice *item)
 Adds a new taxonomy choice at the end of the list.
 
void appendErrors (const ms_errors &src)
 Copies all errors from another instance and appends them at the end of own list.
 
void clearAllErrors ()
 Remove all errors from the current list of errors.
 
void clearEntries ()
 Deletes all taxonomy choices from the list.
 
void copyFrom (const ms_errors *right)
 Use this member to make a copy of another instance.
 
void copyFrom (const ms_taxonomyfile *right)
 Copies all content from another instance.
 
void defaultValues ()
 Call this member if you want to start again.
 
matrix_science::ms_connection_settings getConnectionSettings () const
 Returns the sessionID and proxy server for use with an HTTP transfer.
 
ms_taxonomychoicegetEntryByName (const char *name)
 Returns a taxonomy choice entry by its name or NULL in case of not found.
 
const ms_taxonomychoicegetEntryByNumber (const int index) const
 Returns a taxonomy choice entry by its number.
 
const ms_errsgetErrorHandler () const
 Retrive the error object using this function to get access to all errors and error parameters.
 
std::string getFileName () const
 Returns a file name that is used to read the file.
 
int getLastError () const
 Return the error description of the last error that occurred.
 
std::string getLastErrorString () const
 Return the error description of the last error that occurred.
 
int getNumberOfEntries () const
 Returns a number of taxonomy choices currently held in memory.
 
bool isValid () const
 Call this function to determine if there have been any errors.
 
ms_taxonomyfileoperator= (const ms_taxonomyfile &right)
 C++ style assignment operator.
 
void read_buffer (const char *buffer)
 Reads and parses an in-memory null-terminated buffer instead of a disk file.
 
void read_file ()
 Reads configuration information from the file.
 
void save_file ()
 Stores modification information in the file.
 
void setConnectionSettings (const matrix_science::ms_connection_settings &cs)
 Sets the sessionID and proxy server for use with an http transfer.
 
void setFileName (const char *name)
 Call this member to set a custom file name to read from a different location.
 

Detailed Description

Use this class in order to read in a taxonomy file.

The list of taxonomy choices in the search form is taken from the taxonomy file. The file consists of several entries. The first line of each entry must start with the Title: keyword, followed by a text string that is used to identify the species in forms and reports. The definition should be short and self-explanatory.

To show the tree structure, indentation can be used. Unfortunately, it is not possible to use tabs or multiple spaces for indentation in an HTML form, so a full stop (period) and a space are used to indent the list. Internal spaces are significant, and there should never be two or more spaces together.

This should be followed with a definition line starting with the Include: keyword, followed by one or more numbers separated with commas. With the supplied MSDB database, and supplied taxonomy files, these numbers should be the NCBI taxonomy ID.

This should be followed with a definition line starting with the Exclude: keyword, followed by one or more numbers separated with commas. Any sequence with a taxonomy ID that passes the 'include' test may then be rejected by any entry in the exclude list.

Finally, each entry must end with a *.

Examples
config_taxonomy.cpp.

Constructor & Destructor Documentation

◆ ms_taxonomyfile()

ms_taxonomyfile ( const char *  filename,
const matrix_science::ms_connection_settings cs = 0 
)

Immediate-action constructor that reads the given file on construction.

Parameters
filenameThe file name parameter can be either a local file path or a Mascot server URL, it cannot be an empty string or NULL pointer. If it is a URL it should be of the form http://your-server/mascot/cgi .
csis a pointer to the connection settings. This should contain a sessionID and optionally the proxy server settings.

Member Function Documentation

◆ appendErrors()

void appendErrors ( const ms_errors src)
inherited

Copies all errors from another instance and appends them at the end of own list.

Parameters
srcThe object to copy the errors across from. See Maintaining object references: two rules of thumb.

◆ clearAllErrors()

void clearAllErrors ( )
inherited

Remove all errors from the current list of errors.

The list of 'errors' can include fatal errors, warning messages, information messages and different levels of debugging messages.

All messages are accumulated into a list in this object, until clearAllErrors() is called.

See Error Handling.

See also
isValid(), getLastError(), getLastErrorString(), getErrorHandler()
Examples
common_error.cpp, resfile_error.cpp, and resfile_summary.cpp.

◆ copyFrom()

void copyFrom ( const ms_errors right)
inherited

Use this member to make a copy of another instance.

Parameters
rightis the source to initialise from

◆ getConnectionSettings()

matrix_science::ms_connection_settings getConnectionSettings ( ) const

Returns the sessionID and proxy server for use with an HTTP transfer.

See also the constructor documentation and setConnectionSettings().

Returns
The current connection settings.

◆ getErrorHandler()

const ms_errs * getErrorHandler ( ) const
inherited

Retrive the error object using this function to get access to all errors and error parameters.

See Error Handling.

Returns
Constant pointer to the error handler
See also
isValid(), getLastError(), getLastErrorString(), clearAllErrors(), getErrorHandler()
Examples
common_error.cpp, and http_helper_getstring.cpp.

◆ getLastError()

int getLastError ( ) const
inherited

Return the error description of the last error that occurred.

All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.

See Error Handling.

See also
isValid(), getLastErrorString(), clearAllErrors(), getErrorHandler()
Returns
the error number of the last error, or 0 if there have been no errors.

◆ getLastErrorString()

std::string getLastErrorString ( ) const
inherited

Return the error description of the last error that occurred.

All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.

Returns
Most recent error, warning, information or debug message

See Error Handling.

See also
isValid(), getLastError(), clearAllErrors(), getErrorHandler()
Examples
common_error.cpp, config_enzymes.cpp, config_fragrules.cpp, config_license.cpp, config_mascotdat.cpp, config_masses.cpp, config_modfile.cpp, config_procs.cpp, config_quantitation.cpp, config_taxonomy.cpp, http_helper_getstring.cpp, and tools_aahelper.cpp.

◆ isValid()

bool isValid ( ) const
inherited

◆ read_buffer()

void read_buffer ( const char *  buffer)

Reads and parses an in-memory null-terminated buffer instead of a disk file.

Check for possible errors after calling this functions with isValid().

Parameters
buffera null-terminated string with taxonomies definitions.

◆ read_file()

void read_file ( )

Reads configuration information from the file.

Check for possible errors after calling this functions with isValid().

◆ setConnectionSettings()

void setConnectionSettings ( const matrix_science::ms_connection_settings cs)

Sets the sessionID and proxy server for use with an http transfer.

This value would normally be passed in the constructor.

Parameters
csIs the new connection settings.

The documentation for this class was generated from the following files: