Commit f4801501 authored by Steffen Möller's avatar Steffen Möller
Browse files

New upstream version 0.8.5

parent d00e2e62
Loading
Loading
Loading
Loading
+41 −2
Original line number Diff line number Diff line
@@ -123,6 +123,36 @@ cdef class ArrayAccumulatingBlockHandler( BigWigBlockHandler ):
        for i from s - self.start <= i < e - self.start:
            array[ i ] = val

cdef class BigWigHeaderBlockHandler( BigWigBlockHandler ):
    "Reads and returns headers"
    cdef list headers

    def __init__( self, bits32 start, bits32 end ):
        BigWigBlockHandler.__init__( self, start, end )
        self.headers = []

    cdef handle_block( self, bytes block_data, BBIFile bbi_file ):
        cdef bits32 b_chrom_id, b_start, b_end, b_valid_count
        cdef bits32 b_item_step, b_item_span
        cdef bits16 b_item_count
        cdef UBYTE b_type
        cdef int s, e
        cdef float val
        # parse the block header
        block_reader = BinaryFileReader( BytesIO( block_data ), is_little_endian=bbi_file.reader.is_little_endian )
        b_chrom_id = block_reader.read_uint32()
        b_start = block_reader.read_uint32()
        b_end = block_reader.read_uint32()
        b_item_step = block_reader.read_uint32()
        b_item_span = block_reader.read_uint32()
        b_type = block_reader.read_uint8()
        block_reader.skip(1)
        b_item_count = block_reader.read_uint16()
        self.handle_header( b_start, b_end,  b_item_step, b_item_span, b_type, b_item_count )

    cdef handle_header( self, bits32 start, bits32 end, bits32 step, bits32 span, bits8 type, bits16 itemCount ):
        self.headers.append( ( start, end, step, span, type, itemCount ) )

cdef class BigWigFile( BBIFile ):
    """
    A "big binary indexed" file whose raw data is in wiggle format.
@@ -167,6 +197,15 @@ cdef class BigWigFile( BBIFile ):
        self.visit_blocks_in_region( chrom_id, start, end, v )
        return v.array

    cpdef get_headers( self, char * chrom, bits32 start, bits32 end ):
        if start >= end:
            return None
        chrom_id, chrom_size = self._get_chrom_id_and_size( chrom )
        if chrom_id is None:
            return None
        v = BigWigHeaderBlockHandler( start, end )
        self.visit_blocks_in_region( chrom_id, start, end, v )
        return v.headers



+15 −15
Original line number Diff line number Diff line
@@ -71,6 +71,6 @@ cdef class BPTFile:
            return None
        # Key is less than key_size, right pad with 0 bytes
        if len(key) < self.key_size:
            key += ( '\0' * ( self.key_size - len(key) ) )
            key += b'\0' * (self.key_size - len(key))
        # Call the recursive finder
        return self.r_find(self.root_offset, key)
+118 −114
Original line number Diff line number Diff line
import platform
import sys
from distutils.core import Command
from glob import glob

if sys.version_info < (2, 6):
    sys.exit("ERROR: bx-python requires Python 2.6 or greater")
@@ -12,14 +14,14 @@ except ImportError:
    from ez_setup import use_setuptools
    use_setuptools()

from setuptools import *
from glob import glob
from setuptools import Extension  # noqa: E402


def main():

    metadata = \
      dict( name = "bx-python",
            version = "0.8.4",
    metadata = dict(
        name="bx-python",
        version="0.8.5",
        setup_requires=['numpy', 'cython'],
        install_requires=['numpy', 'six'],
        py_modules=['psyco_full'],
@@ -40,15 +42,14 @@ def main():
            "License :: OSI Approved :: MIT License",
            "Operating System :: POSIX",
            "Programming Language :: Python :: 2",
                "Programming Language :: Python :: 2.6",
            "Programming Language :: Python :: 2.7",
            "Programming Language :: Python :: 3",
                "Programming Language :: Python :: 3.3",
                "Programming Language :: Python :: 3.4",
            "Programming Language :: Python :: 3.5",
            "Programming Language :: Python :: 3.6",
            "Programming Language :: Python :: 3.7",
            "Programming Language :: Python :: 3.8",
            "Topic :: Scientific/Engineering :: Bio-Informatics",
                "Topic :: Software Development :: Libraries :: Python Modules"
            ],
            "Topic :: Software Development :: Libraries :: Python Modules"],
        zip_safe=False,
        dependency_links=[],
        cmdclass=command_classes)
@@ -58,11 +59,11 @@ def main():
        import numpy
        # Suppress numpy tests
        numpy.test = None
    except:
    except Exception:
        pass

    if len(sys.argv) >= 2 and ('--help' in sys.argv[1:] or
            sys.argv[1] in ('--help-commands', 'egg_info', '--version', 'clean')):
    if len(sys.argv) >= 2 and \
            ('--help' in sys.argv[1:] or sys.argv[1] in ('--help-commands', 'egg_info', '--version', 'clean')):
        # For these actions, NumPy is not required.
        #
        # They are required to succeed without Numpy for example when
@@ -80,14 +81,12 @@ def main():

# ---- Commands -------------------------------------------------------------

from distutils.core import Command

# Use build_ext from Cython if found
command_classes = {}
try:
    import Cython.Distutils
    command_classes['build_ext'] = Cython.Distutils.build_ext
except:
except Exception:
    pass

# Run 2to3 builder if we're on Python 3.x, from
@@ -103,14 +102,20 @@ command_classes['build_py'] = build_py
try:
    import pkg_resources
    pkg_resources.require("epydoc")
    import epydoc.cli, sys, os, os.path
    import epydoc.cli
    import os
    import os.path

    # Create command class to build API documentation
    class BuildAPIDocs(Command):
        user_options = []

        def initialize_options(self):
            pass

        def finalize_options(self):
            pass

        def run(self):
            # Save working directory and args
            old_argv = sys.argv
@@ -133,7 +138,7 @@ try:
            os.chdir(old_cwd)
    # Add to extra_commands
    command_classes['build_apidocs'] = BuildAPIDocs
except:
except Exception:
    pass

# ---- Extension Modules ----------------------------------------------------
@@ -143,6 +148,7 @@ except:
# _Extension = Extension
# Extension = partial(_Extension, extra_compile_args=["-Wno-cpp"])


def get_extension_modules(numpy_include=None):
    extensions = []
    # Bitsets
@@ -168,10 +174,8 @@ def get_extension_modules( numpy_include=None ):
                                include_dirs=["src/samtools"],
                                libraries=['z']))

    
    # The following extensions won't (currently) compile on windows
    if platform.system() not in ('Microsoft', 'Windows'):
        
        # Interval clustering
        extensions.append(Extension("bx.intervals.cluster",
                                    ["lib/bx/intervals/cluster.pyx",
@@ -202,9 +206,8 @@ def get_extension_modules( numpy_include=None ):
        extensions.append(Extension("bx.arrays.bed", ["lib/bx/arrays/bed.pyx"]))
        extensions.append(Extension("bx.arrays.wiggle", ["lib/bx/arrays/wiggle.pyx"]))


        # CpG masking
        extensions.append( Extension( "bx.align.sitemask._cpg", \
        extensions.append(Extension("bx.align.sitemask._cpg",
                                    ["lib/bx/align/sitemask/_cpg.pyx",
                                     "lib/bx/align/sitemask/find_cpg.c"]))

@@ -219,5 +222,6 @@ def get_extension_modules( numpy_include=None ):
                                    include_dirs=["src/bunzip"]))
    return extensions


if __name__ == "__main__":
    main()