(
doubleNum)
91 return((
int)(Num + 0.5));
93 return((
int)(Num - 0.5));
101score =
Round(((
double) (matrix->
matrix[pssmIndex][4] + matrix->
matrix[pssmIndex][13])) / 2);
104score =
Round(((
double) (matrix->
matrix[pssmIndex][5] + matrix->
matrix[pssmIndex][15])) / 2);
107score = matrix->
matrix[pssmIndex][3];
110score = matrix->
matrix[pssmIndex][10];
113score =
Round(((
double) (matrix->
matrix[pssmIndex][9] + matrix->
matrix[pssmIndex][11])) / 2);
116score = matrix->
matrix[pssmIndex][blRes];
128 staticChar2UChar charMap;
130 if(charMap.size() == 0) {
135Char2UChar::const_iterator
n= charMap.find(
toupper((
unsigned char)
r));
136 if(
n!= charMap.end())
139 returncharMap.find(
'X')->second;
146 ERROR_MESSAGE(
"LookupCharacterFromNCBIStdaaNumber() - valid values are 0 - 27");
155 PTHROW(
"FillInAlignmentData() - data array size mismatch");
160 unsigned int b,
row,
column, masterStart, masterWidth, slaveStart, slaveWidth, left=0,
middle=0;
170range->
to< range->
from- 1 ||
171range->
from!= ((
b== 0) ? 0 : (
blocks[
b- 1]->GetRangeOfRow(0)->to + 1)) ||
173 PTHROW(
"FillInAlignmentData() - master range error");
174masterStart = range->
from;
175masterWidth = range->
to- range->
from+ 1;
180 if(range->
from< 0 || range->
from> (
int)seq->
Length() || range->
to< -1 || range->
to>= (
int)seq->
Length() ||
181range->
to< range->
from- 1 ||
182range->
from!= ((
b== 0) ? 0 : (
blocks[
b- 1]->GetRangeOfRow(
row)->to + 1)) ||
183(
b==
blocks.size() - 1 && range->
to!= (
int)seq->
Length() - 1))
184 PTHROW(
"FillInAlignmentData() - slave range error");
185slaveStart = range->
from;
186slaveWidth = range->
to- range->
from+ 1;
192 if(slaveWidth == masterWidth) {
200 if(slaveWidth > masterWidth) {
205 if(
column>= masterWidth - slaveWidth) {
218 else if(
b==
blocks.size() - 1) {
220 if(slaveWidth > masterWidth) {
225 if(
column< slaveWidth) {
238 else if(slaveWidth < masterWidth) {
240left = (slaveWidth + 1) / 2;
241middle = masterWidth - slaveWidth;
246 else if(
column< left + middle)
256left = (masterWidth + 1) / 2;
274 staticCharDoubleMap standardProbabilities;
276 if(standardProbabilities.size() == 0) {
278 ERROR_MESSAGE(
"GetStandardProbability() - confused by BLASTAA_SIZE != 28");
282 for(
unsigned int i=0;
i<28; ++
i) {
289CharDoubleMap::const_iterator
f= standardProbabilities.find(
toupper((
unsigned char) ch));
290 if(
f!= standardProbabilities.end())
292 WARNING_MESSAGE(
"GetStandardProbability() - unknown residue character "<< ch);
299 doubleinfoContent = 0.0;
302ColumnProfile profile;
303ColumnProfile::iterator p, pe;
310 for(
unsigned intc=0; c<
data->dimensions->query_length; ++c) {
316 for(
unsigned int r=(ignoreMaster ? 1 : 0);
r<=
data->dimensions->num_seqs; ++
r) {
317 if(
data->data[
r][c].letter != gap) {
318p = profile.find(
data->data[
r][c].letter);
319 if(p == profile.end())
320profile[
data->data[
r][c].letter] = 1;
329ofs <<
"column "<< (c+1) <<
", total "<< nRes;
330 doublecolumnContent = 0.0;
334 static const doubleln2 =
log(2.0), threshhold = 0.0001;
335 for(p=profile.begin(), pe=profile.end(); p!=pe; ++p) {
337 if(expFreq > threshhold) {
338 doubleobsFreq = 1.0 * p->second / nRes,
339freqRatio = obsFreq / expFreq;
340 if(freqRatio > threshhold) {
341infoContent += obsFreq *
log(freqRatio) / ln2;
344columnContent += obsFreq *
log(freqRatio) / ln2;
347<< setprecision(3) << (obsFreq *
log(freqRatio) / ln2);
354ofs <<
", sum info: "<< setprecision(6) << columnContent <<
'\n';
402ofs <<
"information content: "<< setprecision(6) << infoContent <<
'\n' 446 PTHROW(
"ConvertPSSMToBLASTMatrix() - pssm must have finalData");
449 PTHROW(
"ConvertPSSMToBLASTMatrix() - bad matrix size");
461 ERROR_MESSAGE(
"ConvertPSSMToBLASTMatrix() - missing Kappa");
465 unsigned int i,
r= 0, c = 0;
467 for(
i=0;
i<nScores; ++
i, ++s) {
494ofs <<
"matrix->is_prot: "<< (
int) matrix->
is_prot<<
'\n' 495<<
"matrix->name: "<< (matrix->
name? matrix->
name:
"(none)") <<
'\n' 496<<
"matrix->rows: "<< matrix->
rows<<
'\n' 497<<
"matrix->columns: "<< matrix->
columns<<
'\n';
498 for(
r=0; (
int)r<matrix->rows; ++
r) {
500ofs << matrix->
matrix[
r][c] <<
' ';
534}
catch(exception& e) {
535 ERROR_MESSAGE(
"CreateBlastMatrix() failed with exception: "<< e.what());
548 matrix[
i] =
new int[nColumns];
553 for(
int i=0;
i<
rows; ++
i)
Contains C++ wrapper classes to structures in algo/blast/core as well as some auxiliary functions to ...
#define sfree(x)
Safe free a pointer: belongs to a higher level header.
Declarations of static arrays used to define some NCBI encodings to be used in a toolkit independent ...
PSIBlastOptions * PSIBlastOptionsFree(PSIBlastOptions *psi_options)
Deallocate PSI BLAST options.
Int2 PSIBlastOptionsNew(PSIBlastOptions **psi_options)
Initialize default options for PSI BLAST.
PSIMsa * PSIMsaFree(PSIMsa *msa)
Deallocates the PSIMsa structure.
PSIMsa * PSIMsaNew(const PSIMsaDimensions *dimensions)
Allocates and initializes the multiple sequence alignment data structure for use as input to the PSSM...
#define BLAST_SCORE_MIN
minimum allowed score (for one letter comparison).
double * BLAST_GetStandardAaProbabilities(void)
Get the standard amino acid probabilities.
#define WARNING_MESSAGE(s)
BLAST_Matrix(int nRows, int nColumns)
const Sequence * GetMaster(void) const
const Sequence * GetSequenceOfRow(unsigned int row) const
unsigned int NRows(void) const
void GetBlockList(ConstBlockList &cbl) const
std::vector< ncbi::CConstRef< Block > > ConstBlockList
const Range * GetRangeOfRow(int row) const
Computes a PSSM as specified in PSI-BLAST.
unsigned int masterLength
const PSIDiagnosticsRequest * GetDiagnosticsRequest(void)
Obtain the diagnostics data that is requested from the PSSM engine Its results will be populated in t...
PSIMsa * GetData(void)
Obtain the multiple sequence alignment structure.
PSIDiagnosticsRequest diag
PSIBlastOptions * options
SU_PSSMInput(const BlockMultipleAlignment *b)
unsigned char * GetQuery(void)
Get the query sequence used as master for the multiple sequence alignment in ncbistdaa encoding.
const char * GetMatrixName(void)
Obtain the name of the underlying matrix to use when building the PSSM.
unsigned int GetQueryLength(void)
Get the query's length.
void Process(void)
Algorithm to produce multiple sequence alignment structure should be implemented in this method.
const BlockMultipleAlignment * bma
unsigned char * masterNCBIStdaa
const PSIBlastOptions * GetOptions(void)
Obtain the options for the PSSM engine.
std::string m_sequenceString
unsigned int Length(void) const
Include a standard set of the NCBI C++ Toolkit most basic headers.
std::ofstream out("events_result.xml")
main entry point for tests
static const char * column
static const column_t columns[]
CRef< objects::CPssmWithParameters > Run()
Runs the PSSM engine to compute the PSSM.
#define BLASTAA_SIZE
Size of aminoacid alphabet.
@ eNoOwnership
No ownership is assumed.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
TNumRows GetNumRows(void) const
Get the NumRows member data.
bool IsSetFinalData(void) const
Final representation for the PSSM Check if a value has been assigned to FinalData data member.
TKappa GetKappa(void) const
Get the Kappa member data.
const TScores & GetScores(void) const
Get the Scores member data.
TIsProtein GetIsProtein(void) const
Get the IsProtein member data.
const TFinalData & GetFinalData(void) const
Get the FinalData member data.
TNumColumns GetNumColumns(void) const
Get the NumColumns member data.
TByRow GetByRow(void) const
Get the ByRow member data.
bool IsSetKappa(void) const
Karlin & Altschul parameter produced during the PSSM's calculation Check if a value has been assigned...
const TPssm & GetPssm(void) const
Get the Pssm member data.
unsigned int
A callback function used to compare two keys in a database.
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
C++ API for the PSI-BLAST PSSM engine.
Defines interface for a sequence alignment processor that can populate a multiple alignment data stru...
#define row(bind, expected)
Abstract base class to encapsulate the source(s) and pre-processing of PSSM input data as well as opt...
Options used in protein BLAST only (PSI, PHI, RPS and translated BLAST) Some of these possibly should...
Boolean nsg_compatibility_mode
Compatibility option for the NCBI's structure group (note nsg_ prefix, stands for NCBI's structure gr...
double impala_scaling_factor
Scaling factor as used in IMPALA to do the matrix rescaling.
double inclusion_ethresh
Minimum evalue for inclusion in PSSM calculation.
Int4 pseudo_count
Pseudocount constant.
Boolean use_best_alignment
If set to TRUE, use the best alignment when multiple HSPs are found in a query-subject alignment (i....
Structure to allow requesting various diagnostics data to be collected by PSSM engine.
Boolean information_content
request information content
Boolean frequency_ratios
request frequency ratios
Boolean weighted_residue_frequencies
request observed weighted residue frequencies
Boolean gapless_column_weights
request gapless column weights
Boolean residue_frequencies
request observed residue frequencies
Structure to describe the characteristics of a position in the multiple sequence alignment data struc...
Boolean is_aligned
Is this letter part of the alignment?
Uint1 letter
Preferred letter at this position, in ncbistdaa encoding.
Structure representing the dimensions of the multiple sequence alignment data structure.
Uint4 num_seqs
Number of distinct sequences aligned with the query (does not include the query)
Uint4 query_length
Length of the query.
Multiple sequence alignment (msa) data structure containing the raw data needed by the PSSM engine to...
PSIMsaCell ** data
actual data, dimensions are (dimensions->num_seqs+1) by (dimensions->query_length)
PSIMsaDimensions * dimensions
dimensions of the msa
static DP_BlockInfo * blocks
static int Round(double Num)
unsigned char LookupNCBIStdaaNumberFromCharacter(char r)
double GetStandardProbability(char ch)
BLAST_Matrix * CreateBlastMatrix(const BlockMultipleAlignment *bma)
static const string NCBIStdaaResidues("-ABCDEFGHIKLMNPQRSTVWXYZU*OJ")
static double CalculateInformationContent(const PSIMsa *data, bool ignoreMaster)
int GetPSSMScoreOfCharWithAverageOfBZ(const BLAST_Matrix *matrix, unsigned int pssmIndex, char resChar)
static void FillInAlignmentData(const BlockMultipleAlignment *bma, PSIMsa *data)
char LookupCharacterFromNCBIStdaaNumber(unsigned char n)
static BLAST_Matrix * ConvertPSSMToBLASTMatrix(const CPssmWithParameters &pssm)
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