Kaynağa Gözat

Flowcells load gz

Thomas 11 ay önce
ebeveyn
işleme
c744ed35cf
3 değiştirilmiş dosya ile 214 ekleme ve 196 silme
  1. 189 175
      Cargo.lock
  2. 3 2
      src/collection/flowcells.rs
  3. 22 19
      src/collection/minknow.rs

Dosya farkı çok büyük olduğundan ihmal edildi
+ 189 - 175
Cargo.lock


+ 3 - 2
src/collection/flowcells.rs

@@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize};
 
 use crate::{
     collection::minknow::{parse_pore_activity_from_reader, parse_throughput_from_reader},
-    helpers::{find_files, list_directories}, io::writers::get_gz_writer,
+    helpers::{find_files, list_directories}, io::{readers::get_gz_reader, writers::get_gz_writer},
 };
 
 use super::minknow::{MinKnowSampleSheet, PoreStateEntry, PoreStateEntryExt, ThroughputEntry};
@@ -159,8 +159,9 @@ impl FlowCells {
             return Ok(());
         }
 
-        let file = File::open(archive_path)
+        let file = get_gz_reader(archive_path)
             .with_context(|| format!("Failed to open archive file: {archive_path}"))?;
+
         let archived: Vec<FlowCell> = serde_json::from_reader(BufReader::new(file))
             .with_context(|| format!("Failed to parse FlowCells from: {archive_path}"))?;
 

+ 22 - 19
src/collection/minknow.rs

@@ -236,7 +236,8 @@ pub trait PoreStateEntryExt {
 
 impl PoreStateEntryExt for Vec<PoreStateEntry> {
     fn group_by_state_and_time(&self, t: f32) -> Vec<PoreStateEntry> {
-        let mut buckets: BTreeMap<(OrderedFloat<f32>, NanoporeChannelStatus), u64> = BTreeMap::new();
+        let mut buckets: BTreeMap<(OrderedFloat<f32>, NanoporeChannelStatus), u64> =
+            BTreeMap::new();
 
         for entry in self {
             let bucket_start = OrderedFloat((entry.experiment_time_minutes / t).floor() * t);
@@ -315,24 +316,26 @@ impl FromStr for NanoporeChannelStatus {
 
     fn from_str(s: &str) -> Result<Self, Self::Err> {
         use NanoporeChannelStatus::*;
-        match s.trim().to_lowercase().as_str() {
-            "adapter" => Ok(Adapter),
-            "disabled" => Ok(Disabled),
-            "locked" => Ok(Locked),
-            "multiple" => Ok(Multiple),
-            "no_pore" => Ok(NoPore),
-            "pending_manual_reset" => Ok(PendingManualReset),
-            "pending_mux_change" => Ok(PendingMuxChange),
-            "pore" => Ok(Pore),
-            "saturated" => Ok(Saturated),
-            "strand" => Ok(Strand),
-            "unavailable" => Ok(Unavailable),
-            "unblocking" => Ok(Unblocking),
-            "unclassified" => Ok(Unclassified),
-            "unclassified_following_reset" => Ok(UnclassifiedFollowingReset),
-            "unknown_negative" => Ok(UnknownNegative),
-            "unknown_positive" => Ok(UnknownPositive),
-            "zero" => Ok(Zero),
+        match s.trim() {
+            "adapter" | "Adapter" => Ok(Adapter),
+            "disabled" | "Disabled" => Ok(Disabled),
+            "locked" | "Locked" => Ok(Locked),
+            "multiple" | "Multiple" => Ok(Multiple),
+            "no_pore" | "NoPore" => Ok(NoPore),
+            "pending_manual_reset" | "PendingManualReset" => Ok(PendingManualReset),
+            "pending_mux_change" | "PendingMuxChange" => Ok(PendingMuxChange),
+            "pore" | "Pore" => Ok(Pore),
+            "saturated" | "Saturated" => Ok(Saturated),
+            "strand" | "Strand" => Ok(Strand),
+            "unavailable" | "Unavailable" => Ok(Unavailable),
+            "unblocking" | "Unblocking" => Ok(Unblocking),
+            "unclassified" | "Unclassified" => Ok(Unclassified),
+            "unclassified_following_reset" | "UnclassifiedFollowingReset" => {
+                Ok(UnclassifiedFollowingReset)
+            }
+            "unknown_negative" | "UnknownNegative" => Ok(UnknownNegative),
+            "unknown_positive" | "UnknownPositive" => Ok(UnknownPositive),
+            "zero" | "Zero" => Ok(Zero),
             _ => Err(format!("Unknown channel status: {}", s)),
         }
     }

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor