| 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 <klib/rc.h>cxx . . $ `<file>/interfaces/klib/rc.h`/ |
| 29 | #include <vdb/table.h>cxx . . $ `<file>/interfaces/vdb/table.h`/ |
| 30 | #include <vdb/xform.h>cxx . . $ `<file>/interfaces/vdb/xform.h`/ |
| 31 | #include <kdb/meta.h>cxx . . $ `<file>/interfaces/kdb/meta.h`/ |
| 32 | #include <klib/data-buffer.h>cxx . . $ `<file>/interfaces/klib/data-buffer.h`/ |
| 33 | |
| 34 | #define WRITE_SIDEcxx . . $ `libs/sraxf/use-rna-flag.c:34:9`! 0 |
| 35 | #include "rna-flag-common.c"cxx . . $ `<file>/libs/sraxf/rna-flag-common.c`/ |
| 36 | |
| 37 | static |
| 38 | rc_tcxx . . $ rc_t# CCcxx . . $ `interfaces/kfc/callconv.h:44:11`! use_rna_flagcxx . . $ use_rna_flag(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 | { /* meta<RNA_FLAG> == "0" or not set: no translation to be done |
| 41 | meta<RNA_FLAG> == "1": translate 'T' to 'U' */ |
| 42 | struct Selfcxx . . $ Self# *const self = Self; |
| 43 | rc_tcxx . . $ rc_t# rc; |
| 44 | uint32_tcxx . . $ uint32_t# row_len = (uint32_tcxx . . $ uint32_t#) argv [ 0 ] . ucxx . . $ VRowData#u. . datacxx . . $ VRowData#$anonymous_type_1#data. . elem_countcxx . . $ VRowData#$anonymous_type_1#$anonymous_type_2#elem_count.; |
| 45 | uint8_tcxx . . $ uint8_t# const *seq = argv [ 0 ] . ucxx . . $ VRowData#u. . datacxx . . $ VRowData#$anonymous_type_1#data. . basecxx . . $ VRowData#$anonymous_type_1#$anonymous_type_2#base.; |
| 46 | |
| 47 | assertcxx . . $ `/usr/include/assert.h:118:11`!(argv[0].u.data.elem_bits == 8); |
| 48 | seq += argv [ 0 ] . ucxx . . $ VRowData#u. . datacxx . . $ VRowData#$anonymous_type_1#data. . first_elemcxx . . $ VRowData#$anonymous_type_1#$anonymous_type_2#first_elem.; |
| 49 | |
| 50 | rslt -> datacxx . . $ VRowResult#data. -> elem_bitscxx . . $ KDataBuffer#elem_bits. = 8; |
| 51 | rslt -> elem_countcxx . . $ VRowResult#elem_count. = row_len; |
| 52 | rc = KDataBufferResizecxx . . $ KDataBufferResize(daabdf243431d3e4). ( rslt -> datacxx . . $ VRowResult#data., row_len ); |
| 53 | if (rc == 0) |
| 54 | rc = self->functioncxx . . $ Self#function.(self, rslt->datacxx . . $ VRowResult#data.->basecxx . . $ KDataBuffer#base., seq, row_len); |
| 55 | |
| 56 | return rc; |
| 57 | } |
| 58 | |
| 59 | /* useRnaFlag |
| 60 | * if metadata(RNA) is set translate T to U |
| 61 | * otherwise, do nothing |
| 62 | * |
| 63 | * extern function INSDC:dna:text NCBI:sra:useRnaFlag ( INSDC:dna:text in_read ); |
| 64 | */ |
| 65 | |
| 66 | VTRANSFACT_IMPLcxx . . $ `interfaces/vdb/xform.h:791:9`! ( NCBI_SRA_useRnaFlag, 1, 0, 0 ) ( const void *Self, const VXfactInfocxx . . $ VXfactInfo# *info, |
| 67 | VFuncDesccxx . . $ VFuncDesc# *rslt, const VFactoryParamscxx . . $ VFactoryParams# *cp, const VFunctionParamscxx . . $ VFunctionParams# *dp ) |
| 68 | { |
| 69 | const KMetadatacxx . . $ KMetadata# * meta; |
| 70 | rc_tcxx . . $ rc_t# rc = VTableOpenMetadataReadcxx . . $ VTableOpenMetadataRead(b6c76746faeb1ab4).((VTablecxx . . $ VTable#*)info->tblcxx . . $ VXfactInfo#tbl., & meta); |
| 71 | if (rc == 0) { |
| 72 | rc = makeSelfcxx . . $ makeSelf(9a89feca3d415c13).(rslt, meta); |
| 73 | if (rc == 0) |
| 74 | rslt->ucxx . . $ VFuncDesc#u..rfcxx . . $ VFuncDesc#$anonymous_type_7#rf. = use_rna_flagcxx . . $ use_rna_flag(c7f02ef3aabbc98b).; |
| 75 | } |
| 76 | return rc; |
| 77 | } |