From 25b2ae15dc3a74aa4a4c8ff37e35ebd9f30f0119 Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Tue, 1 Mar 2022 00:12:53 +0000 Subject: [PATCH] Bump version --- CHANGELOG.md | 5 +++++ README.md | 14 ++++++++------ modbampy/__init__.py | 5 ++--- src/version.h | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 507d09e..25f2905 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v0.5.0] +### Changed +- Decouple file opening from read iteration. +- Move Python pileup function to method of ModBam class. + ## [v0.4.6] ### Changed - Reworked compilation to remove argparser from Python module. diff --git a/README.md b/README.md index 1745dce..7b25b7e 100644 --- a/README.md +++ b/README.md @@ -148,9 +148,9 @@ over reads in a BAM file and report modification sites: ``` from modbampy import ModBam -with ModBam(args.bam, args.chrom, args.start, args.end) as bam: +with ModBam(args.bam) as bam: for read in bam.reads(): - for pos_mod in read.mod_sites(): + for pos_mod in read.mod_sites(args.chrom, args.start, args.end): print(*pos_mod) ``` @@ -165,13 +165,15 @@ Each line of the above reports the * modified base, * modified-base score (scaled to 0-255). -A second function is provided which mimics the couting procedure implemented in +A second method is provided which mimics the couting procedure implemented in `modbam2bed`: ``` -positions, counts = pileup( - bam, chrom, start, end, - low_threshold=0.33, high_threshold=0.66, mod_base="m") +from modbampy import ModBam +with ModBam(args.bam) as bam: + positions, counts = bam.pileup( + args.chrom, args.start, args.end + low_threshold=0.33, high_threshold=0.66, mod_base="m") ``` The result is two [numpy](https://numpy.org/) arrays. The first indicates the reference diff --git a/modbampy/__init__.py b/modbampy/__init__.py index 9b6eb85..4030447 100644 --- a/modbampy/__init__.py +++ b/modbampy/__init__.py @@ -8,7 +8,7 @@ import libmodbampy # remember to bump version in src/version.h too -__version__ = "0.4.6" +__version__ = "0.5.0" ffi = libmodbampy.ffi libbam = libmodbampy.lib @@ -40,8 +40,7 @@ def _tidy_args(read_group, tag_name, tag_value): class ModBam: """A minimal class to iterate over a bam.""" - def __init__( - self, bam, read_group=None, tag_name=None, tag_value=None): + def __init__(self, bam): """Open a BAM file. :param bam: BAM file to open. diff --git a/src/version.h b/src/version.h index 9d3528a..1ac009d 100644 --- a/src/version.h +++ b/src/version.h @@ -1,2 +1,2 @@ // remember to bump version in modbampy/__init__.py too -const char *argp_program_version = "0.4.6"; +const char *argp_program_version = "0.5.0";