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 * NCBI Sequence Read Archive schema
29 */
30version 1;
31
32include 'vdb/vdb.vschema';
33include 'ncbi/seq.vschema';
34include 'ncbi/spotname.vschema';
35include 'insdc/sra.vschema';
36include 'ncbi/stats.vschema';
37
38
39/*--------------------------------------------------------------------------
40 * types
41 */
42
43
44/* Segment - DEPRECATED
45 *  a ( start, len ) pair where start is a zero-based, unsigned coordinate
46 */
47typedef U16 NCBI:SRA:Segment [ 2 ];
48
49
50/* SpotDesc - DEPRECATED
51 *   uint16_t spot_len;
52 *   uint16_t fixed_len;
53 *   uint16_t signal_len;
54 *   uint16_t clip_qual_right;
55 *   uint8_t num_reads;
56 *   uint8_t align [ 7 ];
57 */
58typedef B8 NCBI:SRA:SpotDesc [ 16 ];
59
60
61/* ReadDesc - DEPRECATED
62 *   SRASegment { uint16_t start, len; } seg;
63 *   uint8_t type;
64 *   char cs_key;
65 *   char label [ 74 ];
66 */
67typedef B8 NCBI:SRA:ReadDesc [ 80 ];
68
69
70// some types have been moved to INSDC
71alias INSDC:SRA:platform_id NCBI:SRA:platform_id;
72alias INSDC:SRA:read_type NCBI:SRA:read_type;
73alias INSDC:SRA:read_filter NCBI:SRA:read_filter;
74
75typedef NCBI:fsamp4 NCBI:SRA:rotated_fsamp4, NCBI:SRA:swapped_fsamp4;
76
77// 16-bit POSITION type
78typedef U16 NCBI:SRA:pos16;
79
80
81/*--------------------------------------------------------------------------
82 * functions
83 */
84
85/* bio_start
86 *  searches through read_type vector
87 *  returns the 0-based starting coordinate of first biological read
88 *
89 *  "read_start" [ DATA ] - vector of read start coordinates
90 *
91 *  "read_type" [ DATA ] - vector of read types
92 */
93extern function INSDC:coord:zero
94    NCBI:SRA:bio_start #1 ( INSDC:coord:zero read_start, INSDC:SRA:xread_type read_type );
95
96
97/* bio_end
98 *  searcehes through read_type vector
99 *  returns the 0 based ending coording (either inclusive or exclusive) of last
100 *  biological read
101 *
102 *  "read_start" [ DATA ] - vector of read start coordinates
103 *
104 *  "read_type" [ DATA ] - vector of read types
105 *
106 *  "read_len" [ DATA ] - vector of read lengths
107 */
108extern function INSDC:coord:zero
109    NCBI:SRA:bio_end #1 < bool inclusive > ( INSDC:coord:zero read_start, INSDC:SRA:xread_type read_type, INSDC:coord:len read_len );
110
111
112/* fix_read_seg
113 */
114extern function INSDC:coord:len [ 2 ]
115    NCBI:SRA:fix_read_seg #1 ( U16 [ 2 ] rd_seg, INSDC:coord:len spot_len );
116
117
118/* make_spot_desc
119 *  assembles several bits of information together into a "C" structure
120 *
121 *  "spot_len" [ DATA ] - computed spot length value
122 *
123 *  "fixed_len" [ DATA, DFLT ZERO ] - the stated fixed length of all spots
124 *  or zero if not fixed length
125 *
126 *  "sig_len" [ DATA, DFLT ZERO ] - the length of signal/intensity data
127 *  or zero if not present
128 *
129 *  "trim_start" [ DATA ] - the first base included in the trim segment
130 *
131 *  "trim_len" [ DATA ] - the length of the trim segment
132 *
133 *  "num_reads" [ DATA ] - 1..n value
134 */
135extern function NCBI:SRA:SpotDesc NCBI:SRA:make_spot_desc #1 ( INSDC:coord:len spot_len,
136    INSDC:coord:len fixed_len,  INSDC:coord:len sig_len, INSDC:coord:zero trim_start,
137    INSDC:coord:len trim_len, U8 num_reads );
138
139
140/* make_read_desc
141 *  assembles several bits of information together into a "C" structure
142 *  in theory resultant segments may intersect other read segments or leave holes in spot.
143 *
144 *  "num_reads" [ DATA ] - value indicating the resulting row-length of output
145 *
146 *  "read_start" [ DATA ] - ordered starting coordinates for each read
147 *  not required to be sequential.
148 *
149 *  "read_len" [ DATA ] - ordered lengths of each read. may be zero when
150 *  read has been described but is not identified in spot.
151 *
152 *  "read_type" [ DATA ] - ordered type id describing each read
153 *
154 *  "read_filt" [ DATA ] - ordered read filters
155 *
156 *  "cs_key" [ DATA ] - ordered color-space keys
157 *
158 *  "label_start" [ DATA ] - ordered starting coordinates for each label
159 *  "label_len" [ DATA ] - ordered lengths of each label
160 *
161 *  "label" [ DATA ] - complete sequence of label characters, possibly empty
162 *  individual read labels are identified as {start,len} pairs
163 */
164extern function NCBI:SRA:ReadDesc NCBI:SRA:make_read_desc #1 ( U8 num_reads,
165    INSDC:coord:zero read_start, INSDC:coord:len read_len, INSDC:SRA:xread_type read_type,
166    INSDC:SRA:read_filter read_filt, INSDC:dna:text cs_key,
167    INSDC:coord:zero label_start, INSDC:coord:len label_len, ascii label );
168
169
170/* rotate
171 *  rotate a quadruple by called base
172 *  now normally replaced by swap
173 *
174 *  "T" [ TYPE ] - element type of quadruple to be rotated
175 *
176 *  "encoding" [ CONST ] - when true, rotate input left until corresponding
177 *  element is in slot 0. when false, rotate input right to restore original
178 *  order.
179 *
180 *  "in" [ DATA ] - data to be rotated, qualities, signal, intensities...
181 *
182 *  "called" [ DATA ] - {0..3} or {0..4} binary representation of called bases or colors
183 */
184extern function < type T >
185T NCBI:SRA:rotate #1 < bool encoding > ( T in, U8 called );
186
187
188/* swap
189 *  swap element 0 and the called element
190 *  used to ensure that the called element is in slot 0
191 *
192 *  "T" [ TYPE ] - element type of quadruple to be swapped
193 *
194 *  "in" [ DATA ] - data to be swapped, qualities, signal, intensities...
195 *
196 *  "called" [ DATA ] - {0..3} or {0..4} binary representation of called bases or colors
197 */
198extern function < type T >
199T NCBI:SRA:swap #1 ( T in, U8 called );
200
201
202/* normalize
203 * denormalize
204 *
205 *  "T" [ TYPE ] - element type of quadruple to be [de]normalized
206 *
207 *  "intensity" [ DATA ] - intensity data
208 *
209 *  "called" [ DATA ] - {0..3} or {0..4} binary representation of called bases or colors
210 */
211extern function < type T >
212T NCBI:SRA:normalize #1 ( T intensity, U8 called );
213
214extern function < type T >
215T NCBI:SRA:denormalize #1 ( T intensity, U8 called );
216
217
218/* make_position
219 *  return a synthesized position row with 1-1 correspondence
220 *
221 *  "T" [ TYPE ] - position type being generated
222 *
223 *  "start" [ CONST ] - either 0 or 1, depending upon the coordinate system
224 *
225 *  "bases" [ DATA ] - the actual row of bases. the output row
226 *  will be the same length, but with synthesized data
227 */
228extern function < type T >
229T NCBI:SRA:make_position #1 < T start > ( any bases );
230
231/* fsamp4 compression
232 *  performs compression individually
233 *  on called channel and alternate channels
234 */
235function NCBI:SRA:swapped_fsamp4 NCBI:SRA:fsamp4:decode #2 ( merged_fmt in )
236{
237    fzip_fmt cmp0 = split < 0 > ( in );
238    fzip_fmt cmp123 = split < 1 > ( in );
239    F32 ch0 = funzip ( cmp0 );
240    F32 ch123a = funzip ( cmp123 );
241    F32[3] ch123 = redimension ( ch123a );
242    return ( NCBI:SRA:swapped_fsamp4 ) < F32 > paste ( ch0, ch123 );
243}
244
245function merged_fmt NCBI:SRA:fsamp4:encode #2 < U32 called, U32 alt > ( NCBI:SRA:swapped_fsamp4 in )
246{
247    F32 ch0 = < F32 > cut < 0 > ( in );
248    F32[3] ch123 = < F32 > cut < 1, 2, 3 > ( in );
249    fzip_fmt cmp0 = fzip < called > ( ch0 );
250    F32 ch123a = redimension ( ch123 );
251    fzip_fmt cmp123 = fzip < alt > ( ch123a );
252    return merge ( cmp0, cmp123 );
253}
254
255
256/*--------------------------------------------------------------------------
257 * spotdesc
258 *  NCBI implementation productions
259 */
260
261/* history:
262 *  1.0.1 - base explicitly upon sequence #1.0.1, spotdesc #1.0.1
263 *  1.0.2 - spotdesc #1.0.2
264 */
265table NCBI:SRA:tbl:spotdesc_nocol #1.1 = INSDC:tbl:sequence #1.0.1, INSDC:SRA:tbl:spotdesc #1.0.2
266{
267    /* LABEL_SEG
268     */
269    readonly column NCBI:SRA:Segment LABEL_SEG
270        = out_label_seg
271        | cast ( out_label_seg32 )
272        | cast ( _out_label_seg32 );
273    U32 _out_label_startU32 = ( U32 ) out_label_start;
274    U32 [ 2 ] _out_label_seg32 = < U32 > paste ( _out_label_startU32, out_label_len );
275
276
277    /* READ_SEG
278     */
279    readonly column NCBI:SRA:Segment READ_SEG
280        = out_read_seg
281        | cast ( out_read_seg32 )
282        | cast ( _out_read_seg32 );
283    U32 _out_read_startU32 = ( U32 ) out_read_start;
284    U32 [ 2 ] _out_read_seg32 = < U32 > paste ( _out_read_startU32, out_read_len );
285
286
287    /* READ_DESC
288     */
289    readonly column NCBI:SRA:ReadDesc READ_DESC
290        = NCBI:SRA:make_read_desc ( out_nreads, out_read_start, out_read_len,
291              out_read_type, _out_rd_filter, out_cs_key, _out_label_start, _out_label_len, _out_label );
292    INSDC:SRA:read_filter _out_rd_filter
293        = out_rd_filter
294        | < INSDC:SRA:read_filter > echo < SRA_READ_FILTER_PASS > ( out_read_start );
295    ascii _out_label
296        = out_label
297        | < ascii > echo < '' > ();
298    INSDC:coord:zero _out_label_start
299        = out_label_start
300        | < INSDC:coord:zero > echo < 0 > ( out_read_start );
301    INSDC:coord:len _out_label_len
302        = out_label_len
303        | < INSDC:coord:len > echo < 0 > ( out_read_start );
304
305    /* SPOT_DESC
306     */
307    readonly column NCBI:SRA:SpotDesc SPOT_DESC
308        = NCBI:SRA:make_spot_desc ( spot_len, fixed_spot_len, signal_len,
309              trim_start, trim_len, out_nreads );
310
311    /* SIGNAL_LEN
312     *  normally the same as spot length when present,
313     *  but in some cases ( e.g. 454 ) it may be different
314     */
315    readonly column INSDC:coord:len SIGNAL_LEN
316        = signal_len;
317    readonly column U16 SIGNAL_LEN
318        = cast ( signal_len );
319
320
321	/* INSDC:SRA:tbl:spotdesc inherited productions
322	 *  trim_len
323	 *  out_label
324	 *  out_nreads
325	 *  trim_start
326	 *  out_read_len
327	 *  out_label_len
328	 *  out_rd_filter
329	 *  out_read_type
330	 *  out_read_start
331	 *  out_label_start
332	 *  static_fixed_spot_len
333	 */
334
335	/* NCBI:SRA:tbl:spotdesc_nocol productions
336	 *  out_read_seg
337	 *  out_label_seg
338	 *  out_read_seg32
339	 *  out_label_seg32
340	 */
341};
342
343/* history:
344 *  1.0.1 - base explicitly upon spotdesc_nocol #1.0.1
345 *  1.0.2 - base explicitly upon spotdesc_nocol #1.0.2
346 *  1.1 - base explicitly upon spotdesc_nocol #1.1
347 */
348table NCBI:SRA:tbl:spotdesc_nophys #1.1 = NCBI:SRA:tbl:spotdesc_nocol #1.1
349{
350    // resolve virtual productions
351    U8 out_nreads = .NREADS;
352    ascii out_label = .LABEL;
353    INSDC:SRA:xread_type out_read_type = .READ_TYPE;
354    INSDC:SRA:read_filter out_rd_filter  = .RD_FILTER;
355    INSDC:SRA:spot_filter out_spot_filter = .SPOT_FILTER;
356
357    INSDC:coord:zero out_label_start
358        = .LABEL_START
359        | ( INSDC:coord:zero ) < U32 > cut < 0 > ( out_label_seg32 );
360    INSDC:coord:len out_label_len
361        = .LABEL_LEN
362        | ( INSDC:coord:len ) < U32 > cut < 1 > ( out_label_seg32 );
363    U32 [ 2 ] out_label_seg32
364        = cast ( .LABEL_SEG );
365
366    INSDC:coord:zero out_read_start
367        = .READ_START
368        | ( INSDC:coord:zero ) < U32 > cut < 0 > ( out_read_seg32 );
369    INSDC:coord:len out_read_len
370        = .READ_LEN
371        | ( INSDC:coord:len ) < U32 > cut < 1 > ( out_read_seg32 );
372    U32 [ 2 ] out_read_seg32
373        = NCBI:SRA:fix_read_seg ( .READ_SEG, spot_len );
374
375
376	/* INSDC:SRA:tbl:spotdesc inherited productions
377	 *  trim_len
378	 *  trim_start
379	 *  out_read_type
380	 *  static_fixed_spot_len
381	 */
382
383	/* NCBI:SRA:tbl:spotdesc_nocol inherited productions
384	 *  out_read_seg
385	 *  out_label_seg
386	 */
387
388	/* NCBI:SRA:tbl:spotdesc_nophys productions
389	 *  .LABEL
390	 *  .NREADS
391	 *  .READ_LEN
392	 *  .READ_SEG
393	 *  .LABEL_LEN
394	 *  .LABEL_SEG
395	 *  .RD_FILTER
396	 *  .READ_TYPE
397	 *  .READ_START
398	 *  .LABEL_START
399	 */
400}
401
402/* history:
403 *  1.0.1 - base explicitly upon spotdesc_nophys #1.0.1
404 *  1.0.2 - base explicitly upon spotdesc_nophys #1.0.2
405 *  1.1 - base explicitly upon spotdesc_nophys #1.1
406 */
407table NCBI:SRA:tbl:spotdesc #1.1 = NCBI:SRA:tbl:spotdesc_nophys #1.1
408{
409    // physical column encodings
410    // TBD - this has to be looked at, where dynamic segmentation is involved
411    physical column < U8 > zip_encoding .NREADS = NREADS;
412    physical column < ascii > zip_encoding .LABEL = LABEL;
413    physical column < INSDC:coord:zero > izip_encoding .LABEL_START = LABEL_START;
414    physical column < INSDC:coord:len > izip_encoding .LABEL_LEN = LABEL_LEN;
415    physical column < INSDC:coord:zero > izip_encoding .READ_START = in_read_start;
416    physical column < INSDC:coord:len > izip_encoding .READ_LEN = in_read_len;
417    physical column < INSDC:SRA:xread_type > zip_encoding .READ_TYPE = in_read_type;
418    physical column < INSDC:SRA:read_filter > zip_encoding .RD_FILTER = in_read_filter;
419    physical column < INSDC:SRA:spot_filter > zip_encoding .SPOT_FILTER = in_spot_filter;
420
421
422	/* INSDC:SRA:tbl:spotdesc inherited productions
423	 *  trim_len
424	 *  trim_start
425	 *  out_read_type
426	 *  static_fixed_spot_len
427	 */
428
429	/* NCBI:SRA:tbl:spotdesc_nocol inherited productions
430	 *  out_read_seg
431	 *  out_label_seg
432	 */
433};
434
435
436/*--------------------------------------------------------------------------
437 * pos
438 *  synthetic POSITION column on read
439 *
440 * history:
441 *  1.0.1 - base explicitly upon sequence #1.0.1
442 */
443
444table NCBI:SRA:tbl:pos #1.0.1 = INSDC:tbl:sequence #1.0.1
445{
446    INSDC:position:one out_position
447        = < INSDC:position:one > NCBI:SRA:make_position < 1 > ( out_2na_packed )
448        | < INSDC:position:one > NCBI:SRA:make_position < 1 > ( out_2cs_packed );
449    NCBI:SRA:pos16 out_position16
450        = < NCBI:SRA:pos16 > NCBI:SRA:make_position < 1 > ( out_2na_packed )
451        | < NCBI:SRA:pos16 > NCBI:SRA:make_position < 1 > ( out_2cs_packed );
452};
453
454
455/*--------------------------------------------------------------------------
456 * sra
457 *  the NCBI SRA table
458 */
459
460/* history:
461 *  1.0.1 - base explicitly upon sra #1.0.1
462 *  1.0.2 - base explicitly upon sra #1.0.2, spotdesc_nocol #1.0.1
463 *  1.0.3 - base explicitly upon sra #1.0.3, spotdesc_nocol #1.0.2
464 *  1.0.4 - base explicitly upon sra #1.0.4
465 */
466table NCBI:SRA:tbl:sra_nopos #1.0.4 = INSDC:SRA:tbl:sra #1.0.4, NCBI:SRA:tbl:spotdesc_nocol #1.0.2
467{
468    // v1 declares the POSITION column for all tables
469    // but leaves all physical columns unstated
470
471    /* POSITION
472     *  1-based coordinates
473     *  describes a base's position on signal
474     */
475    column INSDC:position:one POSITION = out_position;
476    readonly column NCBI:SRA:pos16 POSITION = out_position16;
477
478    // zero-based coordinates available upon request
479    readonly column INSDC:position:zero POSITION
480        = ( INSDC:position:zero ) < I32 > diff < 1 > ( out_position );
481
482    // statistics
483    U64 base_count
484        = < U64 > meta:value < "BASE_COUNT" > ();
485    U64 spot_count
486        = < U64 > meta:value < ".seq/spot" > ()
487        | < U64 > meta:value < ".seq" > () ;
488
489
490	/* INSDC:tbl:sequence inherited productions
491	 *  cs_native
492	 *  in_cs_key
493	 *  out_cs_key
494	 *  out_signal
495	 *  in_dna_text
496	 *  out_2cs_bin
497	 *  out_2na_bin
498	 *  out_4na_bin
499	 *  out_dna_text
500	 *  out_x2cs_bin
501	 *  out_x2na_bin
502	 *  in_color_text
503	 *  out_2cs_packed
504	 *  out_2na_packed
505	 *  out_4na_packed
506	 *  out_color_text
507	 *  out_qual_phred
508	 *  out_color_matrix
509	 */
510
511	/* INSDC:SRA:tbl:spotname inherited productions
512	 *  out_x_coord
513	 *  out_y_coord
514	 *  out_name_fmt
515	 *  out_spot_name
516	 *  spot_ids_found
517	 */
518
519	/* INSDC:SRA:tbl:spotdesc inherited productions
520	 *  trim_len
521	 *  out_label
522	 *  out_nreads
523	 *  trim_start
524	 *  out_read_len
525	 *  out_label_len
526	 *  out_rd_filter
527	 *  out_read_type
528	 *  out_read_start
529	 *  out_label_start
530	 *  static_fixed_spot_len
531	 */
532
533	/* INSDC:SRA:tbl:stats inherited productions
534	 *  max_spot_id
535	 *  min_spot_id
536	 *  in_stats_bin
537	 *  bio_base_count
538	 */
539
540	/* INSDC:SRA:tbl:sra inherited productions
541	 *  out_platform
542	 *  platform_name
543	 */
544
545	/* NCBI:SRA:tbl:spotdesc_nocol inherited productions
546	 *  out_read_seg
547	 *  out_label_seg
548	 *  out_read_seg32
549	 *  out_label_seg32
550	 */
551
552	/* NCBI:SRA:tbl:sra_nopos productions
553	 *  out_position
554	 *  out_position16
555	 */
556};
557
558/* history:
559 *  1.0.1 - base explicitly upon sra #1.0.1
560 *  1.0.2 - base explicitly upon sra_nopos #1.0.2, pos #1.0.1
561 *  1.0.3 - base explicitly upon sra_nopos #1.0.3
562 *  1.0.4 - base explicitly upon sra_nopos #1.0.4
563 */
564table NCBI:SRA:tbl:sra #1.0.4 = NCBI:SRA:tbl:sra_nopos #1.0.4, NCBI:SRA:tbl:pos #1.0.1
565{
566    // the POSITION column is synthesized for all contemporary platforms but 454
567
568	/* INSDC:tbl:sequence inherited productions
569	 *  cs_native
570	 *  in_cs_key
571	 *  out_cs_key
572	 *  out_signal
573	 *  in_dna_text
574	 *  out_2cs_bin
575	 *  out_2na_bin
576	 *  out_4na_bin
577	 *  out_dna_text
578	 *  out_x2cs_bin
579	 *  out_x2na_bin
580	 *  in_color_text
581	 *  out_2cs_packed
582	 *  out_2na_packed
583	 *  out_4na_packed
584	 *  out_color_text
585	 *  out_qual_phred
586	 *  out_color_matrix
587	 */
588
589	/* INSDC:SRA:tbl:spotname inherited productions
590	 *  out_x_coord
591	 *  out_y_coord
592	 *  out_name_fmt
593	 *  out_spot_name
594	 *  spot_ids_found
595	 */
596
597	/* INSDC:SRA:tbl:spotdesc inherited productions
598	 *  trim_len
599	 *  out_label
600	 *  out_nreads
601	 *  trim_start
602	 *  out_read_len
603	 *  out_label_len
604	 *  out_rd_filter
605	 *  out_read_type
606	 *  out_read_start
607	 *  out_label_start
608	 *  static_fixed_spot_len
609	 */
610
611	/* INSDC:SRA:tbl:stats inherited productions
612	 *  max_spot_id
613	 *  min_spot_id
614	 *  in_stats_bin
615	 *  bio_base_count
616	 */
617
618	/* INSDC:SRA:tbl:sra inherited productions
619	 *  out_platform
620	 *  platform_name
621	 */
622
623	/* NCBI:SRA:tbl:spotdesc_nocol inherited productions
624	 *  out_read_seg
625	 *  out_label_seg
626	 *  out_read_seg32
627	 *  out_label_seg32
628	 */
629};
630
631
632/* v2 consolidates many of the auxiliary columns into a single treatment
633 * left out are reads, qualities and platform-specific columns
634 *
635 * history:
636 *  2.1.2 - base upon sra #1.0.3, spotdesc #1.0.2, stats #1.1.2
637 *  2.1.4 - base upon sra #1.0.4, skeyname #3.0.2, stats #1.2.1
638 */
639table NCBI:SRA:tbl:sra_nopos #2.1.4
640    = INSDC:SRA:tbl:sra #1.0.4
641    , NCBI:SRA:tbl:skeyname #3.0.2
642    , NCBI:SRA:tbl:spotdesc #1.0.2
643    , NCBI:SRA:tbl:stats #1.2.1
644{
645    // this is already specified in INSDC:SRA:tbl:sra #1
646    // but putting it here will quiet down outputs
647    INSDC:SRA:platform_id out_platform = .PLATFORM;
648
649    column INSDC:position:one POSITION
650        = out_position;
651    readonly column NCBI:SRA:pos16 POSITION
652        = cast ( _clip_position );
653    INSDC:position:one _clip_position
654        = < INSDC:position:one > clip < 0, 0xFFFF > ( out_position );
655    readonly column INSDC:position:zero POSITION
656        = ( INSDC:position:zero ) < I32 > diff < 1 > ( out_position );
657
658
659	/* INSDC:tbl:sequence inherited productions
660	 *  cs_native
661	 *  in_cs_key
662	 *  out_cs_key
663	 *  out_signal
664	 *  in_dna_text
665	 *  out_2cs_bin
666	 *  out_2na_bin
667	 *  out_4na_bin
668	 *  out_dna_text
669	 *  out_x2cs_bin
670	 *  out_x2na_bin
671	 *  in_color_text
672	 *  out_2cs_packed
673	 *  out_2na_packed
674	 *  out_4na_packed
675	 *  out_color_text
676	 *  out_qual_phred
677	 *  out_color_matrix
678	 */
679
680	/* INSDC:SRA:tbl:spotdesc inherited productions
681	 *  trim_len
682	 *  trim_start
683	 *  out_read_type
684	 *  static_fixed_spot_len
685	 */
686
687	/* INSDC:SRA:tbl:stats inherited productions
688	 *  in_stats_bin
689	 */
690
691	/* INSDC:SRA:tbl:sra inherited productions
692	 *  out_platform
693	 *  platform_name
694	 */
695
696	/* NCBI:SRA:tbl:skeyname inherited productions
697	 *  in_spot_name_tok
698	 */
699
700	/* NCBI:SRA:tbl:spotdesc_nocol inherited productions
701	 *  out_read_seg
702	 *  out_label_seg
703	 */
704
705	/* NCBI:SRA:tbl:sra_nopos productions
706	 *  out_position
707	 */
708};
709
710/* most platforms don't have a native POSITION
711 * mix in "pos" table to synthesize it
712 *
713 * history:
714 *  2.1.2 - base upon sra#1.0.3, spotdesc #1.0.2, stats #1.1.2
715 *  2.1.4 - base upon sra #1.0.4, skeyname #3.0.2, stats #1.2.1
716 */
717table NCBI:SRA:tbl:sra #2.1.4
718    = INSDC:SRA:tbl:sra #1.0.4
719    , NCBI:SRA:tbl:skeyname #3.0.2
720    , NCBI:SRA:tbl:spotdesc #1.0.2
721    , NCBI:SRA:tbl:stats #1.2.1
722    , NCBI:SRA:tbl:pos #1.0.1
723{
724    readonly column INSDC:position:one POSITION
725        = out_position;
726    readonly column NCBI:SRA:pos16 POSITION
727        = out_position16;
728    readonly column INSDC:position:zero POSITION
729        = ( INSDC:position:zero ) < I32 > diff < 1 > ( out_position );
730
731
732	/* INSDC:tbl:sequence inherited productions
733	 *  cs_native
734	 *  in_cs_key
735	 *  out_cs_key
736	 *  out_signal
737	 *  in_dna_text
738	 *  out_2cs_bin
739	 *  out_2na_bin
740	 *  out_4na_bin
741	 *  out_dna_text
742	 *  out_x2cs_bin
743	 *  out_x2na_bin
744	 *  in_color_text
745	 *  out_2cs_packed
746	 *  out_2na_packed
747	 *  out_4na_packed
748	 *  out_color_text
749	 *  out_qual_phred
750	 *  out_color_matrix
751	 */
752
753	/* INSDC:SRA:tbl:spotdesc inherited productions
754	 *  trim_len
755	 *  trim_start
756	 *  out_read_type
757	 *  static_fixed_spot_len
758	 */
759
760	/* INSDC:SRA:tbl:stats inherited productions
761	 *  in_stats_bin
762	 */
763
764	/* INSDC:SRA:tbl:sra inherited productions
765	 *  out_platform
766	 *  platform_name
767	 */
768
769	/* NCBI:SRA:tbl:skeyname inherited productions
770	 *  in_spot_name_tok
771	 */
772};
773