Skip to content

Commit 7da1e0b

Browse files
committed
Add ref_internal.h and correct ref.h
1 parent 2d3d1e9 commit 7da1e0b

File tree

6 files changed

+62
-13
lines changed

6 files changed

+62
-13
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ cram_samtools_h = cram/cram_samtools.h $(htslib_sam_h) $(cram_sam_header_h)
178178
cram_structs_h = cram/cram_structs.h $(htslib_thread_pool_h) cram/string_alloc.h $(htslib_khash_h)
179179
cram_open_trace_file_h = cram/open_trace_file.h cram/mFILE.h
180180
hfile_internal_h = hfile_internal.h $(htslib_hfile_h)
181+
ref_internal_h = ref_internal.h $(htslib_hfile_h) cram/mFILE.h
181182
hts_internal_h = hts_internal.h $(htslib_hts_h)
182183
thread_pool_internal_h = thread_pool_internal.h $(htslib_thread_pool_h)
183184

@@ -315,14 +316,14 @@ plugin.o plugin.pico: plugin.c config.h $(hts_internal_h) $(htslib_kstring_h)
315316
probaln.o probaln.pico: probaln.c config.h $(htslib_hts_h)
316317
realn.o realn.pico: realn.c config.h $(htslib_hts_h) $(htslib_sam_h)
317318
textutils.o textutils.pico: textutils.c config.h $(htslib_hfile_h) $(htslib_kstring_h) $(hts_internal_h)
318-
ref.o ref.pico: ref.c config.h $(htslib_kstring_h) $(htslib_bgzf_h) $(cram_h) $(cram_io_h) $(cram_open_trace_file_h) $(htslib_hfile_h)
319+
ref.o ref.pico: ref.c config.h $(ref_internal_h) $(htslib_kstring_h) $(htslib_bgzf_h) $(cram_h) $(cram_io_h) $(cram_open_trace_file_h) $(htslib_hfile_h)
319320

320321
cram/cram_codecs.o cram/cram_codecs.pico: cram/cram_codecs.c config.h $(cram_h)
321322
cram/cram_decode.o cram/cram_decode.pico: cram/cram_decode.c config.h $(cram_h) $(cram_os_h) $(htslib_hts_h)
322323
cram/cram_encode.o cram/cram_encode.pico: cram/cram_encode.c config.h $(cram_h) $(cram_os_h) $(htslib_hts_h) $(htslib_hts_endian_h)
323324
cram/cram_external.o cram/cram_external.pico: cram/cram_external.c config.h $(htslib_hfile_h) $(cram_h)
324325
cram/cram_index.o cram/cram_index.pico: cram/cram_index.c config.h $(htslib_bgzf_h) $(htslib_hfile_h) $(hts_internal_h) $(cram_h) $(cram_os_h)
325-
cram/cram_io.o cram/cram_io.pico: cram/cram_io.c config.h os/lzma_stub.h $(cram_h) $(cram_os_h) $(htslib_hts_h) $(htslib_ref_h) $(cram_open_trace_file_h) cram/rANS_static.h $(htslib_hfile_h) $(htslib_bgzf_h) $(htslib_faidx_h) $(hts_internal_h)
326+
cram/cram_io.o cram/cram_io.pico: cram/cram_io.c config.h os/lzma_stub.h $(ref_internal_h) $(cram_h) $(cram_os_h) $(htslib_hts_h) $(htslib_ref_h) $(cram_open_trace_file_h) cram/rANS_static.h $(htslib_hfile_h) $(htslib_bgzf_h) $(htslib_faidx_h) $(hts_internal_h)
326327
cram/cram_samtools.o cram/cram_samtools.pico: cram/cram_samtools.c config.h $(cram_h) $(htslib_sam_h)
327328
cram/cram_stats.o cram/cram_stats.pico: cram/cram_stats.c config.h $(cram_h) $(cram_os_h)
328329
cram/files.o cram/files.pico: cram/files.c config.h $(cram_misc_h)

cram/cram_io.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7373
#include "cram/os.h"
7474
#include "htslib/hts.h"
7575
#include "htslib/ref.h"
76+
#include "ref_internal.h"
7677
#include "cram/open_trace_file.h"
7778
#include "cram/rANS_static.h"
7879

htslib.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ HTSLIB_ALL = \
100100
$(HTSDIR)/realn.c \
101101
$(HTSDIR)/regidx.c \
102102
$(HTSDIR)/ref.c \
103+
$(HTSDIR)/ref_internal.h \
103104
$(HTSDIR)/sam.c \
104105
$(HTSDIR)/synced_bcf_reader.c \
105106
$(HTSDIR)/tbx.c \

htslib/ref.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2424
DEALINGS IN THE SOFTWARE. */
2525

2626

27-
#ifndef HTSLIB_VCF_H
28-
#define HTSLIB_VCF_H
27+
#ifndef HTSLIB_REF_H
28+
#define HTSLIB_REF_H
2929

3030
#include "bgzf.h"
3131
#include "htslib/hfile.h"
@@ -34,15 +34,6 @@ DEALINGS IN THE SOFTWARE. */
3434
extern "C" {
3535
#endif
3636

37-
typedef struct {
38-
hFILE_wrapper base;
39-
hFILE* innerhf;
40-
int length;
41-
char* file_name;
42-
void* mf;
43-
int is_mem_hfile;
44-
} hFILE_ref;
45-
4637
/* m5_to_ref() - populates the ref parameter with the reference genome
4738
* for a given m5 string
4839
* @param m5_str: The m5 string to query

ref.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3838
#include "cram/open_trace_file.h"
3939
#include "htslib/hfile.h"
4040
#include "htslib/ref.h"
41+
#include "ref_internal.h"
4142
#include "hfile_internal.h"
4243

4344
#include <errno.h>

ref_internal.h

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/// @file ref_internal.h
2+
/// Internal declarations from ref.c
3+
/*
4+
Copyright (C) 2017 Genome Research Ltd.
5+
6+
Author: Thomas Hickman <[email protected]>
7+
8+
Permission is hereby granted, free of charge, to any person obtaining a copy
9+
of this software and associated documentation files (the "Software"), to deal
10+
in the Software without restriction, including without limitation the rights
11+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
copies of the Software, and to permit persons to whom the Software is
13+
furnished to do so, subject to the following conditions:
14+
15+
The above copyright notice and this permission notice shall be included in
16+
all copies or substantial portions of the Software.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24+
DEALINGS IN THE SOFTWARE. */
25+
26+
27+
#ifndef REF_INTERNAL_H
28+
#define REF_INTERNAL_H
29+
30+
#include "htslib/hfile.h"
31+
#include "cram/mFILE.h"
32+
33+
#ifdef __cplusplus
34+
extern "C" {
35+
#endif
36+
37+
/**
38+
* Internal struct containing information about hFILEs created by m5_to_ref. Intended to be
39+
* consumed by cram_populate_ref
40+
*/
41+
typedef struct {
42+
hFILE_wrapper base;
43+
int length;
44+
char* file_name; // NOTE: this is set to NULL if this is an in-memory hFILE
45+
mFILE* mf;
46+
int is_mem_hfile;
47+
} hFILE_ref;
48+
49+
50+
#ifdef __cplusplus
51+
}
52+
#endif
53+
54+
#endif

0 commit comments

Comments
 (0)