| | |
The MonomerDictionary class provides a Monomer code dictionary allowing the user to automatically translate Monomer codes from x-letter codes to y-letter codes. For example, a monomer dictionary file can define how to translate 3-letter monomer codes to 1-letter codes. This is typically useful when working on Protein Database (PDB) file. More...
| Header: | #include <MonomerDictionary.hpp> |
| MonomerDictionary(QString file_path = QString(), const QStringList &input_chain_string_list = QStringList(), int input_code_length = -1, int output_code_length = -1) | |
| ~MonomerDictionary() | |
| bool | loadDictionary() |
| void | setFilePath(QString &file_path) |
| void | setInputChainStringList(const QStringList &input_chain_string_list) |
| void | setInputCodeLength(int code_length) |
| void | setOutputCodeLength(int code_length) |
| QStringList * | translate(const QStringList &chain_string_list = QStringList()) |
| bool | isLineProperSectionDivider(const QString &line) |
| int | parseSection(QTextStream *stream) |
| QHash<QString, QString> | m_dictionaryHash |
| bool | m_dictionaryLoaded |
| QString | m_filePath |
| QStringList | m_inputChainStringList |
| int | m_inputCodeLength |
| int | m_outputCodeLength |
The format of the dictionary file is the following:
# Converts from code on the left of '>' to code on the right. # Number of letters allowed in each code is # described with syntax 3>1 and that line should be the first # non-comment line in this file. 3>1 ALA>A CYS>C ASP>D
There might be more than one section in the file, with, for example, 3>1 translations and then 1>3 translations.
Constructs a MonomerDictionary instance.
[noexcept] MonomerDictionary::~MonomerDictionary()Destructs this MonomerDictionary instance.
[protected] bool MonomerDictionary::isLineProperSectionDivider(const QString &line)Return true if the line parsed is in the form X>Y, that is, that it specifies the kind of Monomer code translation.
Returns true if the Monomer dictionary file could be loaded successfully, false otherwise.
[protected] int MonomerDictionary::parseSection(QTextStream *stream)Parses the Monomer dictionary file section in stream and fills in the m_dictionaryHash with the translation pair.
Sets the file_path to the Monomer dictionary file.
Sets the list of input sequences to input_chain_string_list.
Set the count of letters in the input Monomer codes to code_length.
Set the count of letters in the output Monomer codes to code_length.
Perform the actual translation from the input Monomer code form to the output Monomer code form on all the strings contained in chain_string_list.
This variable holds the hash that documents the translations.
Indicates if the dictionary file has been loaded already.
Path to the file documenting the translations.
This variable holds the list of sequences to be converted.
This variable holds the count of letters in the input Monomer code.
In a dictionary file that has a section
3>1
this value would be 3.
This variable holds the count of letters in the output Monomer code.
In a dictionary file that has a section
3>1
this value would be 1.