Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.3.3 #52

Merged
merged 4 commits into from
Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.2
0.3.3
Binary file modified samples/SRR1171591.variants.snp.vqsr.p.vcf.gz.px2
Binary file not shown.
Binary file modified samples/merged_nodup.tab.chrblock_sorted.txt.gz.px2
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions src/pairix.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#ifndef __TABIDX_H
#define __TABIDX_H

#define PACKAGE_VERSION "0.3.2"
#define PACKAGE_VERSION "0.3.3"

#include <stdint.h>
#include "kstring.h"
Expand Down Expand Up @@ -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
Expand Down
25 changes: 11 additions & 14 deletions src/pairixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ typedef struct {
PyObject_HEAD
pairix_t *tb;
char *fn;
PyObject *blocknames;
int linecount;
int nblocks;
} PairixObject;

typedef struct {
Expand Down Expand Up @@ -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",
Expand All @@ -391,23 +388,13 @@ 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;i<self->nblocks;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;
}

static void
pairix_dealloc(PairixObject *self)
{
free(self->fn);
Py_DECREF(self->blocknames);
ti_close(self->tb);
PyObject_Del(self);
}
Expand Down Expand Up @@ -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<n;i++){
PyObject *val = Py_BuildValue("s",blocknames[i]);
if(!val) { Py_DECREF(bnames); return NULL; }
PyList_SET_ITEM(bnames,i,val);
}
free(blocknames);
return bnames;
}

static PyObject *
Expand Down