[med-svn] [Git][med-team/pybigwig][master] 10 commits: drop uupdate

Andreas Tille (@tille) gitlab at salsa.debian.org
Thu Feb 17 15:35:08 GMT 2022



Andreas Tille pushed to branch master at Debian Med / pybigwig


Commits:
4110384f by Andreas Tille at 2022-02-17T16:32:14+01:00
drop uupdate

- - - - -
a6dedc88 by Andreas Tille at 2022-02-17T16:32:30+01:00
New upstream version 0.3.18+dfsg
- - - - -
d45d93a7 by Andreas Tille at 2022-02-17T16:32:30+01:00
routine-update: New upstream version

- - - - -
b6331d84 by Andreas Tille at 2022-02-17T16:32:30+01:00
Update upstream source from tag 'upstream/0.3.18+dfsg'

Update to upstream version '0.3.18+dfsg'
with Debian dir 04873a7da79fd24b4b440950bf72adb24fa52dcc
- - - - -
34963318 by Andreas Tille at 2022-02-17T16:32:30+01:00
routine-update: Standards-Version: 4.6.0

- - - - -
874435c5 by Andreas Tille at 2022-02-17T16:32:30+01:00
routine-update: debhelper-compat 13

- - - - -
a151425c by Andreas Tille at 2022-02-17T16:32:33+01:00
routine-update: Add salsa-ci file

- - - - -
78756ed8 by Andreas Tille at 2022-02-17T16:32:33+01:00
routine-update: Rules-Requires-Root: no

- - - - -
1f26c0bd by Andreas Tille at 2022-02-17T16:32:37+01:00
Set upstream metadata fields: Bug-Database, Bug-Submit, Repository, Repository-Browse.

Changes-By: lintian-brush
Fixes: lintian: upstream-metadata-file-is-missing
See-also: https://lintian.debian.org/tags/upstream-metadata-file-is-missing.html
Fixes: lintian: upstream-metadata-missing-bug-tracking
See-also: https://lintian.debian.org/tags/upstream-metadata-missing-bug-tracking.html
Fixes: lintian: upstream-metadata-missing-repository
See-also: https://lintian.debian.org/tags/upstream-metadata-missing-repository.html

- - - - -
9f88a73d by Andreas Tille at 2022-02-17T16:33:30+01:00
routine-update: Ready to upload to unstable

- - - - -


15 changed files:

- + .environmentLinux.yaml
- + .github/workflows/build.yml
- + .github/workflows/pypi.yml
- − .travis.yml
- README.md
- debian/changelog
- − debian/compat
- debian/control
- + debian/salsa-ci.yml
- + debian/upstream/metadata
- debian/watch
- pyBigWig.c
- pyBigWig.h
- pyBigWigTest/test.py
- setup.py


Changes:

=====================================
.environmentLinux.yaml
=====================================
@@ -0,0 +1,13 @@
+name: foo
+channels:
+  - conda-forge
+  - bioconda
+  - default
+dependencies:
+  - gcc_linux-64
+  - curl
+  - zlib
+  - python 3.8
+  - pip
+  - numpy
+  - nose


=====================================
.github/workflows/build.yml
=====================================
@@ -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 at v2
+      - uses: conda-incubator/setup-miniconda at v2
+        with:
+          activate-environment: foo
+          environment-file: .environmentLinux.yaml
+          python-version: 3.8
+          auto-activate-base: false
+      - run: |
+          pip install .
+          nosetests -sv


