|
| 1 | +use std::collections::HashMap; |
| 2 | + |
| 3 | +use clap::ValueEnum; |
| 4 | + |
| 5 | +mod ligandmpnn; |
| 6 | +mod picap; |
| 7 | +mod proteinmpnn; |
| 8 | +mod proteinmpnn_script; |
| 9 | +mod pyrosetta; |
| 10 | +mod rfdiffusion; |
| 11 | +mod rosetta; |
| 12 | +mod score; |
| 13 | + |
| 14 | +#[derive(ValueEnum, Clone, Copy, Debug, strum::Display)] |
| 15 | +#[clap(rename_all = "lowercase")] |
| 16 | +#[strum(serialize_all = "lowercase")] // "kebab-case" |
| 17 | +pub enum App { |
| 18 | + /// Run the Rosetta score command |
| 19 | + Score, |
| 20 | + |
| 21 | + /// Run the Rosetta protocol |
| 22 | + Rosetta, |
| 23 | + |
| 24 | + /// Start python in env where PyRosetta is installed and execute script |
| 25 | + #[value(aliases = ["PyRosetta"])] |
| 26 | + PyRosetta, |
| 27 | + |
| 28 | + /// Run the RFdiffusion command https://github.com/RosettaCommons/RFdiffusion |
| 29 | + #[value(aliases = ["Rfdiffusion"])] |
| 30 | + Rfdiffusion, |
| 31 | + |
| 32 | + /// Run the ProteinMPNN command https://github.com/dauparas/ProteinMPNN |
| 33 | + #[value(aliases = ["ProteinMPNN"])] |
| 34 | + Proteinmpnn, |
| 35 | + |
| 36 | + /// Run the ProteinMPNN Script command https://github.com/dauparas/ProteinMPNN |
| 37 | + #[value(aliases = ["Proteinmpnn-script", "ProteinMPNN-Script"])] |
| 38 | + ProteinmpnnScript, |
| 39 | + |
| 40 | + /// Run the LigandMPNN command https://github.com/dauparas/LigandMPNN |
| 41 | + #[value(aliases = ["LigandMPNN"])] |
| 42 | + Ligandmpnn, |
| 43 | + |
| 44 | + /// Run the PiCAP/CAPSIF2 command https://github.com/Graylab/picap |
| 45 | + #[value(aliases = ["PiCAP", "CAPSIF2"])] |
| 46 | + Picap, |
| 47 | +} |
| 48 | + |
| 49 | +pub struct Image(pub String); |
| 50 | + |
| 51 | +#[derive(Debug, Clone, PartialEq, Eq, Hash)] |
| 52 | +pub enum MountRole { |
| 53 | + WorkingDir, |
| 54 | + Scratch, |
| 55 | +} |
| 56 | + |
| 57 | +pub struct RunSpec { |
| 58 | + pub image: Image, |
| 59 | + pub args: Vec<String>, |
| 60 | + //pub scratch: Option<PathBuf>, |
| 61 | + pub mounts: HashMap<MountRole, String>, |
| 62 | +} |
| 63 | + |
| 64 | +impl RunSpec { |
| 65 | + pub fn new(image: impl Into<String>, args: Vec<String>) -> Self { |
| 66 | + Self { |
| 67 | + image: Image(image.into()), |
| 68 | + args, |
| 69 | + mounts: HashMap::new(), |
| 70 | + } |
| 71 | + } |
| 72 | + pub fn scratch(mut self, p: impl Into<String>) -> Self { |
| 73 | + self.mounts.insert(MountRole::Scratch, p.into()); |
| 74 | + self |
| 75 | + } |
| 76 | + pub fn working_dir(mut self, p: impl Into<String>) -> Self { |
| 77 | + self.mounts.insert(MountRole::WorkingDir, p.into()); |
| 78 | + self |
| 79 | + } |
| 80 | +} |
| 81 | + |
| 82 | +impl App { |
| 83 | + pub fn run_spec(self, app_args: Vec<String>) -> RunSpec { |
| 84 | + match self { |
| 85 | + App::Score => score::score(app_args), |
| 86 | + App::Rosetta => rosetta::rosetta(app_args), |
| 87 | + App::PyRosetta => pyrosetta::pyrosetta(app_args), |
| 88 | + App::Rfdiffusion => rfdiffusion::rfdiffusion(app_args), |
| 89 | + App::Proteinmpnn => proteinmpnn::proteinmpnn(app_args), |
| 90 | + App::ProteinmpnnScript => proteinmpnn_script::proteinmpnn_script(app_args), |
| 91 | + App::Ligandmpnn => ligandmpnn::ligandmpnn(app_args), |
| 92 | + App::Picap => picap::picap(app_args), |
| 93 | + } |
| 94 | + } |
| 95 | +} |
0 commit comments