-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from wtsi-npg/devel
merge devel to master, preparation for release 0.9.4
- Loading branch information
Showing
50 changed files
with
3,493 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
ACLOCAL_AMFLAGS= -I m4 | ||
TESTS = test/t_bclfile test/t_decode test/t_filterfile test/t_posfile test/t_i2b | ||
TESTS = test/t_array \ | ||
test/t_bamit \ | ||
test/t_chrsplit \ | ||
test/t_select \ | ||
test/t_bclfile \ | ||
test/t_decode \ | ||
test/t_filterfile \ | ||
test/t_posfile \ | ||
test/t_i2b | ||
SUBDIRS = src test | ||
dist_doc_DATA = README.md LICENSE | ||
AM_COLOR_TESTS=always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
AC_INIT([bambi], m4_esyscmd_s([git describe --dirty --always --tags]), [[email protected]]) | ||
AC_ARG_VAR(HTSDIR,Directory to look for hts) | ||
#AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects tar-pax no-dependencies]) | ||
AM_INIT_AUTOMAKE([-Wall -Werror foreign tar-pax no-dependencies]) | ||
AC_PROG_CC | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
AM_CPPFLAGS = $(HTSLIB_CPPFLAGS) | ||
AM_CPPFLAGS = $(HTSLIB_CPPFLAGS) -std=gnu99 | ||
AM_LDFLAGS = -rdynamic $(HTSLIB_LDFLAGS) | ||
|
||
bin_PROGRAMS = bambi | ||
bambi_SOURCES = bambi.c bclfile.c decode.c filterfile.c hts_addendum.c i2b.c posfile.c array.c \ | ||
bambi.h bclfile.h filterfile.h hts_addendum.h posfile.h array.h | ||
bambi_SOURCES = bambi.c bclfile.c decode.c filterfile.c hts_addendum.c i2b.c posfile.c array.c select.c \ | ||
bambi.h bclfile.h filterfile.h hts_addendum.h posfile.h array.h \ | ||
parse.c bamit.c chrsplit.c\ | ||
parse.h bamit.h | ||
nobase_include_HEADERS = cram/cram_samtools.h cram/pooled_alloc.h cram/sam_header.h cram/string_alloc.h | ||
bambi_CFLAGS = -I/usr/include/libxml2 | ||
bambi_LDADD = $(HTSLIB_HOME)/lib/libhts.a -ldl -lxml2 -lz -llzma -lbz2 -lpthread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* bamit.c -- iterator for reading BAM files one record at a time. | ||
Copyright (C) 2016 Genome Research Ltd. | ||
Author: Jennifer Liddle <[email protected]> | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published | ||
by the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "bamit.h" | ||
|
||
BAMit_t *BAMit_init(samFile *f, bam_hdr_t *h) | ||
{ | ||
int r; | ||
BAMit_t *bit = calloc(1,sizeof(BAMit_t)); | ||
bit->f = f; | ||
bit->h = h; | ||
bit->rec = bam_init1(); | ||
bit->nextRec = bam_init1(); | ||
if (f->is_write == 0) r = sam_read1(bit->f, bit->h, bit->nextRec); | ||
return bit; | ||
} | ||
|
||
void BAMit_free(void *ptr) | ||
{ | ||
BAMit_t *bit = (BAMit_t *)ptr; | ||
if (!bit) return; | ||
if (bit->f) hts_close(bit->f); | ||
if (bit->h) bam_hdr_destroy(bit->h); | ||
if (bit->rec) bam_destroy1(bit->rec); | ||
if (bit->nextRec) bam_destroy1(bit->nextRec); | ||
free(bit); | ||
} | ||
|
||
bam1_t *BAMit_next(BAMit_t *bit) | ||
{ | ||
if (!bit->nextRec) return NULL; | ||
bam_copy1(bit->rec,bit->nextRec); | ||
int r = sam_read1(bit->f, bit->h, bit->nextRec); | ||
if (r<0) { bam_destroy1(bit->nextRec); bit->nextRec = NULL; } | ||
return bit->rec; | ||
} | ||
|
||
bam1_t *BAMit_peek(BAMit_t *bit) | ||
{ | ||
return bit->nextRec; | ||
} | ||
|
||
bool BAMit_hasnext(BAMit_t *bit) | ||
{ | ||
return (bit->nextRec != NULL); | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* bamit.h -- BAM Iterator - for reading BAM files one record at a time. | ||
Copyright (C) 2016 Genome Research Ltd. | ||
Author: Jennifer Liddle <[email protected]> | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published | ||
by the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef __BAMIT_H__ | ||
#define __BAMIT_H__ | ||
|
||
#include <stdbool.h> | ||
#include <stdlib.h> | ||
#include "htslib/sam.h" | ||
|
||
/* | ||
* iterator structure | ||
*/ | ||
|
||
typedef struct { | ||
samFile *f; | ||
bam_hdr_t *h; | ||
bam1_t *rec; | ||
bam1_t *nextRec; | ||
} BAMit_t; | ||
|
||
BAMit_t *BAMit_init(samFile *f, bam_hdr_t *h); | ||
void BAMit_free(void *bit); | ||
bam1_t *BAMit_next(BAMit_t *bit); | ||
bam1_t *BAMit_peek(BAMit_t *bit); | ||
bool BAMit_hasnext(BAMit_t *bit); | ||
|
||
#endif | ||
|
Oops, something went wrong.