whole_scan.rs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. use pandora_lib_scan::par_whole_scan;
  2. #[derive(Debug, Clone)]
  3. pub struct WholeScanConfig {
  4. pub result_dir: String,
  5. pub scan_dir: String,
  6. pub dict_file: String,
  7. }
  8. impl Default for WholeScanConfig {
  9. fn default() -> Self {
  10. Self {
  11. result_dir: "/data/longreads_basic_pipe".to_string(),
  12. scan_dir: "scan".to_string(),
  13. dict_file: "".to_string(),
  14. }
  15. }
  16. }
  17. #[derive(Debug)]
  18. pub struct WholeScan {
  19. pub id: String,
  20. pub time_point: String,
  21. pub bam_path: String,
  22. pub config: WholeScanConfig,
  23. }
  24. impl WholeScan {
  25. pub fn new(
  26. id: String,
  27. time_point: String,
  28. bam_path: String,
  29. config: WholeScanConfig
  30. ) -> anyhow::Result<Self> {
  31. Ok(WholeScan {
  32. id,
  33. time_point,
  34. config,
  35. bam_path,
  36. })
  37. }
  38. pub fn run(&self) -> anyhow::Result<()> {
  39. let scan_dir = format!(
  40. "{}/{}/{}/{}",
  41. &self.config.result_dir, self.id, self.time_point, self.config.scan_dir
  42. );
  43. par_whole_scan(&self.config.dict_file, &self.bam_path, &scan_dir)?;
  44. Ok(())
  45. }
  46. }