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/gumbel__params_8cpp_source.html below:

NCBI C++ ToolKit: src/algo/blast/gumbel_params/gumbel_params.cpp Source File

62  const

vector<double>& seq1_probs,

63  const

vector<double>& seq2_probs)

75

: m_GapOpening(options.m_GapOpening),

76

m_GapExtension(options.m_GapExtension),

77

m_LambdaAccuracy(options.m_LambdaAccuracy),

78

m_KAccuracy(options.m_KAccuracy),

79

m_ScoreMatrix(options.m_ScoreMatrix),

80

m_Seq1ResidueProbs(options.m_Seq1ResidueProbs),

81

m_Seq2ResidueProbs(options.m_Seq2ResidueProbs),

82

m_NumResidues(options.m_NumResidues),

83

m_MaxCalcTime(options.m_MaxCalcTime),

84

m_MaxCalcMemory(options.m_MaxCalcMemory)

94  "Length of residue probabilities for both sequences do " 100  "Length of residue probabilities does not match number " 104  double

sum_probs_seq1 = 0.0;

108  "Negative probability value for sequence 1"

);

110

sum_probs_seq1 += *it;

112  if

(

fabs

(1.0 - sum_probs_seq1) > 1e-10) {

114  "The sum of probability values does not equal 1"

);

117  double

sum_probs_seq2 = 0.0;

121  "Negative probability value for sequence 2"

);

123

sum_probs_seq2 += *it;

125  if

(

fabs

(1.0 - sum_probs_seq2) > 1e-10) {

127  "The sum of probability values does not equal 1"

);

132  "Negative gap opening penalty"

);

137  "Negative gap extention penalty"

);

142  "Non-positive accuracy for lambda"

);

147  "Non-positive accuracy for K"

);

152  "Non-positive max calc time"

);

157  "Non-positive maximum memory"

);

162  "Gap opening or extension too large"

);

169  "Score matrix entry too large"

);

177  if

