Writing POD5 Files¶
escapepod.Writer creates new POD5 files. Signal is compressed with the VBZ
codec automatically. Use it as a context manager so the footer is written and
the file is finalized on exit.
A minimal round trip¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
Run info¶
Every read references a run info by index. Create one with create_run_info
(or construct a RunInfo directly) and register it with
writer.add_run_info, which returns the index to pass as run_info_index:
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Only acquisition_id is required; every other field has a sensible default
(see the RunInfo constructor for the full list).
Adding reads¶
add_read takes the read fields as keyword arguments plus a numpy int16
signal array. The required fields are shown in the round trip above; the
optional scaling/mux fields (tracked_scaling_scale, predicted_scaling_shift,
open_pore_level, …) default to zero/one and can be omitted.
Signal must be numpy.int16 (raw ADC). num_samples is inferred from the
array length unless you pass it explicitly.
From an existing ReadData¶
If you already have a ReadData — for example
when copying or transforming reads from another file — write it directly with
add_read_data:
1 2 3 4 5 6 7 8 9 | |
For many reads at once, add_reads(reads, signals) takes a list of ReadData
and a matching list of int16 signal arrays.
Writer options¶
Tuning options are keyword arguments on the constructor; all are optional:
1 2 3 4 5 6 7 8 | |
Closing¶
Exiting the with block finalizes the file. If you don't use a context
manager, call writer.close() explicitly — the file is not valid until it is
closed.
1 2 3 | |
The RunInfo object¶
create_run_info(...) returns a RunInfo; you can also construct one directly
with escapepod.RunInfo(acquisition_id, ...). Its fields are exposed as
read-only properties: acquisition_id, acquisition_start_time, adc_min,
adc_max, experiment_name, flow_cell_id, flow_cell_product_code,
protocol_name, protocol_run_id, protocol_start_time, sample_id,
sample_rate, sequencing_kit, sequencer_position,
sequencer_position_type, software, system_name, system_type,
context_tags, and tracking_id.