diff --git a/README.md b/README.md index a3f56222..88a07ddb 100644 --- a/README.md +++ b/README.md @@ -633,6 +633,9 @@ ulimit -n 2000 ## Version history +### 0.3.3 +* The problem of `pypairix` `get_blocknames` crashing python when called twice now fixed. + ### 0.3.2 * `pairix -Y` option is now available to check whether a pairix-indexed file is a triangle (i.e. a chromosome pair occurs in one direction. e.g. if chr1|chr2 exists, chr2|chr1 doesn't) * `pypairix` `check_triangle` function is also now available to check whether a pairix-indexed file is a triangle. diff --git a/VERSION.txt b/VERSION.txt index d15723fb..1c09c74e 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -0.3.2 +0.3.3 diff --git a/samples/SRR1171591.variants.snp.vqsr.p.vcf.gz.px2 b/samples/SRR1171591.variants.snp.vqsr.p.vcf.gz.px2 index b3efbc16..9d6d6754 100644 Binary files a/samples/SRR1171591.variants.snp.vqsr.p.vcf.gz.px2 and b/samples/SRR1171591.variants.snp.vqsr.p.vcf.gz.px2 differ diff --git a/samples/merged_nodup.tab.chrblock_sorted.txt.gz.px2 b/samples/merged_nodup.tab.chrblock_sorted.txt.gz.px2 index 1c18dbc2..a02d9888 100644 Binary files a/samples/merged_nodup.tab.chrblock_sorted.txt.gz.px2 and b/samples/merged_nodup.tab.chrblock_sorted.txt.gz.px2 differ diff --git a/samples/merged_nodups.space.chrblock_sorted.subsample1.txt.gz.px2 b/samples/merged_nodups.space.chrblock_sorted.subsample1.txt.gz.px2 index a3f335c3..3208af5b 100644 Binary files a/samples/merged_nodups.space.chrblock_sorted.subsample1.txt.gz.px2 and b/samples/merged_nodups.space.chrblock_sorted.subsample1.txt.gz.px2 differ diff --git a/src/pairix.h b/src/pairix.h index e9ea6c82..c3f8118f 100644 --- a/src/pairix.h +++ b/src/pairix.h @@ -28,7 +28,7 @@ #ifndef __TABIDX_H #define __TABIDX_H -#define PACKAGE_VERSION "0.3.2" +#define PACKAGE_VERSION "0.3.3" #include #include "kstring.h" @@ -158,7 +158,7 @@ extern "C" { int get_nblocks(ti_index_t *idx, int tid, BGZF *fp); - /* check if a pairix-indexed file is a triangle + /* check if a pairix-indexed file is a triangle ( chromosome pairs occur only in one direction. e.g. if chr1|chr2 exists, chr2|chr1 shouldn't. ) * returns 1 if triangle * returns 0 if not a triangle diff --git a/src/pairixmodule.c b/src/pairixmodule.c index 49a7e9ab..5072f71d 100644 --- a/src/pairixmodule.c +++ b/src/pairixmodule.c @@ -40,9 +40,7 @@ typedef struct { PyObject_HEAD pairix_t *tb; char *fn; - PyObject *blocknames; int linecount; - int nblocks; } PairixObject; typedef struct { @@ -366,7 +364,6 @@ pairix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) const char *fn, *fnidx=NULL; static char *kwnames[]={"fn", "fnidx", NULL}; pairix_t *tb; - char **blocknames; int i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|z:open", @@ -391,15 +388,6 @@ pairix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; } self->linecount = get_linecount(self->tb->idx); - blocknames = ti_seqname(self->tb->idx, &(self->nblocks)); - self->blocknames = PyList_New(self->nblocks); - if(!self->blocknames) { return NULL; } - for(i=0;inblocks;i++){ - PyObject *val = Py_BuildValue("s",blocknames[i]); - if(!val) { Py_DECREF(self->blocknames); return NULL; } - PyList_SET_ITEM(self->blocknames,i,val); - } - free(blocknames); return (PyObject *)self; } @@ -407,7 +395,6 @@ static void pairix_dealloc(PairixObject *self) { free(self->fn); - Py_DECREF(self->blocknames); ti_close(self->tb); PyObject_Del(self); } @@ -612,7 +599,17 @@ pairix_get_linecount(PairixObject *self) static PyObject * pairix_get_blocknames(PairixObject *self) { - return self->blocknames; + int n,i; + char **blocknames = ti_seqname(self->tb->idx, &n); + PyObject *bnames = PyList_New(n); + if(!bnames) return NULL; + for(i=0;i