NCBI C++ ToolKit
raw_scoremat.h
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef UTIL_TABLES___SCOREMAT__H
2 #define UTIL_TABLES___SCOREMAT__H
3 
4 /* $Id: raw_scoremat.h 72643 2016-05-19 16:29:22Z ucko $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Author: Aaron Ucko
30  *
31  */
32 
33 /** @file scoremat.h
34  ** Protein alignment score matrices; shared between the two toolkits.
35  **/
36 
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 /** data types */
44 
45 typedef int TNCBIScore; /* historically signed char */
46 typedef struct SNCBIPackedScoreMatrix {
47  const char* symbols; /**< order of residues */
48  const TNCBIScore* scores; /**< strlen(symbols) x strlen(symbols) */
49  TNCBIScore defscore; /**< score for unknown residues */
51 
52 /** Map a standard residue code into an index suitable for a particular
53  ** packed score matrix. Calling this function is not as fast as working
54  ** with unpacked matrices, but avoids the overhead of producing them.
55  ** @param sm
56  ** Packed score matrix of interest.
57  ** @param aa
58  ** Standard amino acid code; may be either NCBIstdaa or case-insensitive
59  ** NCBIeaa (which are conveniently disjoint), modulo gaps in coverage.
60  ** (The standard built-in matrices don't cover O or U.)
61  ** @return
62  ** The corresponding index into sm, or -1 if it doesn't cover AA.
63  **/
64 extern NCBI_TABLES_EXPORT
65 int NCBISM_GetIndex(const SNCBIPackedScoreMatrix* sm, int aa);
66 
67 /** Look up an entry in a packed score matrix. Calling this function is
68  ** not as fast as working with unpacked matrices, but avoids the overhead
69  ** of producing them.
70  ** @param sm
71  ** Packed score matrix of interest.
72  ** @param aa1, aa2
73  ** Standard amino acid code; may be either NCBIstdaa or case-insensitive
74  ** NCBIeaa (which are conveniently disjoint), modulo gaps in coverage.
75  ** (The standard built-in matrices don't cover O or U.)
76  ** @return
77  ** The corresponding score (or the matrix's default if it doesn't cover
78  ** both residues).
79  **/
80 extern NCBI_TABLES_EXPORT
82  int aa1, int aa2);
83 
84 /** Recommended approach: unpack and index directly. */
85 #define NCBI_FSM_DIM 128
86 typedef struct SNCBIFullScoreMatrix {
89 
90 /** Expand a packed score matrix into an unpacked one, which callers can
91  ** proceed to index directly by standard residue values (NCBIstdaa or
92  ** case-insensitive NCBIeaa, which are conveniently disjoint) modulo gaps
93  ** in coverage, for which the unpacked matrix will hold the packed one's
94  ** default score. (The standard built-in matrices don't cover O or U.)
95  ** @param sm
96  ** Packed score matrix to expand.
97  ** @param fsm
98  ** Storage for the resulting full score matrix.
99  **/
100 extern NCBI_TABLES_EXPORT
101 void NCBISM_Unpack(const SNCBIPackedScoreMatrix* psm,
102  SNCBIFullScoreMatrix* fsm);
103 
104 /** The standard matrices. */
114 
115 extern NCBI_TABLES_EXPORT
116 const SNCBIPackedScoreMatrix* NCBISM_GetStandardMatrix(const char* name);
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif /* UTIL_TABLES___SCOREMAT__H */
#define NCBI_TABLES_EXPORT
Definition: tables_export.h:80
const SNCBIPackedScoreMatrix NCBISM_Pam30
Definition: sm_pam30.c:92
const SNCBIPackedScoreMatrix NCBISM_Blosum62
Definition: sm_blosum62.c:92
int NCBISM_GetIndex(const SNCBIPackedScoreMatrix *sm, int aa)
Map a standard residue code into an index suitable for a particular packed score matrix.
Definition: raw_scoremat.c:51
const SNCBIPackedScoreMatrix NCBISM_Pam250
Definition: sm_pam250.c:92
const SNCBIPackedScoreMatrix NCBISM_Blosum50
Definition: sm_blosum50.c:92
#define NCBI_FSM_DIM
Recommended approach: unpack and index directly.
Definition: raw_scoremat.h:85
const SNCBIPackedScoreMatrix NCBISM_Blosum80
Definition: sm_blosum80.c:92
struct SNCBIFullScoreMatrix SNCBIFullScoreMatrix
const SNCBIPackedScoreMatrix * NCBISM_GetStandardMatrix(const char *name)
Definition: raw_scoremat.c:131
TNCBIScore NCBISM_GetScore(const SNCBIPackedScoreMatrix *sm, int aa1, int aa2)
Look up an entry in a packed score matrix.
Definition: raw_scoremat.c:67
void NCBISM_Unpack(const SNCBIPackedScoreMatrix *psm, SNCBIFullScoreMatrix *fsm)
Expand a packed score matrix into an unpacked one, which callers can proceed to index directly by sta...
Definition: raw_scoremat.c:81
const SNCBIPackedScoreMatrix NCBISM_Pam70
Definition: sm_pam70.c:92
struct SNCBIPackedScoreMatrix SNCBIPackedScoreMatrix
const SNCBIPackedScoreMatrix NCBISM_Blosum45
The standard matrices.
Definition: sm_blosum45.c:92
const SNCBIPackedScoreMatrix NCBISM_Identity
Definition: sm_identity.c:92
const SNCBIPackedScoreMatrix NCBISM_Blosum90
Definition: sm_blosum90.c:92
int TNCBIScore
data types
Definition: raw_scoremat.h:45
TNCBIScore s[128][128]
Definition: raw_scoremat.h:87
const TNCBIScore * scores
strlen(symbols) x strlen(symbols)
Definition: raw_scoremat.h:48
TNCBIScore defscore
score for unknown residues
Definition: raw_scoremat.h:49
const char * symbols
order of residues
Definition: raw_scoremat.h:47
Modified on Thu May 23 12:33:30 2024 by modify_doxy.py rev. 669887