| 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 | #include <vdb/extern.h>cxx . . $ `<file>/interfaces/vdb/extern.h`/ |
| 27 | |
| 28 | #include <sra/sradb.h>cxx . . $ `<file>/interfaces/sra/sradb.h`/ |
| 29 | #include <vdb/xform.h>cxx . . $ `<file>/interfaces/vdb/xform.h`/ |
| 30 | #include <klib/data-buffer.h>cxx . . $ `<file>/interfaces/klib/data-buffer.h`/ |
| 31 | #include <klib/rc.h>cxx . . $ `<file>/interfaces/klib/rc.h`/ |
| 32 | #include <sysalloc.h>cxx . . $ `<file>/interfaces/os/unix/sysalloc.h`/ |
| 33 | |
| 34 | #include <string.h> |
| 35 | #include <assert.h> |
| 36 | |
| 37 | static |
| 38 | rc_tcxx . . $ rc_t# CCcxx . . $ `interfaces/kfc/callconv.h:44:11`! make_spot_desccxx . . $ make_spot_desc(c7f02ef3aabbc98b). ( void *self, const VXformInfocxx . . $ VXformInfo# *info, int64_tcxx . . $ int64_t# row_id, |
| 39 | VRowResultcxx . . $ VRowResult# *rslt, uint32_tcxx . . $ uint32_t# argc, const VRowDatacxx . . $ VRowData# argv [] ) |
| 40 | { |
| 41 | rc_tcxx . . $ rc_t# rc; |
| 42 | const uint32_tcxx . . $ uint32_t# *spot_len = argv[0].ucxx . . $ VRowData#u..datacxx . . $ VRowData#$anonymous_type_1#data..basecxx . . $ VRowData#$anonymous_type_1#$anonymous_type_2#base.; |
| 43 | const uint32_tcxx . . $ uint32_t# *fixed_len = argv[1].ucxx . . $ VRowData#u..datacxx . . $ VRowData#$anonymous_type_1#data..basecxx . . $ VRowData#$anonymous_type_1#$anonymous_type_2#base.; |
| 44 | const uint32_tcxx . . $ uint32_t# *sig_len = argv[2].ucxx . . $ VRowData#u..datacxx . . $ VRowData#$anonymous_type_1#data..basecxx . . $ VRowData#$anonymous_type_1#$anonymous_type_2#base.; |
| 45 | const int32_tcxx . . $ int32_t# *trim_start = argv[3].ucxx . . $ VRowData#u..datacxx . . $ VRowData#$anonymous_type_1#data..basecxx . . $ VRowData#$anonymous_type_1#$anonymous_type_2#base.; |
| 46 | const uint32_tcxx . . $ uint32_t# *trim_len = argv[4].ucxx . . $ VRowData#u..datacxx . . $ VRowData#$anonymous_type_1#data..basecxx . . $ VRowData#$anonymous_type_1#$anonymous_type_2#base.; |
| 47 | const uint8_tcxx . . $ uint8_t# *num_reads = argv[5].ucxx . . $ VRowData#u..datacxx . . $ VRowData#$anonymous_type_1#data..basecxx . . $ VRowData#$anonymous_type_1#$anonymous_type_2#base.; |
| 48 | |
| 49 | SRASpotDesccxx . . $ SRASpotDesc# *dst; |
| 50 | |
| 51 | num_reads += argv[5].ucxx . . $ VRowData#u..datacxx . . $ VRowData#$anonymous_type_1#data..first_elemcxx . . $ VRowData#$anonymous_type_1#$anonymous_type_2#first_elem.; /* valid for argv[0].u.data.elem_count */ |
| 52 | assertcxx . . $ `/usr/include/assert.h:118:11`!( argv[5].u.data.elem_bits == (sizeof( *num_reads ) * 8 ) ); |
| 53 | |
| 54 | spot_len += argv[0].ucxx . . $ VRowData#u..datacxx . . $ VRowData#$anonymous_type_1#data..first_elemcxx . . $ VRowData#$anonymous_type_1#$anonymous_type_2#first_elem.; |
| 55 | assertcxx . . $ `/usr/include/assert.h:118:11`!( argv[0].u.data.elem_bits == (sizeof( *spot_len ) * 8 ) ); |
| 56 | |
| 57 | fixed_len += argv[1].ucxx . . $ VRowData#u..datacxx . . $ VRowData#$anonymous_type_1#data..first_elemcxx . . $ VRowData#$anonymous_type_1#$anonymous_type_2#first_elem.; |
| 58 | assertcxx . . $ `/usr/include/assert.h:118:11`!( argv[1].u.data.elem_bits == (sizeof( *fixed_len ) * 8 ) ); |
| 59 | |
| 60 | sig_len += argv[2].ucxx . . $ VRowData#u..datacxx . . $ VRowData#$anonymous_type_1#data..first_elemcxx . . $ VRowData#$anonymous_type_1#$anonymous_type_2#first_elem.; |
| 61 | assertcxx . . $ `/usr/include/assert.h:118:11`!( argv[2].u.data.elem_bits == (sizeof( *sig_len ) * 8 ) ); |
| 62 | |
| 63 | trim_start += argv[3].ucxx . . $ VRowData#u..datacxx . . $ VRowData#$anonymous_type_1#data..first_elemcxx . . $ VRowData#$anonymous_type_1#$anonymous_type_2#first_elem.; |
| 64 | assertcxx . . $ `/usr/include/assert.h:118:11`!( argv[3].u.data.elem_bits == (sizeof( *trim_start ) * 8 ) ); |
| 65 | |
| 66 | trim_len += argv[4].ucxx . . $ VRowData#u..datacxx . . $ VRowData#$anonymous_type_1#data..first_elemcxx . . $ VRowData#$anonymous_type_1#$anonymous_type_2#first_elem.; |
| 67 | assertcxx . . $ `/usr/include/assert.h:118:11`!( argv[4].u.data.elem_bits == (sizeof( *trim_len ) * 8 ) ); |
| 68 | |
| 69 | rslt->datacxx . . $ VRowResult#data.->elem_bitscxx . . $ KDataBuffer#elem_bits. = sizeof(*dst) * 8; |
| 70 | |
| 71 | rc = KDataBufferResizecxx . . $ KDataBufferResize(daabdf243431d3e4).( rslt->datacxx . . $ VRowResult#data., 1 ); |
| 72 | if ( rc == 0 ) |
| 73 | { |
| 74 | dst = rslt->datacxx . . $ VRowResult#data.->basecxx . . $ KDataBuffer#base.; |
| 75 | dst->spot_lencxx . . $ SRASpotDesc#spot_len. = (uint16_tcxx . . $ uint16_t#)spot_len[0]; |
| 76 | dst->fixed_lencxx . . $ SRASpotDesc#fixed_len. = (uint16_tcxx . . $ uint16_t#)fixed_len[0]; |
| 77 | dst->signal_lencxx . . $ SRASpotDesc#signal_len. = (uint16_tcxx . . $ uint16_t#)sig_len[0]; |
| 78 | dst->clip_qual_rightcxx . . $ SRASpotDesc#clip_qual_right. = (uint16_tcxx . . $ uint16_t#)( trim_start[0]+trim_len[0] ); |
| 79 | dst->num_readscxx . . $ SRASpotDesc#num_reads. = num_reads[0]; |
| 80 | |
| 81 | memsetcxx . . $ memset(d1de1e4fb215f1c6).( dst->aligncxx . . $ SRASpotDesc#align., 0, sizeof( dst->aligncxx . . $ SRASpotDesc#align. ) ); |
| 82 | |
| 83 | rslt->elem_bitscxx . . $ VRowResult#elem_bits. = sizeof(*dst) * 8; |
| 84 | rslt->elem_countcxx . . $ VRowResult#elem_count. = 1; |
| 85 | } |
| 86 | |
| 87 | return rc; |
| 88 | } |
| 89 | |
| 90 | /* |
| 91 | function NCBI:SRA:SpotDesc NCBI:SRA:make_spot_desc |
| 92 | ( U32 spot_len, U32 fixed_len, U32 sig_len, |
| 93 | INSDC:coord:zero trim_start, U32 trim_len, U8 num_reads ) |
| 94 | |
| 95 | */ |
| 96 | VTRANSFACT_IMPLcxx . . $ `interfaces/vdb/xform.h:791:9`!( NCBI_SRA_make_spot_desc, 1, 0, 0 ) ( const void *self, const VXfactInfocxx . . $ VXfactInfo# *info, |
| 97 | VFuncDesccxx . . $ VFuncDesc# *rslt, const VFactoryParamscxx . . $ VFactoryParams# *cp, const VFunctionParamscxx . . $ VFunctionParams# *dp ) |
| 98 | { |
| 99 | rslt -> ucxx . . $ VFuncDesc#u. . rfcxx . . $ VFuncDesc#$anonymous_type_7#rf. = make_spot_desccxx . . $ make_spot_desc(c7f02ef3aabbc98b).; |
| 100 | rslt -> variantcxx . . $ VFuncDesc#variant. = vftRowcxx . . $ vftRow.; |
| 101 | return 0; |
| 102 | } |