Skip to content

Commit

Permalink
Merge branch 'prep_0.1.21' into 'master'
Browse files Browse the repository at this point in the history
prepare 0.1.21

See merge request minknow/pod5-file-format!245
  • Loading branch information
HalfPhoton committed Apr 28, 2023
2 parents 77655ae + 6f21364 commit 1805d22
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 14 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ All notable changes, updates, and fixes to pod5 will be documented here
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
## [0.1.21] 2023-04-27

### Fixed

- Repacker reads_completed value while copying a selection of reads.
- Repacker `reads_completed` value while copying a selection of reads.
- Fixed crash when trying to load files with a bad footer.

## [0.1.20] 2023-04-20
Expand Down
2 changes: 1 addition & 1 deletion python/pod5/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ classifiers=[
dependencies = [
"iso8601",
"jsonschema",
"lib_pod5 ~= 0.1.20dev0",
"lib_pod5 ~= 0.1.21dev0",
"more_itertools",
"numpy >= 1.20.0",
"pyarrow ~= 11.0.0",
Expand Down
6 changes: 3 additions & 3 deletions python/pod5/src/pod5/repack.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import lib_pod5 as p5b

import pod5 as p5
from tqdm import tqdm
from pod5.tools.utils import PBAR_DEFAULTS
from tqdm.auto import tqdm

# The default interval in seconds to check for completion
DEFAULT_INTERVAL = 0.5
Expand Down Expand Up @@ -161,10 +162,10 @@ def wait(
disable_pbar = not bool(int(os.environ.get("POD5_PBAR", 1))) or not show_pbar
pbar = tqdm(
total=self.reads_requested,
ascii=True,
disable=disable_pbar,
leave=leave_pbar,
unit="Reads",
**PBAR_DEFAULTS,
)

last_time, last_bytes, last_reads = time.time(), 0, 0
Expand All @@ -187,7 +188,6 @@ def wait(
pbar.total = self.reads_requested
pbar.update(self.reads_completed - last_reads)
last_reads = self.reads_completed
# tqdm.write(f"{self.reads_completed} , {self.reads_requested}")

if finish:
self.finish()
Expand Down
5 changes: 2 additions & 3 deletions python/pod5/src/pod5/tools/pod5_convert_from_fast5.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import pod5 as p5
from pod5.signal_tools import DEFAULT_SIGNAL_CHUNK_SIZE, vbz_compress_signal_chunked
from pod5.tools.parsers import pod5_convert_from_fast5_argparser, run_tool
from pod5.tools.utils import is_pod5_debug, iterate_inputs
from pod5.tools.utils import PBAR_DEFAULTS, is_pod5_debug, iterate_inputs

READ_CHUNK_SIZE = 400
TIMEOUT_SECONDS = 600
Expand Down Expand Up @@ -371,12 +371,11 @@ def __init__(self, paths: List[Path]):
disable_pbar = not bool(int(os.environ.get("POD5_PBAR", 1)))
self.pbar = tqdm(
total=self.total_reads,
ascii=True,
disable=disable_pbar,
desc=f"Converting {len(self.path_reads)} Fast5s",
unit="Reads",
leave=True,
dynamic_ncols=True,
**PBAR_DEFAULTS,
)

@property
Expand Down
3 changes: 2 additions & 1 deletion python/pod5/src/pod5/tools/pod5_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import pod5 as p5
import pod5.repack as p5_repack
from pod5.tools.parsers import prepare_pod5_merge_argparser, run_tool
from pod5.tools.utils import PBAR_DEFAULTS
from tqdm import tqdm

# Default number of files to merge at a time
Expand Down Expand Up @@ -75,9 +76,9 @@ def merge_pod5(
disable_pbar = not bool(int(os.environ.get("POD5_PBAR", 1)))
pbar = tqdm(
total=len(inputs),
ascii=True,
disable=disable_pbar or len(chunks) == 1,
unit="Files",
**PBAR_DEFAULTS,
)

for chunk in chunks:
Expand Down
7 changes: 5 additions & 2 deletions python/pod5/src/pod5/tools/pod5_repack.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import sys
import typing
from pathlib import Path
from tqdm import tqdm
from pod5.tools.utils import PBAR_DEFAULTS
from tqdm.auto import tqdm

import pod5 as p5
import pod5.repack
Expand Down Expand Up @@ -51,7 +52,9 @@ def repack_pod5(
futures = {}
with ProcessPoolExecutor(max_workers=threads) as executor:

pbar = tqdm(total=len(inputs), ascii=True, disable=disable_pbar, unit="Files")
pbar = tqdm(
total=len(inputs), disable=disable_pbar, unit="Files", **PBAR_DEFAULTS
)

for src in inputs:
dest = output / src.name
Expand Down
5 changes: 3 additions & 2 deletions python/pod5/src/pod5/tools/pod5_subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

import jsonschema
import pandas as pd
from tqdm import tqdm
from pod5.tools.utils import PBAR_DEFAULTS
from tqdm.auto import tqdm

import pod5 as p5
import pod5.repack as p5_repack
Expand Down Expand Up @@ -353,9 +354,9 @@ def subset_pod5s_with_mapping(
with ProcessPoolExecutor(max_workers=n_workers) as executor:
pbar = tqdm(
total=len(transfers),
ascii=True,
disable=(disable_pbar or single_transfer),
unit="Files",
**PBAR_DEFAULTS,
)

# Launch the subsetting jobs
Expand Down
3 changes: 3 additions & 0 deletions python/pod5/src/pod5/tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
from pathlib import Path


PBAR_DEFAULTS = dict(ascii=True, smoothing=0.0, dynamic_ncols=True)


def iterate_inputs(
input_items: typing.Iterable[Path], recursive: bool, file_pattern: str
) -> typing.Generator[Path, None, None]:
Expand Down

0 comments on commit 1805d22

Please sign in to comment.