This file is indexed.

/usr/lib/emboss/include/ajbamindex.h is in emboss-lib 6.6.0+dfsg-6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/* @include ajbamindex ********************************************************
**
** AJAX BAM files indexing/querying functions
**
** @version $Revision: 1.4 $
** @modified 2011 Mahmut Uludag ported from samtools (samtools.sf.net)
** @modified $Date: 2012/04/26 17:36:15 $ by $Author: mks $
** @@
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version.
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
** MA  02110-1301,  USA.
**
******************************************************************************/

/* The MIT License
**
**   Copyright (c) 2008 Genome Research Ltd (GRL).
**
**   Permission is hereby granted, free of charge, to any person obtaining
**   a copy of this software and associated documentation files (the
**   "Software"), to deal in the Software without restriction, including
**   without limitation the rights to use, copy, modify, merge, publish,
**   distribute, sublicense, and/or sell copies of the Software, and to
**   permit persons to whom the Software is furnished to do so, subject to
**   the following conditions:
**
**   The above copyright notice and this permission notice shall be
**   included in all copies or substantial portions of the Software.
**
**   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
**   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
**   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
**   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
**   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
**   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
**   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
**   SOFTWARE.
*/

#ifndef AJBAMINDEX_H
#define AJBAMINDEX_H

#include "ajdefine.h"
#include "ajseqbam.h"


/* @data pair64_t *************************************************************
**
** A [start,stop) file pointer pairing into the BAM file, stored
** as a BAM file index.  A chunk is represented as a single 64-bit
** value where the high-order 48 bits point to the location of the
** start of a compressed BGZF block within a BGZF file and the
** low-order 16 bits point to a position within the decompressed
** data in the BGZF block.
** ref: Chunk.java in picard project
**
** @attr u [ajulong] virtual file offset of the start of the chunk
** @attr v [ajulong] virtual file offset of the end of the chunk
******************************************************************************/

typedef struct pair64_t
{
    ajulong u;
    ajulong v;
} pair64_t;


/* @data bam_binlist_t ********************************************************
**
** bin object in a binning index for a reference sequence
**
** @attr m [ajuint] allocated size of the chunk array
**                  and is always >= n
** @attr n [ajuint] number of chunks
** @attr list [pair64_t*] array of BAM file chunk start/stop offsets
******************************************************************************/

typedef struct bam_binlist_t
{
    ajuint m;
    ajuint n;
    pair64_t *list;
} bam_binlist_t;


/* @data bam_lidx_t ***********************************************************
**
** linear index for a reference sequence
**
** @attr n [ajint] number of chunks
** @attr m [ajint] allocated size of the list or offset array
**                 and is always >= n
** @attr offset [ajulong*] Array of offsets
**
******************************************************************************/

typedef struct bam_lidx_t
{
    ajint n;
    ajint m;
    ajulong *offset;
} bam_lidx_t;




/* @data AjPBamIndex ********************************************************
**
** Structure for BAM indexes. (samtools name: bam_index_t)
**
** @attr  Padding [ajuint] Padding to alignment boundary
** @attr  n     [ajint]  number of reference sequences
** @attr  n_no_coor [ajulong]  unmapped reads without coordinate
** @attr  bindex    [AjPTable*]  list of binning indices
** @attr  index2    [bam_lidx_t*]  list of intervals for the linear index
******************************************************************************/

typedef struct AjSBamIndex
{
    ajuint Padding;
    ajint n;
    ajulong n_no_coor;
    AjPTable* bindex;
    bam_lidx_t *index2;
} AjOBamIndex;

#define AjPBamIndex AjOBamIndex*




/*
 * Return a virtual file pointer to the current location in the file.
 * No interpretation of the value should be made, other than a subsequent
 * call to ajSeqBamBgzfSeek can be used to position the file at the same point.
 * Return value is non-negative on success.
 * Returns -1 on error.
 */
#define bgzf_tell(fp) ((fp->block_address << 16) | (fp->block_offset & 0xFFFF))
#define bam_tell(fp) bgzf_tell(fp)




/* @datatype bam_fetch_f ******************************************************
**
**  Type of function to be called by ajBamFetch().
**
**  @attr typedef [int] Value returned
**
******************************************************************************/
typedef int (*bam_fetch_f)(AjPSeqBam b, void *data);



int ajBamFetch(AjPSeqBamBgzf fp, const AjPBamIndex idx, int tid,
	       int beg, int end, void *data, bam_fetch_f func);

int ajBamIndexBuild(const char *fn);
void ajBamIndexDel(AjPBamIndex* idx);
AjPBamIndex ajBamIndexLoad(const char *fn);


#endif /* !AJBAMINDEX_H */