|
|
@@ -13,6 +13,8 @@ pub mod config;
|
|
|
pub mod modkit;
|
|
|
pub mod pod5;
|
|
|
mod vcf;
|
|
|
+pub mod callers;
|
|
|
+pub mod runners;
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
pub struct Collections {
|
|
|
@@ -24,7 +26,7 @@ pub struct Collections {
|
|
|
|
|
|
impl Collections {
|
|
|
pub fn new(pod_dir: &str, corrected_fc_path: &str, result_dir: &str) -> anyhow::Result<Self> {
|
|
|
- let pod5 = Pod5Collection::import_dir(pod_dir, corrected_fc_path, result_dir)?;
|
|
|
+ let pod5 = Pod5Collection::new(pod_dir, corrected_fc_path, result_dir)?;
|
|
|
let bam = BamCollection::new(result_dir);
|
|
|
let vcf = VcfCollection::new(result_dir);
|
|
|
|
|
|
@@ -69,6 +71,7 @@ impl Collections {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // Group for muxed and push task with all cases
|
|
|
let mut grouped: HashMap<PathBuf, Vec<FlowCellCase>> = HashMap::new();
|
|
|
for case in to_demux {
|
|
|
grouped
|
|
|
@@ -79,6 +82,8 @@ impl Collections {
|
|
|
grouped
|
|
|
.into_values()
|
|
|
.for_each(|data| self.tasks.push(CollectionsTasks::DemuxAlign(data)));
|
|
|
+
|
|
|
+ // Variant calling
|
|
|
}
|
|
|
|
|
|
pub fn run(&mut self) -> anyhow::Result<()> {
|
|
|
@@ -109,6 +114,7 @@ impl Collections {
|
|
|
pub enum CollectionsTasks {
|
|
|
Align(FlowCellCase),
|
|
|
DemuxAlign(Vec<FlowCellCase>),
|
|
|
+ // DeepVariant()
|
|
|
}
|
|
|
|
|
|
impl Run for CollectionsTasks {
|
|
|
@@ -127,10 +133,10 @@ impl Run for CollectionsTasks {
|
|
|
|
|
|
#[cfg(test)]
|
|
|
mod tests {
|
|
|
- use self::commands::dorado;
|
|
|
+ use self::{callers::deep_variant::DeepVariantConfig, commands::dorado};
|
|
|
|
|
|
use super::*;
|
|
|
- use crate::bam::BamType;
|
|
|
+ use crate::{bam::BamType, callers::deep_variant::DeepVariant};
|
|
|
|
|
|
#[test]
|
|
|
fn it_works() {
|
|
|
@@ -150,7 +156,7 @@ mod tests {
|
|
|
let _ = env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info"))
|
|
|
.build();
|
|
|
|
|
|
- let _ = Pod5Collection::import_dir(
|
|
|
+ let _ = Pod5Collection::new(
|
|
|
"/data/run_data",
|
|
|
"/data/flow_cells.tsv",
|
|
|
"/data/longreads_basic_pipe",
|
|
|
@@ -189,24 +195,33 @@ mod tests {
|
|
|
}
|
|
|
|
|
|
#[test_log::test]
|
|
|
- fn collections() -> anyhow::Result<()> {
|
|
|
+ fn mux() -> anyhow::Result<()> {
|
|
|
+ let cases = vec![
|
|
|
+ FlowCellCase { id: "test_04".to_string(), time_point: "diag".to_string(), barcode: "04".to_string(), pod_dir: "/data/test_d".into() },
|
|
|
+ FlowCellCase { id: "test_05".to_string(), time_point: "diag".to_string(), barcode: "05".to_string(), pod_dir: "/data/test_d".into() },
|
|
|
+ ];
|
|
|
+ Dorado::from_mux(cases, Config::default())
|
|
|
+ }
|
|
|
+
|
|
|
+ #[test_log::test]
|
|
|
+ fn deep_variant() -> anyhow::Result<()> {
|
|
|
+ let config = DeepVariantConfig {
|
|
|
+ result_dir: "/data/test".to_string(),
|
|
|
+ ..DeepVariantConfig::default()
|
|
|
+ };
|
|
|
+ let dv = DeepVariant::new("test_a", "diag", "/data/test_data/subset.bam", config).run();
|
|
|
+ Ok(())
|
|
|
+ }
|
|
|
+
|
|
|
+ // cargo test run -- --nocapture; ~/run_scripts/notify_finish.sh &
|
|
|
+ #[test_log::test]
|
|
|
+ fn run() -> anyhow::Result<()> {
|
|
|
let mut collections = Collections::new(
|
|
|
"/data/run_data",
|
|
|
"/data/flow_cells.tsv",
|
|
|
"/data/longreads_basic_pipe",
|
|
|
)?;
|
|
|
- // collections.vcf.print_tsv();
|
|
|
collections.run()?;
|
|
|
Ok(())
|
|
|
}
|
|
|
-
|
|
|
- #[test_log::test]
|
|
|
- fn mux() -> anyhow::Result<()> {
|
|
|
-
|
|
|
- let cases = vec![
|
|
|
- FlowCellCase { id: "test_04".to_string(), time_point: "diag".to_string(), barcode: "04".to_string(), pod_dir: "/data/test_d".into() },
|
|
|
- FlowCellCase { id: "test_05".to_string(), time_point: "diag".to_string(), barcode: "05".to_string(), pod_dir: "/data/test_d".into() },
|
|
|
- ];
|
|
|
- Dorado::from_mux(cases, Config::default())
|
|
|
- }
|
|
|
}
|