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 #ifndef _h_bam_reader_ 28 #define _h_bam_reader_ 29 30 #include <klib/rc.h> 31 #include <kfs/directory.h> 32 33 #include <align/extern.h> 34 #include <align/bam.h> 35 36 #include <loader/common-reader-priv.h> 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 rc_t CC BamReaderFileMake( const ReaderFile **self, char const headerText[], char const path[] ); 43 44 /* temporary crutches for refactoring: */ 45 const BAMFile* ToBam(const ReaderFile *self); 46 const BAMAlignment *ToBamAlignment(const Record* record); 47 48 #if 0 49 #ifdef TENTATIVE 50 /*-------------------------------------------------------------------------- 51 * BAMReader, a parsing thread adapter for BAMFile. 52 * Creates a thread that does reading and parsing of BAM files, provides access to parsed data one record at a time. 53 */ 54 typedef struct BAMReader BAMReader; 55 56 rc_t BAMReaderMake( const BAMReader **result, 57 char const headerText[], 58 char const path[] ); 59 60 /* AddRef 61 * Release 62 */ 63 rc_t BAMReaderAddRef ( const BAMReader *self ); 64 rc_t AMReaderRelease ( const BAMReader *self ); 65 66 /* GetBAMFile 67 */ 68 const BAMFile* BAMReaderGetBAMFile ( const BAMReader *self ); 69 70 /* Read 71 * read an aligment 72 * 73 * "result" [ OUT ] - return param for BAMAlignment object 74 * must be released with BAMAlignmentRelease 75 * 76 * returns RC(..., ..., ..., rcRow, rcNotFound) at end 77 */ 78 rc_t BAMReaderRead ( const BAMReader *self, const BAMAlignment **result ); 79 80 #else /*TENTATIVE*/ 81 82 /* use BAMFile directly, as in the earlier version */ 83 typedef struct BAMFile BAMReader; 84 85 #define BAMReaderMake BAMFileMakeWithHeader 86 #define BAMReaderAddRef BAMFileAddRef 87 #define BAMReaderRelease BAMFileRelease 88 #define BAMReaderGetBAMFile(p) (p) 89 #define BAMReaderRead BAMFileRead 90 91 #endif 92 #endif 93 94 #ifdef __cplusplus 95 } 96 #endif 97 98 #endif /* _h_bam_reader_ */ 99