Skip to content

Commit

Permalink
Merge pull request #112 from deeptools/fix111
Browse files Browse the repository at this point in the history
  • Loading branch information
dpryan79 authored Feb 7, 2021
2 parents a0ef35a + 7dbec77 commit afb9ee2
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 19 deletions.
13 changes: 13 additions & 0 deletions .environmentLinux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: foo
channels:
- conda-forge
- bioconda
- default
dependencies:
- gcc_linux-64
- curl
- zlib
- python 3.8
- pip
- numpy
- nose
19 changes: 19 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on: pull_request
jobs:
testLinux:
name: TestLinux
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: foo
environment-file: .environmentLinux.yaml
python-version: 3.8
auto-activate-base: false
- run: |
pip install .
nosetests -sv
37 changes: 37 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: pypi
on: [push]
jobs:
pypi:
name: upload to pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup conda
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
run: |
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
hash -r
conda config --set always_yes yes --set changeps1 no
- name: create env
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
run: |
export PATH=$HOME/miniconda/bin:$PATH
conda create -n foo -q --yes -c conda-forge -c bioconda python=3.7 twine numpy libcurl curl zlib
- name: sdist
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
run: |
export PATH=$HOME/miniconda/bin:$PATH
source activate foo
rm -f dist/*
python setup.py sdist
- name: upload
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
export PATH=$HOME/miniconda/bin:$PATH
source activate foo
twine upload dist/*
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

10 changes: 9 additions & 1 deletion libBigWig/bigWig.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef LIBBIGWIG_H
#define LIBBIGWIG_H

#include "bigWigIO.h"
#include "bwValues.h"
#include <inttypes.h>
Expand Down Expand Up @@ -53,15 +56,18 @@ extern "C" {
/*!
* The library version number
*/
#define LIBBIGWIG_VERSION 0.4.4
#define LIBBIGWIG_VERSION 0.4.6

/*!
* If 1, then this library was compiled with remote file support.
*/
#ifdef NOCURL
#define LIBBIGWIG_CURL 0
#ifndef CURLTYPE_DEFINED
#define CURLTYPE_DEFINED
typedef int CURLcode;
typedef void CURL;
#endif
#else
#define LIBBIGWIG_CURL 1
#endif
Expand Down Expand Up @@ -596,3 +602,5 @@ int bwAppendIntervalSpanSteps(bigWigFile_t *fp, float *values, uint32_t n);
#ifdef __cplusplus
}
#endif

#endif // LIBBIGWIG_H
8 changes: 8 additions & 0 deletions libBigWig/bigWigIO.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#ifndef LIBBIGWIG_IO_H
#define LIBBIGWIG_IO_H

#ifndef NOCURL
#include <curl/curl.h>
#else
#include <stdio.h>
#ifndef CURLTYPE_DEFINED
#define CURLTYPE_DEFINED
typedef int CURLcode;
typedef void CURL;
#endif
#define CURLE_OK 0
#define CURLE_FAILED_INIT 1
#endif
Expand Down Expand Up @@ -100,3 +106,5 @@ URL_t *urlOpen(char *fname, CURLcode (*callBack)(CURL*), const char* mode);
* @warning URL will no longer point to a valid location in memory!
*/
void urlClose(URL_t *URL);

#endif // LIBBIGWIG_IO_H
2 changes: 1 addition & 1 deletion libBigWig/bwRead.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ bigWigFile_t *bwOpen(char *fname, CURLcode (*callBack) (CURL*), const char *mode
}

//Read in the index
if(bwg->hdr->nBasesCovered) {
if(bwg->hdr->indexOffset) {
bwg->idx = bwReadIndex(bwg, 0);
if(!bwg->idx) {
fprintf(stderr, "[bwOpen] bwg->idx is NULL bwg->hdr->dataOffset 0x%"PRIx64"!\n", bwg->hdr->dataOffset);
Expand Down
5 changes: 5 additions & 0 deletions libBigWig/bwValues.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef LIBBIGWIG_VALUES_H
#define LIBBIGWIG_VALUES_H

#include <inttypes.h>
/*! \file bwValues.h
*
Expand Down Expand Up @@ -70,3 +73,5 @@ typedef struct {
uint8_t type; /**<The block type: 1, bedGraph; 2, variable step; 3, fixed step.*/
uint16_t nItems; /**<The number of values in a given block.*/
} bwDataHeader_t;

#endif // LIBBIGWIG_VALUES_H
3 changes: 2 additions & 1 deletion pyBigWig.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ char *getNumpyStr(PyArrayObject *obj, Py_ssize_t i) {

//Return 1 if there are any entries at all
int hasEntries(bigWigFile_t *bw) {
if(bw->hdr->nBasesCovered > 0) return 1;
if(bw->hdr->indexOffset != 0) return 1; // No index, no entries pyBigWig issue #111
//if(bw->hdr->nBasesCovered > 0) return 1; // Sometimes headers are broken
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion pyBigWig.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <structmember.h>
#include "bigWig.h"

#define pyBigWigVersion "0.3.17"
#define pyBigWigVersion "0.3.18"

typedef struct {
PyObject_HEAD
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
include_dirs = include_dirs)

setup(name = 'pyBigWig',
version = '0.3.17',
version = '0.3.18',
description = 'A package for accessing bigWig files using libBigWig',
author = "Devon P. Ryan",
author_email = "[email protected]",
Expand Down

0 comments on commit afb9ee2

Please sign in to comment.