|
|
@@ -63,7 +63,8 @@ impl Pod5Info {
|
|
|
let mut file = File::open(file_path)
|
|
|
.map_err(|e| anyhow::anyhow!("Failed to open POD5 file '{}': {}", file_path, e))?;
|
|
|
|
|
|
- let end = file.seek(SeekFrom::End(0))
|
|
|
+ let end = file
|
|
|
+ .seek(SeekFrom::End(0))
|
|
|
.map_err(|e| anyhow::anyhow!("Failed to seek in '{}': {}", file_path, e))?;
|
|
|
|
|
|
if end < 32 {
|
|
|
@@ -75,8 +76,9 @@ impl Pod5Info {
|
|
|
.map_err(|e| anyhow::anyhow!("Seek failed in '{}': {}", file_path, e))?;
|
|
|
|
|
|
let mut buffer = [0u8; 8];
|
|
|
- file.read_exact(&mut buffer)
|
|
|
- .map_err(|e| anyhow::anyhow!("Failed to read footer length from '{}': {}", file_path, e))?;
|
|
|
+ file.read_exact(&mut buffer).map_err(|e| {
|
|
|
+ anyhow::anyhow!("Failed to read footer length from '{}': {}", file_path, e)
|
|
|
+ })?;
|
|
|
|
|
|
let footer_len = i64::from_le_bytes(buffer);
|
|
|
|
|
|
@@ -123,7 +125,10 @@ impl Pod5Info {
|
|
|
&mut file,
|
|
|
content.offset() as u64,
|
|
|
content.length() as u64,
|
|
|
- ).map_err(|e| anyhow::anyhow!("Failed to read RunInfoTable from '{}': {}", file_path, e))?;
|
|
|
+ )
|
|
|
+ .map_err(|e| {
|
|
|
+ anyhow::anyhow!("Failed to read RunInfoTable from '{}': {}", file_path, e)
|
|
|
+ })?;
|
|
|
|
|
|
let batch = match batches.first() {
|
|
|
Some(b) => b,
|
|
|
@@ -172,21 +177,25 @@ fn extract_column(col: &str, array: &ArrayRef, info: &mut Pod5Info) {
|
|
|
}
|
|
|
DataType::Utf8 => {
|
|
|
if let Some(a) = array.as_any().downcast_ref::<StringArray>() {
|
|
|
- let value: String = a.iter().filter_map(|v| v.map(|s| s.to_string())).collect::<Vec<_>>().join(" ");
|
|
|
+ let value: String = a
|
|
|
+ .iter()
|
|
|
+ .filter_map(|v| v.map(|s| s.to_string()))
|
|
|
+ .collect::<Vec<_>>()
|
|
|
+ .join(" ");
|
|
|
match col {
|
|
|
- "acquisition_id" => info.acquisition_id = value,
|
|
|
- "experiment_name" => info.experiment_name = value,
|
|
|
- "flow_cell_id" => info.flow_cell_id = value,
|
|
|
- "flow_cell_product_code" => info.flow_cell_product_code = value,
|
|
|
- "protocol_name" => info.protocol_name = value,
|
|
|
- "protocol_run_id" => info.protocol_run_id = value,
|
|
|
- "sample_id" => info.sample_id = value,
|
|
|
- "sequencing_kit" => info.sequencing_kit = value,
|
|
|
- "sequencer_position" => info.sequencer_position = value,
|
|
|
+ "acquisition_id" => info.acquisition_id = value,
|
|
|
+ "experiment_name" => info.experiment_name = value,
|
|
|
+ "flow_cell_id" => info.flow_cell_id = value,
|
|
|
+ "flow_cell_product_code" => info.flow_cell_product_code = value,
|
|
|
+ "protocol_name" => info.protocol_name = value,
|
|
|
+ "protocol_run_id" => info.protocol_run_id = value,
|
|
|
+ "sample_id" => info.sample_id = value,
|
|
|
+ "sequencing_kit" => info.sequencing_kit = value,
|
|
|
+ "sequencer_position" => info.sequencer_position = value,
|
|
|
"sequencer_position_type" => info.sequencer_position_type = value,
|
|
|
- "software" => info.software = value,
|
|
|
- "system_name" => info.system_name = value,
|
|
|
- "system_type" => info.system_type = value,
|
|
|
+ "software" => info.software = value,
|
|
|
+ "system_name" => info.system_name = value,
|
|
|
+ "system_type" => info.system_type = value,
|
|
|
_ => debug!("pod5: unrecognised Utf8 column '{col}'"),
|
|
|
}
|
|
|
}
|
|
|
@@ -199,7 +208,7 @@ fn extract_column(col: &str, array: &ArrayRef, info: &mut Pod5Info) {
|
|
|
if let Some(dt) = Utc.timestamp_millis_opt(a.value(i)).single() {
|
|
|
match col {
|
|
|
"acquisition_start_time" => info.acquisition_start_time = dt,
|
|
|
- "protocol_start_time" => info.protocol_start_time = dt,
|
|
|
+ "protocol_start_time" => info.protocol_start_time = dt,
|
|
|
_ => debug!("pod5: unrecognised Timestamp column '{col}'"),
|
|
|
}
|
|
|
}
|