From 00059e9a048ff05e8edbcd8a3387c30550bc8c19 Mon Sep 17 00:00:00 2001 From: zachcp Date: Fri, 20 Dec 2024 13:59:57 -0500 Subject: [PATCH] flatten the ligandmpnn flder (#85) --- ferritin-plms/src/amplify/amplify.rs | 2 +- ferritin-plms/src/amplify/mod.rs | 2 +- ferritin-plms/src/lib.rs | 9 ++++---- ferritin-plms/src/ligandmpnn/Readme.md | 22 +++++++++++++++++++ .../src/ligandmpnn/{ => commands}/cli.rs | 4 ++-- .../src/ligandmpnn/commands/featurize.rs | 2 +- ferritin-plms/src/ligandmpnn/commands/mod.rs | 1 + ferritin-plms/src/ligandmpnn/commands/run.rs | 3 ++- .../ligandmpnn/{ligandmpnn => }/configs.rs | 0 .../src/ligandmpnn/ligandmpnn/Readme.md | 20 ----------------- .../src/ligandmpnn/ligandmpnn/mod.rs | 5 ----- ferritin-plms/src/ligandmpnn/mod.rs | 14 +++++++----- .../src/ligandmpnn/{ligandmpnn => }/model.rs | 0 .../{ligandmpnn => }/proteinfeatures.rs | 0 .../{ligandmpnn => }/proteinfeaturesmodel.rs | 0 .../ligandmpnn/{ligandmpnn => }/utilities.rs | 2 +- 16 files changed, 45 insertions(+), 41 deletions(-) rename ferritin-plms/src/ligandmpnn/{ => commands}/cli.rs (98%) rename ferritin-plms/src/ligandmpnn/{ligandmpnn => }/configs.rs (100%) delete mode 100644 ferritin-plms/src/ligandmpnn/ligandmpnn/Readme.md delete mode 100644 ferritin-plms/src/ligandmpnn/ligandmpnn/mod.rs rename ferritin-plms/src/ligandmpnn/{ligandmpnn => }/model.rs (100%) rename ferritin-plms/src/ligandmpnn/{ligandmpnn => }/proteinfeatures.rs (100%) rename ferritin-plms/src/ligandmpnn/{ligandmpnn => }/proteinfeaturesmodel.rs (100%) rename ferritin-plms/src/ligandmpnn/{ligandmpnn => }/utilities.rs (99%) diff --git a/ferritin-plms/src/amplify/amplify.rs b/ferritin-plms/src/amplify/amplify.rs index 28d2b611..1c256833 100644 --- a/ferritin-plms/src/amplify/amplify.rs +++ b/ferritin-plms/src/amplify/amplify.rs @@ -133,4 +133,4 @@ impl AMPLIFY { Tokenizer::from_bytes(tokenizer_bytes) .map_err(|e| candle_core::Error::Msg(format!("Failed to load tokenizer: {}", e))) } -} +} \ No newline at end of file diff --git a/ferritin-plms/src/amplify/mod.rs b/ferritin-plms/src/amplify/mod.rs index b8f12e2a..0eab3b4d 100644 --- a/ferritin-plms/src/amplify/mod.rs +++ b/ferritin-plms/src/amplify/mod.rs @@ -12,4 +12,4 @@ pub mod encoder; pub mod outputs; pub mod rotary; // pub mod loss; -// +// \ No newline at end of file diff --git a/ferritin-plms/src/lib.rs b/ferritin-plms/src/lib.rs index 2beb8814..db1543a7 100644 --- a/ferritin-plms/src/lib.rs +++ b/ferritin-plms/src/lib.rs @@ -18,11 +18,12 @@ pub use amplify::config::AMPLIFYConfig; pub use amplify::outputs::ModelOutput; pub use esm::models::esmc::{ESMCConfig, ESMC}; pub use esm2::models::esm2::{ESM2Config, ESM2}; -pub use ligandmpnn::ligandmpnn::configs::ProteinMPNNConfig; -pub use ligandmpnn::ligandmpnn::model::ProteinMPNN; -pub use ligandmpnn::ligandmpnn::proteinfeatures::LMPNNFeatures; +pub use ligandmpnn::configs::ProteinMPNNConfig; +pub use ligandmpnn::model::ProteinMPNN; +pub use ligandmpnn::proteinfeatures::LMPNNFeatures; -pub mod amplify; +//pub mod amplify; pub mod esm; pub mod esm2; pub mod ligandmpnn; +mod amplify; diff --git a/ferritin-plms/src/ligandmpnn/Readme.md b/ferritin-plms/src/ligandmpnn/Readme.md index 0596c86f..598e4750 100644 --- a/ferritin-plms/src/ligandmpnn/Readme.md +++ b/ferritin-plms/src/ligandmpnn/Readme.md @@ -2,3 +2,25 @@ The initial development sought to create a CLI-equivalent for LigandmMPNN. As of Dec 16 2024, I am no longer pursuing that effort. I'm leavin ghte code here as an artifact in case it becomes interesting again. + + +# LigandMPNN-Rust + +Rust port of Ligand MPNN. + + +```sh +bash get_model_params.sh "./model_params" +python scripts/convert_to_safetensor.py +python scripts/convert_to_json.py +#cargo install json_to_rust +#json_to_rust data/pdb_data.json > src/proteintypes.rs +#cat data/pdb_data.json| json_to_rust -j json_object -n MyStruct > out.rs +npm install -g quicktype +quicktype data/pdb_data.json -o output.rs -l rust +``` + +## Resources + +- [Candle](https://github.com/huggingface/candle) +- [Candle Tutorial](https://github.com/ToluClassics/candle-tutorial) diff --git a/ferritin-plms/src/ligandmpnn/cli.rs b/ferritin-plms/src/ligandmpnn/commands/cli.rs similarity index 98% rename from ferritin-plms/src/ligandmpnn/cli.rs rename to ferritin-plms/src/ligandmpnn/commands/cli.rs index 1b568be6..3660f910 100644 --- a/ferritin-plms/src/ligandmpnn/cli.rs +++ b/ferritin-plms/src/ligandmpnn/commands/cli.rs @@ -2,8 +2,8 @@ //! //! ** work in progress ** //! -use super::commands; -use super::ligandmpnn::configs::{ +use crate::ligandmpnn::commands; +use crate::ligandmpnn::configs::{ AABiasConfig, LigandMPNNConfig, MembraneMPNNConfig, ModelTypes, MultiPDBConfig, ResidueControl, RunConfig, }; diff --git a/ferritin-plms/src/ligandmpnn/commands/featurize.rs b/ferritin-plms/src/ligandmpnn/commands/featurize.rs index d4592f7a..dcf1918c 100644 --- a/ferritin-plms/src/ligandmpnn/commands/featurize.rs +++ b/ferritin-plms/src/ligandmpnn/commands/featurize.rs @@ -1,4 +1,4 @@ -use crate::ligandmpnn::ligandmpnn::proteinfeatures::LMPNNFeatures; +use crate::ligandmpnn::proteinfeatures::LMPNNFeatures; use candle_core; use ferritin_core::AtomCollection; use pdbtbx; diff --git a/ferritin-plms/src/ligandmpnn/commands/mod.rs b/ferritin-plms/src/ligandmpnn/commands/mod.rs index 141b28a7..42aa9096 100644 --- a/ferritin-plms/src/ligandmpnn/commands/mod.rs +++ b/ferritin-plms/src/ligandmpnn/commands/mod.rs @@ -1,2 +1,3 @@ pub mod featurize; pub mod run; +mod cli; diff --git a/ferritin-plms/src/ligandmpnn/commands/run.rs b/ferritin-plms/src/ligandmpnn/commands/run.rs index 1c236151..c32c643e 100644 --- a/ferritin-plms/src/ligandmpnn/commands/run.rs +++ b/ferritin-plms/src/ligandmpnn/commands/run.rs @@ -1,4 +1,5 @@ -use crate::ligandmpnn::ligandmpnn::configs::{ + +use crate::ligandmpnn::configs::{ AABiasConfig, LigandMPNNConfig, MPNNExecConfig, MembraneMPNNConfig, ModelTypes, MultiPDBConfig, ResidueControl, RunConfig, }; diff --git a/ferritin-plms/src/ligandmpnn/ligandmpnn/configs.rs b/ferritin-plms/src/ligandmpnn/configs.rs similarity index 100% rename from ferritin-plms/src/ligandmpnn/ligandmpnn/configs.rs rename to ferritin-plms/src/ligandmpnn/configs.rs diff --git a/ferritin-plms/src/ligandmpnn/ligandmpnn/Readme.md b/ferritin-plms/src/ligandmpnn/ligandmpnn/Readme.md deleted file mode 100644 index 62acfad3..00000000 --- a/ferritin-plms/src/ligandmpnn/ligandmpnn/Readme.md +++ /dev/null @@ -1,20 +0,0 @@ -# LigandMPNN-Rust - -Rust port of Ligand MPNN. - - -```sh -bash get_model_params.sh "./model_params" -python scripts/convert_to_safetensor.py -python scripts/convert_to_json.py -#cargo install json_to_rust -#json_to_rust data/pdb_data.json > src/proteintypes.rs -#cat data/pdb_data.json| json_to_rust -j json_object -n MyStruct > out.rs -npm install -g quicktype -quicktype data/pdb_data.json -o output.rs -l rust -``` - -## Resources - -- [Candle](https://github.com/huggingface/candle) -- [Candle Tutorial](https://github.com/ToluClassics/candle-tutorial) diff --git a/ferritin-plms/src/ligandmpnn/ligandmpnn/mod.rs b/ferritin-plms/src/ligandmpnn/ligandmpnn/mod.rs deleted file mode 100644 index 7a978a85..00000000 --- a/ferritin-plms/src/ligandmpnn/ligandmpnn/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod configs; -pub mod proteinfeatures; -pub mod model; -mod proteinfeaturesmodel; -mod utilities; diff --git a/ferritin-plms/src/ligandmpnn/mod.rs b/ferritin-plms/src/ligandmpnn/mod.rs index 43b65587..ad7e8911 100644 --- a/ferritin-plms/src/ligandmpnn/mod.rs +++ b/ferritin-plms/src/ligandmpnn/mod.rs @@ -3,10 +3,14 @@ //! - utilities to convert sequence formats (PDB; mmcif) to ML-ready tensors. //! - CLI to handle the above. //! -mod cli; mod commands; -pub mod ligandmpnn; -pub use ligandmpnn::proteinfeatures::LMPNNFeatures; -pub use ligandmpnn::model::ProteinMPNN; -pub use ligandmpnn::configs::ProteinMPNNConfig; +pub mod configs; +pub mod proteinfeatures; +pub mod model; +mod proteinfeaturesmodel; +mod utilities; + +pub use proteinfeatures::LMPNNFeatures; +pub use model::ProteinMPNN; +pub use configs::ProteinMPNNConfig; diff --git a/ferritin-plms/src/ligandmpnn/ligandmpnn/model.rs b/ferritin-plms/src/ligandmpnn/model.rs similarity index 100% rename from ferritin-plms/src/ligandmpnn/ligandmpnn/model.rs rename to ferritin-plms/src/ligandmpnn/model.rs diff --git a/ferritin-plms/src/ligandmpnn/ligandmpnn/proteinfeatures.rs b/ferritin-plms/src/ligandmpnn/proteinfeatures.rs similarity index 100% rename from ferritin-plms/src/ligandmpnn/ligandmpnn/proteinfeatures.rs rename to ferritin-plms/src/ligandmpnn/proteinfeatures.rs diff --git a/ferritin-plms/src/ligandmpnn/ligandmpnn/proteinfeaturesmodel.rs b/ferritin-plms/src/ligandmpnn/proteinfeaturesmodel.rs similarity index 100% rename from ferritin-plms/src/ligandmpnn/ligandmpnn/proteinfeaturesmodel.rs rename to ferritin-plms/src/ligandmpnn/proteinfeaturesmodel.rs diff --git a/ferritin-plms/src/ligandmpnn/ligandmpnn/utilities.rs b/ferritin-plms/src/ligandmpnn/utilities.rs similarity index 99% rename from ferritin-plms/src/ligandmpnn/ligandmpnn/utilities.rs rename to ferritin-plms/src/ligandmpnn/utilities.rs index 29af5575..0909f1d5 100644 --- a/ferritin-plms/src/ligandmpnn/ligandmpnn/utilities.rs +++ b/ferritin-plms/src/ligandmpnn/utilities.rs @@ -546,7 +546,7 @@ define_residues! { #[cfg(test)] mod tests { use super::*; - use crate::ligandmpnn::ligandmpnn::proteinfeatures::LMPNNFeatures; + use crate::ligandmpnn::proteinfeatures::LMPNNFeatures; use ferritin_core::AtomCollection; use ferritin_test_data::TestFile; use pdbtbx;