=====================================
.github/workflows/pypi.yml
=====================================
@@ -0,0 +1,37 @@
+name: pypi
+on: [push]
+jobs:
+  pypi:
+    name: upload to pypi
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout at 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/*


=====================================
.travis.yml deleted
=====================================
@@ -1,11 +0,0 @@
-language: python
-python:
-  - "3.5"
-  - "3.6"
-install:
-  - pip install numpy && python ./setup.py install
-matrix:
-  include:
-    - python: 3.7
-      dist: xenial
-script: nosetests -sv


=====================================
README.md
=====================================
@@ -7,6 +7,7 @@ Table of Contents
 =================
 
   * [Installation](#installation)
+    * [Requirements](#requirements)
   * [Usage](#usage)
     * [Load the extension](#load-the-extension)
     * [Open a bigWig or bigBed file](#open-a-bigwig-or-bigbed-file)
@@ -34,9 +35,16 @@ You can install this extension directly from github with:
 
 or with conda
 
-    conda install pybigwig -c bioconda
+    conda install pybigwig -c conda-forge -c bioconda
 
-Note that libcurl (and the `curl-config` command) are required for installation. This is typically already installed on many Linux and OSX systems (if you install with conda then this will happen automatically).
+## Requirements
+
+The follow non-python requirements must be installed:
+
+ - libcurl (and the `curl-config` config)
+ - zlib
+
+The headers and libraries for these are required.
 
 # Usage
 Basic usage is as follows:


=====================================
debian/changelog
=====================================
@@ -1,3 +1,16 @@
+pybigwig (0.3.18+dfsg-1) unstable; urgency=medium
+
+  * Team upload.
+  * d/watch: drop uupdate
+  * Standards-Version: 4.6.0 (routine-update)
+  * debhelper-compat 13 (routine-update)
+  * Add salsa-ci file (routine-update)
+  * Rules-Requires-Root: no (routine-update)
+  * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository,
+    Repository-Browse.
+
+ -- Andreas Tille <tille at debian.org>  Thu, 17 Feb 2022 16:32:40 +0100
+
 pybigwig (0.3.17-1) unstable; urgency=medium
 
   [ Steffen Möller ]


=====================================
debian/compat deleted
=====================================
@@ -1 +0,0 @@
-11


=====================================
debian/control
=====================================
@@ -2,7 +2,7 @@ Source: pybigwig
 Priority: optional
 Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
 Uploaders: Diane Trout <diane at ghic.org>
-Build-Depends: debhelper (>= 11),
+Build-Depends: debhelper-compat (= 13),
                dh-python,
                libcurl4-gnutls-dev,
                zlib1g-dev,
@@ -15,11 +15,12 @@ Build-Depends: debhelper (>= 11),
                python3-all-dev,
                python3-numpy,
                python3-setuptools
-Standards-Version: 4.3.0
+Standards-Version: 4.6.0
 Vcs-Git: https://salsa.debian.org/med-team/pybigwig.git
 Vcs-Browser: https://salsa.debian.org/med-team/pybigwig
 Section: science
 Homepage: https://github.com/dpryan79/pyBigWig
+Rules-Requires-Root: no
 
 Package: python3-pybigwig
 Architecture: any


=====================================
debian/salsa-ci.yml
=====================================
@@ -0,0 +1,4 @@
+---
+include:
+  - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
+  - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml


=====================================
debian/upstream/metadata
=====================================
@@ -0,0 +1,5 @@
+---
+Bug-Database: https://github.com/deeptools/pyBigWig/issues
+Bug-Submit: https://github.com/deeptools/pyBigWig/issues/new
+Repository: https://github.com/deeptools/pyBigWig.git
+Repository-Browse: https://github.com/deeptools/pyBigWig


=====================================
debian/watch
=====================================
@@ -1,5 +1,3 @@
 version=4
-# Diane started with .gz, did not want to change albeit now repacking -- Steffen
 opts="dversionmangle=auto,oversionmangle=s/$/+dfsg/,compression=gz,repack,filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%python-pybigwig-$1.tar.gz%" \
-   https://github.com/deeptools/pyBigWig/tags \
-   (?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate
+   https://github.com/deeptools/pyBigWig/tags (?:.*?/)?v?(\d[\d.]*)\.tar\.gz


=====================================
pyBigWig.c
=====================================
@@ -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;
 }
 
@@ -378,9 +379,10 @@ static PyObject *pyBwGetStats(pyBigWigFile_t *self, PyObject *args, PyObject *kw
     double *val;
     uint32_t start, end = -1, tid;
     unsigned long startl = 0, endl = -1;
-    static char *kwd_list[] = {"chrom", "start", "end", "type", "nBins", "exact", NULL};
+    static char *kwd_list[] = {"chrom", "start", "end", "type", "nBins", "exact", "numpy", NULL};
     char *chrom, *type = "mean";
     PyObject *ret, *exact = Py_False, *starto = NULL, *endo = NULL;
+    PyObject *outputNumpy = Py_False;
     int i, nBins = 1;
     errno = 0; //In the off-chance that something elsewhere got an error and didn't clear it...
 
@@ -399,7 +401,7 @@ static PyObject *pyBwGetStats(pyBigWigFile_t *self, PyObject *args, PyObject *kw
         return NULL;
     }
 
-    if(!PyArg_ParseTupleAndKeywords(args, kwds, "s|OOsiO", kwd_list, &chrom, &starto, &endo, &type, &nBins, &exact)) {
+    if(!PyArg_ParseTupleAndKeywords(args, kwds, "s|OOsiOO", kwd_list, &chrom, &starto, &endo, &type, &nBins, &exact, &outputNumpy)) {
         PyErr_SetString(PyExc_RuntimeError, "You must supply at least a chromosome!");
         return NULL;
     }
@@ -464,11 +466,26 @@ static PyObject *pyBwGetStats(pyBigWigFile_t *self, PyObject *args, PyObject *kw
 
     //Return a list of None if there are no entries at all
     if(!hasEntries(bw)) {
-        ret = PyList_New(nBins);
-        for(i=0; i<nBins; i++) {
-            Py_INCREF(Py_None);
-            PyList_SetItem(ret, i, Py_None);
+#ifdef WITHNUMPY
+        if(outputNumpy == Py_True) {
+            val = malloc(sizeof(double)*nBins);
+            for(i=0; i<nBins; i++) {
+                val[i] = NPY_NAN;
+            }
+            npy_intp len = nBins;
+            ret = PyArray_SimpleNewFromData(1, &len, NPY_FLOAT64, (void *) val);
+            //This will break if numpy ever stops using malloc!
+            PyArray_ENABLEFLAGS((PyArrayObject*) ret, NPY_ARRAY_OWNDATA);
+        } else {
+#endif
+            ret = PyList_New(nBins);
+            for(i=0; i<nBins; i++) {
+                Py_INCREF(Py_None);
+                PyList_SetItem(ret, i, Py_None);
+            }
+#ifdef WITHNUMPY
         }
+#endif
         return ret;
     }
 
@@ -484,17 +501,27 @@ static PyObject *pyBwGetStats(pyBigWigFile_t *self, PyObject *args, PyObject *kw
         return NULL;
     }
 
-    ret = PyList_New(nBins);
-    for(i=0; i<nBins; i++) {
-        if(isnan(val[i])) {
-            Py_INCREF(Py_None);
-            PyList_SetItem(ret, i, Py_None);
-        } else {
-            PyList_SetItem(ret, i, PyFloat_FromDouble(val[i]));
+#ifdef WITHNUMPY
+    if(outputNumpy == Py_True) {
+        npy_intp len = nBins;
+        ret = PyArray_SimpleNewFromData(1, &len, NPY_FLOAT64, (void *) val);
+        //This will break if numpy ever stops using malloc!
+        PyArray_ENABLEFLAGS((PyArrayObject*) ret, NPY_ARRAY_OWNDATA);
+    } else {
+#endif
+        ret = PyList_New(nBins);
+        for(i=0; i<nBins; i++) {
+            if(isnan(val[i])) {
+                Py_INCREF(Py_None);
+                PyList_SetItem(ret, i, Py_None);
+            } else {
+                PyList_SetItem(ret, i, PyFloat_FromDouble(val[i]));
+            }
         }
+        free(val);
+#ifdef WITHNUMPY
     }
-    free(val);
-
+#endif
     return ret;
 }
 


=====================================
pyBigWig.h
=====================================
@@ -2,7 +2,7 @@
 #include <structmember.h>
 #include "bigWig.h"
 
-#define pyBigWigVersion "0.3.17"
+#define pyBigWigVersion "0.3.18"
 
 typedef struct {
     PyObject_HEAD


=====================================
pyBigWigTest/test.py
=====================================
@@ -308,3 +308,23 @@ class TestNumpy():
 
         bw.close()
         os.remove("/tmp/delete.bw")
+
+    def testNumpyValues(self):
+        if pyBigWig.numpy == 0:
+            return 0
+        import numpy as np
+
+        fname = "http://raw.githubusercontent.com/dpryan79/pyBigWig/master/pyBigWigTest/test.bw"
+        bw = pyBigWig.open(fname, "r")
+
+        assert np.allclose(
+            bw.values("1", 0, 20, numpy=True),
+            np.array(bw.values("1", 0, 20), dtype=np.float32),
+            equal_nan=True
+        )
+
+        assert np.allclose(
+            bw.stats("1", 0, 20, "mean", 5, numpy=True),
+            np.array(bw.stats("1", 0, 20, "mean", 5), dtype=np.float64),
+            equal_nan=True
+        )


=====================================
setup.py
=====================================
@@ -62,7 +62,7 @@ module1 = Extension('pyBigWig',
                     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 = "ryan at ie-freiburg.mpg.de",



View it on GitLab: https://salsa.debian.org/med-team/pybigwig/-/compare/499c414bd1992cc5eaeedd6c3f8f6ea31bc355f4...9f88a73d0e433480b6542922a297175ca7b4e616

-- 
View it on GitLab: https://salsa.debian.org/med-team/pybigwig/-/compare/499c414bd1992cc5eaeedd6c3f8f6ea31bc355f4...9f88a73d0e433480b6542922a297175ca7b4e616
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20220217/3bcc7b7c/attachment-0001.htm>


More information about the debian-med-commit mailing list