Debian Codegraph @

interfaces/ncbi/ncbi.vschema

raw
1 /*===========================================================================
2 *
3 * PUBLIC DOMAIN NOTICE
4 * National Center for Biotechnology Information
5 *
6 * This software/database is a "United States Government Work" under the
7 * terms of the United States Copyright Act. It was written as part of
8 * the author's official duties as a United States Government employee and
9 * thus cannot be copyrighted. This software/database is freely available
10 * to the public for use. The National Library of Medicine and the U.S.
11 * Government have not placed any restriction on its use or reproduction.
12 *
13 * Although all reasonable efforts have been taken to ensure the accuracy
14 * and reliability of the software and data, the NLM and the U.S.
15 * Government do not and cannot warrant the performance or results that
16 * may be obtained by using this software or data. The NLM and the U.S.
17 * Government disclaim all warranties, express or implied, including
18 * warranties of performance, merchantability or fitness for any particular
19 * purpose.
20 *
21 * Please cite the author in any work or product based on this material.
22 *
23 * ===========================================================================
24 *
25 */
26
27 /*==========================================================================
28 * VDB Schema intrinsic types and functions
29 */
30 version 1;
31
32 include 'vdb/vdb.vschema';
33 include 'insdc/insdc.vschema';
34
35
36 /*--------------------------------------------------------------------------
37 * data types
38 */
39
40 // N-encoded phred has values limited to 1..63 and 0 used for N
41 typedef INSDC:quality:phred NCBI:quality:n_encoded:phred;
42 // N-encoded log-odds has values limite to -5..40 and -6 for N
43 typedef INSDC:quality:log_odds NCBI:quality:n_encoded:log_odds;
44
45 // these types have been restated
46 alias INSDC:dna:text INSDC:fasta;
47 alias INSDC:2na:packed INSDC:dna:2na;
48 alias INSDC:2na:packed NCBI:2na;
49 alias INSDC:2cs:packed INSDC:color:2cs;
50 alias INSDC:2cs:packed NCBI:2cs;
51 alias INSDC:quality:phred NCBI:qual1;
52 alias NCBI:quality:n_encoded:phred NCBI:SRA:enc_qual1;
53
54 // 16-bit integer sample data
55 typedef I16 NCBI:isamp1, NCBI:isamp4 [ 4 ];
56
57 // 32-bit floating point sample data
58 typedef F32 NCBI:fsamp1, NCBI:fsamp4 [ 4 ];
59
60 // ASN.1
61 typedef B8 NCBI:asn:binary;
62 typedef ascii NCBI:asn:text;
63
64 // GenInfo id - 64 bit because we are almost out of 32 bit ids
65 typedef U64 NCBI:gi;
66
67 // Taxonomy id
68 typedef U32 NCBI:taxid;
69
70 // Genbank status
71 typedef U32 NCBI:gb_state;
72
73
74 /*--------------------------------------------------------------------------
75 * formats
76 * many of these formats are older than the current corresponding vdb fmts
77 */
78
79 fmtdef merged_t;
80 fmtdef fp_encoded_t;
81 fmtdef rl_encoded_t;
82 fmtdef NCBI:zlib_encoded_t;
83 fmtdef NCBI:fp_encoded_t;
84
85
86 /*--------------------------------------------------------------------------
87 * functions
88 */
89
90
91 /* merge
92 * split
93 * the original versions of these functions
94 * used a slightly different format giving them
95 * a different signature from their vdb counterparts.
96 *
97 * here to maintain backward compatibility for
98 * column schema functions
99 */
100 extern function
101 merged_t NCBI:merge #1.0 ( any in, ... );
102
103 extern function
104 any NCBI:split #1.0 < U32 idx > ( merged_t in )
105 = vdb:split;
106
107
108 /* cut
109 * paste
110 * these have no compiler type-checking
111 */
112 extern function
113 any NCBI:cut #1.0 < U32 idx, ... > ( any in )
114 = vdb:cut;
115
116 extern function
117 any NCBI:paste #1.0 ( any in, ... )
118 = vdb:paste;
119
120
121 /* pack
122 * unpack
123 * wildcard typed
124 */
125 extern function
126 any NCBI:pack #1.0 < U32 from, U32 to > ( any in );
127
128 extern function
129 any NCBI:unpack #1.0 < U32 from, U32 to > ( any in );
130
131
132 /* fp_decode
133 * OBSOLETE
134 * here to handle anything encoded with fp_encode
135 */
136 extern function
137 any NCBI:fp_decode #1.0 ( fp_encoded_t in );
138
139
140 /* fp_extend
141 * OBSOLETE
142 * here to handle anything encoded with fp_truncate
143 */
144 extern function
145 any NCBI:fp_extend #1.0 < U32 bits > ( NCBI:fp_encoded_t in );
146
147
148 /* run_length_encode
149 * run_length_decode
150 */
151 extern function
152 rl_encoded_t NCBI:run_length_encode #1.0 ( any in )
153 = vdb:rlencode;
154
155 extern function
156 any NCBI:run_length_decode #1.0 ( rl_encoded_t in )
157 = vdb:rldecode;
158
159
160 /* zlib
161 * unzip
162 * variation on the formatting
163 */
164 extern function
165 NCBI:zlib_encoded_t NCBI:zlib #1.0 < * I32 strategy, I32 level > ( any in )
166 = vdb:zip;
167
168 extern function
169 any NCBI:unzip #1.0 ( NCBI:zlib_encoded_t in );
170
171
172 /* zlib_huffman_compress
173 * invokes zlib in huffman + rle mode
174 */
175 schema function
176 NCBI:zlib_encoded_t NCBI:zlib_huffman_compress #1.0 ( any in )
177 {
178 // named as Huffman, but apply RLE as well
179 return NCBI:zlib < Z_RLE > ( in );
180 }
181
182 /* zlib_compress
183 * standard zlib
184 */
185 schema function
186 NCBI:zlib_encoded_t NCBI:zlib_compress #1.0 ( any in )
187 {
188 return NCBI:zlib < Z_DEFAULT_STRATEGY > ( in );
189 }
190
191 /* zlib_decompress
192 * alternate name for unzip
193 */
194 alias NCBI:unzip NCBI:zlib_decompress;