Skip to content

Commit 16bcd0c

Browse files
committed
Abstract ref_to_m5 from cram_io
1 parent 80bb84f commit 16bcd0c

File tree

10 files changed

+679
-327
lines changed

10 files changed

+679
-327
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ lib*.so.*
4545
/test/test-vcf-api
4646
/test/test-vcf-sweep
4747
/test/test-bcf-sr
48+
/test/test-ref
4849
/test/test_view
4950
/test/thrash_threads[1-6]
5051
/test/*.tmp

Makefile

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ BUILT_TEST_PROGRAMS = \
7272
test/hfile \
7373
test/sam \
7474
test/test_bgzf \
75+
test/test-ref \
7576
test/test-regidx \
7677
test/test_view \
7778
test/test-vcf-api \
@@ -154,6 +155,7 @@ LIBHTS_OBJS = \
154155
multipart.o \
155156
probaln.o \
156157
realn.o \
158+
ref.o \
157159
regidx.o \
158160
sam.o \
159161
synced_bcf_reader.o \
@@ -326,13 +328,14 @@ plugin.o plugin.pico: plugin.c config.h $(hts_internal_h) $(htslib_kstring_h)
326328
probaln.o probaln.pico: probaln.c config.h $(htslib_hts_h)
327329
realn.o realn.pico: realn.c config.h $(htslib_hts_h) $(htslib_sam_h)
328330
textutils.o textutils.pico: textutils.c config.h $(htslib_hfile_h) $(htslib_kstring_h) $(hts_internal_h)
331+
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)
329332

330333
cram/cram_codecs.o cram/cram_codecs.pico: cram/cram_codecs.c config.h $(cram_h)
331334
cram/cram_decode.o cram/cram_decode.pico: cram/cram_decode.c config.h $(cram_h) $(cram_os_h) $(htslib_hts_h)
332335
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)
333336
cram/cram_external.o cram/cram_external.pico: cram/cram_external.c config.h $(htslib_hfile_h) $(cram_h)
334337
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)
335-
cram/cram_io.o cram/cram_io.pico: cram/cram_io.c config.h $(cram_h) $(cram_os_h) $(htslib_hts_h) $(cram_open_trace_file_h) cram/rANS_static.h $(htslib_hfile_h) $(htslib_bgzf_h) $(htslib_faidx_h) $(hts_internal_h)
338+
cram/cram_io.o cram/cram_io.pico: cram/cram_io.c config.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)
336339
cram/cram_samtools.o cram/cram_samtools.pico: cram/cram_samtools.c config.h $(cram_h) $(htslib_sam_h)
337340
cram/cram_stats.o cram/cram_stats.pico: cram/cram_stats.c config.h $(cram_h) $(cram_os_h)
338341
cram/files.o cram/files.pico: cram/files.c config.h $(cram_misc_h)
@@ -364,7 +367,7 @@ tabix.o: tabix.c config.h $(htslib_tbx_h) $(htslib_sam_h) $(htslib_vcf_h) $(htsl
364367
#
365368
# If using MSYS, avoid poor shell expansion via:
366369
# MSYS2_ARG_CONV_EXCL="*" make check
367-
check test: $(BUILT_PROGRAMS) $(BUILT_TEST_PROGRAMS)
370+
check test: $(BUILT_PROGRAMS) $(BUILT_TEST_PROGRAMS) test_ebi_fetch
368371
test/hts_endian
369372
test/fieldarith test/fieldarith.sam
370373
test/hfile
@@ -374,6 +377,18 @@ check test: $(BUILT_PROGRAMS) $(BUILT_TEST_PROGRAMS)
374377
test/test-regidx
375378
cd test && REF_PATH=: ./test.pl $${TEST_OPTS:-}
376379

380+
test_ebi_fetch:
381+
export REF_CACHE=`mktemp -d` && \
382+
test/test_view -t test/xx.fa -S -C test/xx#rg.sam > test/xx#rg.tmp.cram && \
383+
test/test_view -D test/xx#rg.tmp.cram > /dev/null && \
384+
test/test_view -D test/xx#rg.tmp.cram > /dev/null && \
385+
rm -rf $$REF_CACHE
386+
export REF_CACHE=`mktemp -d` && \
387+
test/test-ref && \
388+
test/test-ref && \
389+
rm -rf $$REF_CACHE
390+
391+
377392
test/hts_endian: test/hts_endian.o
378393
$(CC) $(LDFLAGS) -o $@ test/hts_endian.o $(LIBS)
379394

@@ -389,6 +404,9 @@ test/sam: test/sam.o libhts.a
389404
test/test_bgzf: test/test_bgzf.o libhts.a
390405
$(CC) $(LDFLAGS) -o $@ test/test_bgzf.o libhts.a -lz $(LIBS) -lpthread
391406

407+
test/test-ref: test/test-ref.o libhts.a
408+
$(CC) $(LDFLAGS) -o $@ test/test-ref.o libhts.a $(LIBS) -lpthread
409+
392410
test/test-regidx: test/test-regidx.o libhts.a
393411
$(CC) $(LDFLAGS) -o $@ test/test-regidx.o libhts.a $(LIBS) -lpthread
394412

@@ -412,6 +430,7 @@ test/fieldarith.o: test/fieldarith.c config.h $(htslib_sam_h)
412430
test/hfile.o: test/hfile.c config.h $(htslib_hfile_h) $(htslib_hts_defs_h)
413431
test/sam.o: test/sam.c config.h $(htslib_hts_defs_h) $(htslib_sam_h) $(htslib_faidx_h) $(htslib_kstring_h)
414432
test/test_bgzf.o: test/test_bgzf.c $(htslib_bgzf_h) $(htslib_hfile_h)
433+
test/test-ref.o: test/test-ref.c $(htslib_bgzf_h)
415434
test/test-regidx.o: test/test-regidx.c config.h $(htslib_regidx_h) $(hts_internal_h)
416435
test/test_view.o: test/test_view.c config.h $(cram_h) $(htslib_sam_h)
417436
test/test-vcf-api.o: test/test-vcf-api.c config.h $(htslib_hts_h) $(htslib_vcf_h) $(htslib_kstring_h) $(htslib_kseq_h)

0 commit comments

Comments
 (0)