📄 blast_setup.c
字号:
/* * =========================================================================== * PRODUCTION $Log: blast_setup.c,v $ * PRODUCTION Revision 1000.3 2004/06/01 18:07:47 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.87 * PRODUCTION * =========================================================================== *//* $Id: blast_setup.c,v 1000.3 2004/06/01 18:07:47 gouriano Exp $ * =========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software/database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software/database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * * Author: Tom Madden * *//** @file blast_setup.c * Utilities initialize/setup BLAST. */static char const rcsid[] = "$Id: blast_setup.c,v 1000.3 2004/06/01 18:07:47 gouriano Exp $";#include <algo/blast/core/blast_setup.h>#include <algo/blast/core/blast_util.h>#include <algo/blast/core/blast_filter.h>#include <algo/blast/core/blast_encoding.h>/* See description in blast_setup.h */Int2BlastScoreBlkGappedFill(BlastScoreBlk * sbp, const BlastScoringOptions * scoring_options, Uint1 program, BlastQueryInfo * query_info){ Int2 tmp_index; if (sbp == NULL || scoring_options == NULL) return 1; /* At this stage query sequences are nucleotide only for blastn */ if (program == blast_type_blastn) { /* for blastn, duplicate the ungapped Karlin structures for use in gapped alignments */ for (tmp_index = query_info->first_context; tmp_index <= query_info->last_context; tmp_index++) { if (sbp->kbp_std[tmp_index] != NULL) { Blast_KarlinBlk *kbp_gap; Blast_KarlinBlk *kbp; sbp->kbp_gap_std[tmp_index] = Blast_KarlinBlkCreate(); kbp_gap = sbp->kbp_gap_std[tmp_index]; kbp = sbp->kbp_std[tmp_index]; kbp_gap->Lambda = kbp->Lambda; kbp_gap->K = kbp->K; kbp_gap->logK = kbp->logK; kbp_gap->H = kbp->H; kbp_gap->paramC = kbp->paramC; } } } else { for (tmp_index = query_info->first_context; tmp_index <= query_info->last_context; tmp_index++) { sbp->kbp_gap_std[tmp_index] = Blast_KarlinBlkCreate(); Blast_KarlinBlkGappedCalc(sbp->kbp_gap_std[tmp_index], scoring_options->gap_open, scoring_options->gap_extend, scoring_options->decline_align, sbp->name, NULL); } } sbp->kbp_gap = sbp->kbp_gap_std; return 0;}static Int2PHIScoreBlkFill(BlastScoreBlk* sbp, const BlastScoringOptions* options, Blast_Message** blast_message){ Blast_KarlinBlk* kbp; char buffer[1024]; Int2 status = 0; sbp->read_in_matrix = TRUE; sbp->name = strdup(options->matrix); if ((status = BLAST_ScoreBlkMatFill(sbp, options->matrix_path)) != 0) return status; kbp = sbp->kbp_gap_std[0] = Blast_KarlinBlkCreate(); sbp->kbp_std = sbp->kbp_gap_std; if (0 == strcmp("BLOSUM62", options->matrix)) { kbp->paramC = 0.50; if ((11 == options->gap_open) && (1 == options->gap_extend)) { kbp->Lambda = 0.270; kbp->K = 0.047; return status; } if ((9 == options->gap_open) && (2 == options->gap_extend)) { kbp->Lambda = 0.285; kbp->K = 0.075; return status; } if ((8 == options->gap_open) && (2 == options->gap_extend)) { kbp->Lambda = 0.265; kbp->K = 0.046; return status; } if ((7 == options->gap_open) && (2 == options->gap_extend)) { kbp->Lambda = 0.243; kbp->K = 0.032; return status; } if ((12 == options->gap_open) && (1 == options->gap_extend)) { kbp->Lambda = 0.281; kbp->K = 0.057; return status; } if ((10 == options->gap_open) && (1 == options->gap_extend)) { kbp->Lambda = 0.250; kbp->K = 0.033; return status; } sprintf(buffer, "The combination %d for gap opening cost and %d for gap extension is not supported in PHI-BLAST with matrix %s\n", options->gap_open, options->gap_extend, options->matrix); Blast_MessageWrite(blast_message, BLAST_SEV_WARNING, 2, 1, buffer); } else { if (0 == strcmp("PAM30", options->matrix)) { kbp->paramC = 0.30; if ((9 == options->gap_open) && (1 == options->gap_extend)) { kbp->Lambda = 0.295; kbp->K = 0.13; return status; } if ((7 == options->gap_open) && (2 == options->gap_extend)) { kbp->Lambda = 0.306; kbp->K = 0.15; return status; } if ((6 == options->gap_open) && (2 == options->gap_extend)) { kbp->Lambda = 0.292; kbp->K = 0.13; return status; } if ((5 == options->gap_open) && (2 == options->gap_extend)) { kbp->Lambda = 0.263; kbp->K = 0.077; return status; } if ((10 == options->gap_open) && (1 == options->gap_extend)) { kbp->Lambda = 0.309; kbp->K = 0.15; return status; } if ((8 == options->gap_open) && (1 == options->gap_extend)) { kbp->Lambda = 0.270; kbp->K = 0.070; return status; } sprintf(buffer, "The combination %d for gap opening cost and %d for gap extension is not supported in PHI-BLAST with matrix %s\n", options->gap_open, options->gap_extend, options->matrix); Blast_MessageWrite(blast_message, BLAST_SEV_WARNING, 2, 1, buffer); } else { if (0 == strcmp("PAM70", options->matrix)) { kbp->paramC = 0.35; if ((10 == options->gap_open) && (1 == options->gap_extend)) { kbp->Lambda = 0.291; kbp->K = 0.089; return status; } if ((8 == options->gap_open) && (2 == options->gap_extend)) { kbp->Lambda = 0.303; kbp->K = 0.13; return status; } if ((7 == options->gap_open) && (2 == options->gap_extend)) { kbp->Lambda = 0.287; kbp->K = 0.095; return status; } if ((6 == options->gap_open) && (2 == options->gap_extend)) { kbp->Lambda = 0.269; kbp->K = 0.079; return status; } if ((11 == options->gap_open) && (1 == options->gap_extend)) { kbp->Lambda = 0.307; kbp->K = 0.13; return status; } if ((9 == options->gap_open) && (1 == options->gap_extend)) { kbp->Lambda = 0.269; kbp->K = 0.058; return status; } sprintf(buffer, "The combination %d for gap opening cost and %d for gap extension is not supported in PHI-BLAST with matrix %s\n", options->gap_open, options->gap_extend, options->matrix); Blast_MessageWrite(blast_message, BLAST_SEV_WARNING, 2, 1, buffer); } else { if (0 == strcmp("BLOSUM80", options->matrix)) { kbp->paramC = 0.40; if ((10 == options->gap_open) && (1 == options->gap_extend)) { kbp->Lambda = 0.300; kbp->K = 0.072; return status; } if ((8 == options->gap_open) && (2 == options->gap_extend)) { kbp->Lambda = 0.308; kbp->K = 0.089; return status; } if ((7 == options->gap_open) && (2 == options->gap_extend)) { kbp->Lambda = 0.295; kbp->K = 0.077; return status; } if ((6 == options->gap_open) && (2 == options->gap_extend)) { kbp->Lambda = 0.271; kbp->K = 0.051; return status; } if ((11 == options->gap_open) && (1 == options->gap_extend)) { kbp->Lambda = 0.314; kbp->K = 0.096; return status; } if ((9 == options->gap_open) && (1 == options->gap_extend)) { kbp->Lambda = 0.277; kbp->K = 0.046; return status; } sprintf(buffer, "The combination %d for gap opening cost and %d for gap extension is not supported in PHI-BLAST with matrix %s\n", options->gap_open, options->gap_extend, options->matrix); Blast_MessageWrite(blast_message, BLAST_SEV_WARNING, 2, 1, buffer); } else { if (0 == strcmp("BLOSUM45", options->matrix)) { kbp->paramC = 0.60; if ((14 == options->gap_open) && (2 == options->gap_extend)) { kbp->Lambda = 0.199; kbp->K = 0.040; return status; } if ((13 == options->gap_open) && (3 == options->gap_extend)) { kbp->Lambda = 0.209; kbp->K = 0.057; return status; } if ((12 == options->gap_open) && (3 == options->gap_extend)) { kbp->Lambda = 0.203; kbp->K = 0.049; return status; } if ((11 == options->gap_open) && (3 == options->gap_extend)) { kbp->Lambda = 0.193; kbp->K = 0.037; return status; } if ((10 == options->gap_open) && (3 == options->gap_extend)) { kbp->Lambda = 0.182; kbp->K = 0.029; return status; } if ((15 == options->gap_open) && (2 == options->gap_extend)) { kbp->Lambda = 0.206; kbp->K = 0.049; return status; } if ((13 == options->gap_open) && (2 == options->gap_extend)) { kbp->Lambda = 0.190; kbp->K = 0.032; return status; } if ((12 == options->gap_open) && (2 == options->gap_extend)) { kbp->Lambda = 0.177; kbp->K = 0.023; return status; } if ((19 == options->gap_open) && (1 == options->gap_extend)) { kbp->Lambda = 0.209; kbp->K = 0.049; return status; } if ((18 == options->gap_open) && (1 == options->gap_extend)) { kbp->Lambda = 0.202; kbp->K = 0.041; return status; } if ((17 == options->gap_open) && (1 == options->gap_extend)) { kbp->Lambda = 0.195; kbp->K = 0.034; return status; } if ((16 == options->gap_open) && (1 == options->gap_extend)) { kbp->Lambda = 0.183; kbp->K = 0.024; return status; } sprintf(buffer, "The combination %d for gap opening cost and %d for gap extension is not supported in PHI-BLAST with matrix %s\n", options->gap_open, options->gap_extend, options->matrix); Blast_MessageWrite(blast_message, BLAST_SEV_WARNING, 2, 1, buffer); } else { sprintf(buffer, "Matrix %s not allowed in PHI-BLAST\n", options->matrix); Blast_MessageWrite(blast_message, BLAST_SEV_WARNING, 2, 1, buffer); } } } } }return status;}Int2BlastScoreBlkMatrixInit(Uint1 program_number, const BlastScoringOptions* scoring_options, BlastScoreBlk* sbp){ if (!sbp || !scoring_options) return 1; if (program_number == blast_type_blastn) { BLAST_ScoreSetAmbigRes(sbp, 'N'); sbp->penalty = scoring_options->penalty; sbp->reward = scoring_options->reward; if (scoring_options->matrix_path && *scoring_options->matrix_path != NULLB && scoring_options->matrix && *scoring_options->matrix != NULLB) { sbp->read_in_matrix = TRUE; sbp->name = strdup(scoring_options->matrix); } else { char buffer[50]; sbp->read_in_matrix = FALSE; sprintf(buffer, "blastn matrix:%ld %ld", (long) sbp->reward, (long) sbp->penalty); sbp->name = strdup(buffer); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -