Skip to content

Commit

Permalink
Merge branch 'feature/fix_inspect' into 'master'
Browse files Browse the repository at this point in the history
Fix inspect tool

See merge request minknow/pod5-file-format!120
  • Loading branch information
0x55555555 committed Oct 27, 2022
2 parents 70b08c6 + d3e78de commit 3e09909
Showing 1 changed file with 11 additions and 26 deletions.
37 changes: 11 additions & 26 deletions python/pod5_format_tools/pod5_format_tools/pod5_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def format_shift_scale_pair_num(pair):
return f"({pair.shift:.1f} {pair.scale:.1f})"


def do_reads_command(readerer):
def do_reads_command(reader):
keys = [
"read_id",
"channel",
Expand All @@ -33,17 +33,12 @@ def do_reads_command(readerer):
"num_samples",
"byte_count",
"signal_compression_ratio",
"num_minknow_events",
"tracked_scaling",
"predicted_scaling",
"num_reads_since_mux_change",
"time_since_mux_change",
]
if reader.reads_table_version >= p5.reader.ReadTableVersion.V1:
keys.extend(
[
"num_minknow_events",
"tracked_scaling",
"predicted_scaling",
"num_reads_since_mux_change",
"time_since_mux_change",
]
)

csv_read_writer = csv.DictWriter(sys.stdout, keys)
csv_read_writer.writeheader()
Expand All @@ -60,23 +55,13 @@ def do_reads_command(readerer):
"num_samples": read.num_samples,
"byte_count": read.byte_count,
"signal_compression_ratio": f"{read.byte_count / float(read.sample_count*2):.3f}",
"num_minknow_events": read.num_minknow_events,
"tracked_scaling": format_shift_scale_pair_num(read.tracked_scaling),
"predicted_scaling": format_shift_scale_pair_num(read.predicted_scaling),
"num_reads_since_mux_change": read.num_reads_since_mux_change,
"time_since_mux_change": read.time_since_mux_change,
}

if reader.reads_table_version >= p5.reader.ReadTableVersion.V1:
fields.update(
{
"num_minknow_events": read.num_minknow_events,
"tracked_scaling": format_shift_scale_pair_num(
read.tracked_scaling
),
"predicted_scaling": format_shift_scale_pair_num(
read.predicted_scaling
),
"num_reads_since_mux_change": read.num_reads_since_mux_change,
"time_since_mux_change": read.time_since_mux_change,
}
)

try:
csv_read_writer.writerow(fields)
except BrokenPipeError:
Expand Down

0 comments on commit 3e09909

Please sign in to comment.