(m_LambdaAccuracy < 0.001 || m_LambdaAccuracy > 0.01) {

178  m_Messages

.push_back(

"The algorithm is designed for lambda accuracy" 179  " between 0.001 -- 0.01. Values outside this range" 180  " may cause increased bias or variance of" 181  " estimated parameter lambda"

);

185  if

(m_KAccuracy < 0.005 || m_KAccuracy > 0.05) {

186  m_Messages

.push_back(

"The algorithm is designed for K accuracy" 187  " between 0.005 -- 0.05. Values outside this range" 188  " may cause increased bias or variance of" 189  " estimated parameter K"

);

195  m_Messages

.push_back(

"The maximum calculation time may be too small" 196  " and lead to inaccurate results. The suggested" 197  " maximum calculation time is at least 1s."

);

202  m_Messages

.push_back(

"The maximum allowed memory may be too small" 203  " and lead to inaccurate results. The suggsets" 204  " maximum allowed memory is at least 1Mb"

);

245  const size_t

kNumResidues = 20;

251

probs[ 0 ] = 0.07805 ;

252

probs[ 1 ] = 0.05129 ;

253

probs[ 2 ] = 0.04487 ;

254

probs[ 3 ] = 0.05364 ;

255

probs[ 4 ] = 0.01925 ;

256

probs[ 5 ] = 0.04264 ;

257

probs[ 6 ] = 0.06295 ;

258

probs[ 7 ] = 0.07377 ;

259

probs[ 8 ] = 0.02199 ;

260

probs[ 9 ] = 0.05142 ;

261

probs[ 10 ] = 0.09019 ;

262

probs[ 11 ] = 0.05744 ;

263

probs[ 12 ] = 0.02243 ;

264

probs[ 13 ] = 0.03856 ;

265

probs[ 14 ] = 0.05203 ;

266

probs[ 15 ] = 0.0712 ;

267

probs[ 16 ] = 0.05841 ;

268

probs[ 17 ] = 0.0133 ;

269

probs[ 18 ] = 0.03216 ;

270

probs[ 19 ] = 0.06441 ;

311

: m_Options(options), m_RandParams(rand)

315 template

<

typename

T>

318  out

.resize(

in

.size());

326  Int4

number_of_aa = -1;

330  double

current_time1;

331  double

current_time2;

332

Sls::alp_data::get_current_time(current_time1);

343  double

gapless_time_portion = 0.5;

347  const double

* background_probabilities1

350  const double

* background_probabilities2

358

gapless_calc_time *= gapless_time_portion;

361

Njn::LocalMaxStatMatrix local_max_stat_matrix(number_of_aa,

363

background_probabilities1,

364

background_probabilities2,

368  if

(local_max_stat_matrix.getTerminated()) {

369  throw

Sls::error(

"Please increase maximum allowed calculation time."

,

374  double

calculation_error = 1e-6;

376

gumbel_params.

gapless_alpha

= local_max_stat_matrix.getAlpha();

379

gumbel_params.

gapless_a

= local_max_stat_matrix.getA();

387

gumbel_params.

lambda

= local_max_stat_matrix.getLambda ();

390

gumbel_params.

K

= local_max_stat_matrix.getK ();

391

gumbel_params.

K_error

= calculation_error;

393

gumbel_params.

C

= local_max_stat_matrix.getC ();;

394

gumbel_params.

C_error

= calculation_error;

406

gumbel_params.

ai_error

= calculation_error;

409

gumbel_params.

aj_error

= calculation_error;

411

Sls::alp_data::get_current_time(current_time2);

412  result

->SetCalcTime(current_time2 - current_time1);

418

sbs_arrays.

K_sbs

.resize(2);

419

sbs_arrays.

K_sbs

[0]=gumbel_params.

K

;

420

sbs_arrays.

K_sbs

[1]=gumbel_params.

K

+calculation_error;

422

sbs_arrays.

C_sbs

.resize(2);

423

sbs_arrays.

C_sbs

[0]=gumbel_params.

C

;

424

sbs_arrays.

C_sbs

[1]=gumbel_params.

C

+calculation_error;

428

sbs_arrays.

sigma_sbs

[1]=gumbel_params.

sigma

+ calculation_error;

438

sbs_arrays.

ai_sbs

.resize(2);

439

sbs_arrays.

ai_sbs

[0]=gumbel_params.

ai

;

440

sbs_arrays.

ai_sbs

[1]=gumbel_params.

ai

+ calculation_error;

442

sbs_arrays.

aj_sbs

.resize(2);

443

sbs_arrays.

aj_sbs

[0]=gumbel_params.

aj

;

444

sbs_arrays.

aj_sbs

[1]=gumbel_params.

aj

+ calculation_error;

457  double

current_time_gapless_preliminary;

458

Sls::alp_data::get_current_time(current_time_gapless_preliminary);

459  double

gapless_preliminary_time =

460

current_time_gapless_preliminary - current_time1;

465

data_obj.d_max_time =

466

Sls::alp_data::Tmax((1.0 - gapless_time_portion)

467

* data_obj.d_max_time,data_obj.d_max_time

468

- gapless_preliminary_time);

470

Sls::alp_sim sim_obj(&data_obj);

474

gumbel_params.

lambda

= sim_obj.m_Lambda;

477

gumbel_params.

K

= sim_obj.m_K;

478

gumbel_params.

K_error

= sim_obj.m_KError;

480

gumbel_params.

C

= sim_obj.m_C;

481

gumbel_params.

C_error

= sim_obj.m_CError;

483

gumbel_params.

sigma

= sim_obj.m_Sigma;

486

gumbel_params.

alpha_i

= sim_obj.m_AlphaI;

489

gumbel_params.

alpha_j

= sim_obj.m_AlphaJ;

492

gumbel_params.

ai

= sim_obj.m_AI;

493

gumbel_params.

ai_error

= sim_obj.m_AIError;

495

gumbel_params.

aj

= sim_obj.m_AJ;

496

gumbel_params.

aj_error

= sim_obj.m_AJError;

498

Sls::alp_data::get_current_time(current_time2);

499  result

->SetCalcTime(current_time2 - current_time1);

517

sim_obj.d_alp_data->d_rand_all->d_random_factor);

519

vector<Int4>& fsprelim_numbers

523

->d_first_stage_preliminary_realizations_numbers_ALP,

526

vector<Int4>& prelim_numbers

530

->d_preliminary_realizations_numbers_ALP,

533

vector<Int4>& prelim_numbers_killing

537

->d_preliminary_realizations_numbers_killing,

538

prelim_numbers_killing);

541

->d_total_realizations_number_with_ALP);

544

sim_obj.d_alp_data->d_rand_all

545

->d_total_realizations_number_with_killing);

549  catch

(Sls::error er) {

551  switch

(er.error_code) {

553

(

string

)

"Time or memory limit exceeded."

);

556

(

string

)

"The program could not estimate the " 557  "parameters. Please repeat calculation"

);

560

(

string

)

"Results cannot be computed for the " 561  "provided parameters. "

+ er.st);

564

(

string

)

"Memory allocation error"

);

568

(

string

)

"Unexpected error"

);

Score matrix that can take any value.

Int4 GetScore(Uint4 i, Uint4 j) const

Get score matrix entry for at specified position.

unsigned int GetNumResidues(void) const

Get number of residues.

EScoreMatrixName

Names of standard scoring matrices.

CRef< CGumbelParamsResult > m_Result

CConstRef< CGumbelParamsOptions > m_Options

CRef< CGumbelParamsResult > Run(void)

Perform Gumbel parameter calculation.

CRef< CGumbelParamsRandDiagnostics > m_RandParams

