config.rs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. use std::path::PathBuf;
  2. use serde::{Serialize, Deserialize};
  3. use anyhow::Result;
  4. #[derive(Serialize, Deserialize, Clone, Debug)]
  5. pub struct Config {
  6. pub db: String,
  7. pub reference_fa: String,
  8. pub longreads_results_dir: String,
  9. pub panel_results_dir: String,
  10. pub dict_file: String,
  11. pub gff_path: String,
  12. pub min_loh_diff: f32,
  13. pub deepvariant_loh_pval: f64,
  14. pub min_mrd_depth: u32,
  15. pub min_diversity: f64,
  16. pub vep_chunk_size: usize,
  17. pub max_gnomad_af: f64,
  18. }
  19. impl ::std::default::Default for Config {
  20. fn default() -> Self {
  21. Self {
  22. db: "/data/db_results.sqlite".to_string(),
  23. reference_fa: "/data/ref/hs1/chm13v2.0.fa".to_string(),
  24. longreads_results_dir: "/data/longreads_basic_pipe".to_string(),
  25. panel_results_dir: "/data/oncoT".to_string(),
  26. dict_file: "/data/ref/hs1/chm13v2.0.dict".to_string(),
  27. gff_path: "/data/ref/hs1/features_not_in_vep.gff.gz".to_string(),
  28. min_loh_diff: 0.25,
  29. deepvariant_loh_pval: 0.001,
  30. min_mrd_depth: 6,
  31. min_diversity: 1.6,
  32. vep_chunk_size: 1_000,
  33. max_gnomad_af: 0.01,
  34. }
  35. }
  36. }
  37. impl Config {
  38. pub fn get() -> Result<Self> {
  39. Ok(confy::load("pandora_lib_variants", None)?)
  40. }
  41. pub fn path() -> Result<PathBuf> {
  42. Ok(confy::get_configuration_file_path("pandora_lib_variants", None)?)
  43. }
  44. }