CGumbelParamsCalc(const CRef< CGumbelParamsOptions > &opts)

Create calculation object with given options.

static CRef< CGumbelParamsOptions > CreateStandard20AAOptions(CGeneralScoreMatrix::EScoreMatrixName smat=CGeneralScoreMatrix::eBlosum62)

Creates standard options with score matrix and residue frequenceis for 20 aa alphabet.

static CRef< CGumbelParamsOptions > CreateBasicOptions(void)

Creates standard options with no score matrix or resiudie frequencies.

Input parameters for Gumbel parameters calculation.

void SetSeq2ResidueProbs(const TFrequencies &probs)

Set residue probabilities for sequence 2.

void SetLambdaAccuracy(double lambda_err)

Set relative error threshold for lambda parameter calculation for gapped aligmment.

bool Validate(void)

Validate parameter values.

const TFrequencies & GetSeq2ResidueProbs(void) const

Get sequence 2 residue probabilities.

CGumbelParamsOptions(void)

Create empty options object.

bool m_IsGapped

Gapped/gapless regime, true for gapped, false for gapless.

void SetGapExtension(Int4 g_exten)

Set gap extention penalty.

vector< double > TFrequencies

const TFrequencies & GetSeq1ResidueProbs(void) const

Get sequence 1 residue probabilities.

CConstRef< CGeneralScoreMatrix > m_ScoreMatrix

Scoring matrix.

void SetGapped(bool gapped)

Set gapped/gapless regime.

double m_KAccuracy

Desired accuracy for parameter K computation only for gapped alignment.

void SetMaxCalcTime(double time)

Set maximum calculation time allowed.

double m_MaxCalcTime

Maximum allowed calculation time.

double GetMaxCalcTime(void) const

Get maximum calculation time allowed.

double m_MaxCalcMemory

Maximum allowed calculation memory.

void SetKAccuracy(double k_err)

Set relative error threshold for K parameter calculation for gapped alignment.

Int4 m_GapOpening

Gap opening penalty.

Int4 GetGapOpening(void) const

Get gap opening penalty.

Int4 GetNumResidues(void) const

Get number of residues in utilized alphabet.

bool GetGapped(void) const

Get gapped/gapless regime.

const Int4 ** GetScoreMatrix(void) const

Get score matrix.

void SetGapOpening(Int4 g_open)

Set the value of gap opening penalty.

Int4 m_NumResidues

Number of residues in alphabet.

void SetMaxCalcMemory(double mem)

Set maximum memory allowed for computation.

void SetScoreMatrix(const CGeneralScoreMatrix &smatrix)

Set score matrix.

TFrequencies m_Seq2ResidueProbs

Residue frequencies for sequence 2.

void SetSeq1ResidueProbs(const TFrequencies &probs)

Set residue probabilities for sequence 1.

Int4 GetGapExtension(void) const

Get gap extention penalty.

double m_LambdaAccuracy

Desired accuracy for lambda computation only for gapped aligmment.

vector< string > m_Messages

Warning messages.

Int4 m_GapExtension

Gap extension penalty.

TFrequencies m_Seq1ResidueProbs

Residue frequencies for sequence 1.

Options that control random values used in internal parts of Gumbel parameter calculation for gapped ...

vector< Int4 > & SetPrelimReNumbers(void)

Set preliminary realizations numbers.

vector< Int4 > & SetFirstStagePrelimReNumbers(void)

Set first stage preliminary realizations numbers.

void SetTotalReNumber(Int4 num)

Set total realizations number.

void SetRandomSeed(Uint4 val)

Set random seed.

void SetTotalReNumberKilling(Int4 num)

Set total realizations number killing.

vector< Int4 > & SetPrelimReNumbersKilling(void)

Set perliminary realizations numbers killing array.

Result of Gumbel parameters calculation along with diagnostic info.

std::ofstream out("events_result.xml")

main entry point for tests

#define ITERATE(Type, Var, Cont)

ITERATE macro to sequence through container elements.

#define NCBI_THROW(exception_class, err_code, message)

Generic macro to throw an exception, given the exception class, error code and message string.

TObjectType * GetNonNullPointer(void)

Get pointer value and throw a null pointer exception if pointer is null.

void Reset(void)

Reset reference object.

void Reset(void)

Reset reference object.

bool Empty(void) const THROWS_NONE

Check if CRef is empty – not pointing to any object, which means having a null value.

int32_t Int4

4-byte (32-bit) signed integer

uint32_t Uint4

4-byte (32-bit) unsigned integer

static void s_CopyVector(const vector< T > &in, vector< T > &out)

std::istream & in(std::istream &in_, double &x_)

void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)

static const char * kMaxScore

vector< double > lambda_sbs

vector< double > alpha_i_sbs

vector< double > sigma_sbs

vector< double > alpha_j_sbs

Gumbel parameters and estimation errors.

double gapless_alpha_error


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