rust-sasa-python 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -197,6 +197,12 @@ version = "2.0.5"
197
197
  source = "registry+https://github.com/rust-lang/crates.io-index"
198
198
  checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
199
199
 
200
+ [[package]]
201
+ name = "lazy_static"
202
+ version = "1.5.0"
203
+ source = "registry+https://github.com/rust-lang/crates.io-index"
204
+ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
205
+
200
206
  [[package]]
201
207
  name = "libc"
202
208
  version = "0.2.153"
@@ -249,9 +255,9 @@ dependencies = [
249
255
 
250
256
  [[package]]
251
257
  name = "nalgebra"
252
- version = "0.32.5"
258
+ version = "0.33.0"
253
259
  source = "registry+https://github.com/rust-lang/crates.io-index"
254
- checksum = "3ea4908d4f23254adda3daa60ffef0f1ac7b8c3e9a864cf3cc154b251908a2ef"
260
+ checksum = "3c4b5f057b303842cf3262c27e465f4c303572e7f6b0648f60e16248ac3397f4"
255
261
  dependencies = [
256
262
  "approx",
257
263
  "matrixmultiply",
@@ -265,13 +271,13 @@ dependencies = [
265
271
 
266
272
  [[package]]
267
273
  name = "nalgebra-macros"
268
- version = "0.2.1"
274
+ version = "0.2.2"
269
275
  source = "registry+https://github.com/rust-lang/crates.io-index"
270
- checksum = "91761aed67d03ad966ef783ae962ef9bbaca728d2dd7ceb7939ec110fffad998"
276
+ checksum = "254a5372af8fc138e36684761d3c0cdb758a4410e938babcff1c860ce14ddbfc"
271
277
  dependencies = [
272
278
  "proc-macro2 1.0.81",
273
279
  "quote 1.0.36",
274
- "syn 1.0.109",
280
+ "syn",
275
281
  ]
276
282
 
277
283
  [[package]]
@@ -433,7 +439,7 @@ dependencies = [
433
439
  "proc-macro2 1.0.81",
434
440
  "pyo3-macros-backend",
435
441
  "quote 1.0.36",
436
- "syn 2.0.60",
442
+ "syn",
437
443
  ]
438
444
 
439
445
  [[package]]
@@ -446,7 +452,7 @@ dependencies = [
446
452
  "proc-macro2 1.0.81",
447
453
  "pyo3-build-config",
448
454
  "quote 1.0.36",
449
- "syn 2.0.60",
455
+ "syn",
450
456
  ]
451
457
 
452
458
  [[package]]
@@ -526,10 +532,11 @@ dependencies = [
526
532
 
527
533
  [[package]]
528
534
  name = "rust-sasa"
529
- version = "0.2.1"
535
+ version = "0.2.3"
530
536
  source = "registry+https://github.com/rust-lang/crates.io-index"
531
- checksum = "882f4821fadbd616f60dd5029e52f28279573df38380e80409422050e42b00b1"
537
+ checksum = "e558f2e471a933b98a3218e604c6761ff1ebe7434b1a326d39c0338054651d5e"
532
538
  dependencies = [
539
+ "lazy_static",
533
540
  "nalgebra",
534
541
  "pdbtbx",
535
542
  "rayon",
@@ -539,7 +546,7 @@ dependencies = [
539
546
 
540
547
  [[package]]
541
548
  name = "rust-sasa-python"
542
- version = "0.1.0"
549
+ version = "0.1.1"
543
550
  dependencies = [
544
551
  "pdbtbx",
545
552
  "pyo3",
@@ -593,14 +600,14 @@ checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc"
593
600
  dependencies = [
594
601
  "proc-macro2 1.0.81",
595
602
  "quote 1.0.36",
596
- "syn 2.0.60",
603
+ "syn",
597
604
  ]
598
605
 
599
606
  [[package]]
600
607
  name = "simba"
601
- version = "0.8.1"
608
+ version = "0.9.0"
602
609
  source = "registry+https://github.com/rust-lang/crates.io-index"
603
- checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae"
610
+ checksum = "b3a386a501cd104797982c15ae17aafe8b9261315b5d07e3ec803f2ea26be0fa"
604
611
  dependencies = [
605
612
  "approx",
606
613
  "num-complex",
@@ -617,23 +624,23 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
617
624
 
618
625
  [[package]]
619
626
  name = "snafu"
620
- version = "0.8.2"
627
+ version = "0.8.4"
621
628
  source = "registry+https://github.com/rust-lang/crates.io-index"
622
- checksum = "75976f4748ab44f6e5332102be424e7c2dc18daeaf7e725f2040c3ebb133512e"
629
+ checksum = "2b835cb902660db3415a672d862905e791e54d306c6e8189168c7f3d9ae1c79d"
623
630
  dependencies = [
624
631
  "snafu-derive",
625
632
  ]
626
633
 
627
634
  [[package]]
628
635
  name = "snafu-derive"
629
- version = "0.8.2"
636
+ version = "0.8.4"
630
637
  source = "registry+https://github.com/rust-lang/crates.io-index"
631
- checksum = "b4b19911debfb8c2fb1107bc6cb2d61868aaf53a988449213959bb1b5b1ed95f"
638
+ checksum = "38d1e02fca405f6280643174a50c942219f0bbf4dbf7d480f1dd864d6f211ae5"
632
639
  dependencies = [
633
640
  "heck",
634
641
  "proc-macro2 1.0.81",
635
642
  "quote 1.0.36",
636
- "syn 2.0.60",
643
+ "syn",
637
644
  ]
638
645
 
639
646
  [[package]]
@@ -651,17 +658,6 @@ version = "1.2.0"
651
658
  source = "registry+https://github.com/rust-lang/crates.io-index"
652
659
  checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
653
660
 
654
- [[package]]
655
- name = "syn"
656
- version = "1.0.109"
657
- source = "registry+https://github.com/rust-lang/crates.io-index"
658
- checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
659
- dependencies = [
660
- "proc-macro2 1.0.81",
661
- "quote 1.0.36",
662
- "unicode-ident",
663
- ]
664
-
665
661
  [[package]]
666
662
  name = "syn"
667
663
  version = "2.0.60"
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "rust-sasa-python"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  edition = "2021"
5
5
 
6
6
  # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -11,4 +11,4 @@ crate-type = ["cdylib"]
11
11
  [dependencies]
12
12
  pdbtbx = "0.11.0"
13
13
  pyo3 = "0.20.0"
14
- rust-sasa = "0.2.1"
14
+ rust-sasa = "0.2.3"
@@ -0,0 +1,51 @@
1
+ # Documentation
2
+
3
+ ## Functions
4
+
5
+ ### `calculate_sasa_at_protein_level`
6
+
7
+ Signature: calculate_sasa_at_protein_level(pdb_path: String,probe_radius: Option<f32>,n_points: Option<usize>)
8
+
9
+ Returns: tuple (GLOBAL_SASA,Non-polar total SASA,Polar total SASA) as f32
10
+ Example:
11
+
12
+ ```python
13
+ import rust_sasa_python
14
+ rust_sasa_python.calculate_sasa_at_protein_level("path_to_pdb_file.pdb") # Also supports mmCIF files!
15
+ ```
16
+
17
+ ### `calculate_sasa_at_residue_level`
18
+
19
+ Signature: calculate_sasa_at_residue_level(pdb_path: String,probe_radius: Option<f32>,n_points: Option<usize>)
20
+
21
+ Returns: list of tuples <({CHAIN*ID}*{RESIDUE*NAE}*{RESIDUE_INDEX},SASA VALUE as f32)>
22
+ Example:
23
+
24
+ ```python
25
+ import rust_sasa_python
26
+ rust_sasa_python.calculate_sasa_at_residue_level("path_to_pdb_file.pdb") # Also supports mmCIF files!
27
+ ```
28
+
29
+ ### `calculate_sasa_at_atom_level`
30
+
31
+ Signature: calculate_sasa_at_atom_level(pdb_path: String,probe_radius: Option<f32>,n_points: Option<usize>)
32
+
33
+ Returns: array of SASA values for each atom
34
+ Example:
35
+
36
+ ```python
37
+ import rust_sasa_python
38
+ rust_sasa_python.calculate_sasa_at_atom_level("path_to_pdb_file.pdb") # Also supports mmCIF files!
39
+ ```
40
+
41
+ ### `calculate_sasa_at_chain_level`
42
+
43
+ Signature: calculate_sasa_at_chain_level(pdb_path: String,probe_radius: Option<f32>,n_points: Option<usize>)
44
+
45
+ Returns: array of SASA values for each chain
46
+ Example:
47
+
48
+ ```python
49
+ import rust_sasa_python
50
+ rust_sasa_python.calculate_sasa_at_chain_level("path_to_pdb_file.pdb") # Also supports mmCIF files!
51
+ ```
@@ -0,0 +1,46 @@
1
+ Metadata-Version: 2.3
2
+ Name: rust-sasa-python
3
+ Version: 0.1.1
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: Implementation :: CPython
6
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
7
+ License-File: LICENSE.md
8
+ Summary: An ultra-fast package for computing Solvent Accessible Surface Area (SASA/ASA) for proteins
9
+ Author: Max Campbell
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
12
+
13
+ # rust-sasa-python
14
+
15
+ rust-sasa-python is a Python library for computing SASA (Solvent Accessible Surface Area) far faster than biopython and other packages.
16
+ See [RustSasa](https://github.com/maxall41/RustSASA) for more info.
17
+
18
+ ## Features:
19
+ - 🦀 Backend written in Pure Rust
20
+ - ⚡️ 3X Faster than Biopython and ~120% faster than Freesasa
21
+ - 🐍 Quick drop-in replacement for Biopython
22
+
23
+ ## Usage
24
+
25
+ You can now utilize RustSasa within Python to speed up your scripts! Take a look at [rust-sasa-python](https://github.com/maxall41/rust-sasa-python)!
26
+
27
+ Installation:
28
+ ```
29
+ pip install rust-sasa-python
30
+ ```
31
+ Example:
32
+ ```python
33
+ from rust_sasa_python import calculate_sasa_at_residue_level
34
+ residue_sasa_values = calculate_sasa_at_residue_level("path_to_pdb_file.pdb") # Also supports mmCIF files!
35
+ ```
36
+ See full docs [here](https://github.com/maxall41/rust-sasa-python/blob/main/DOCS.md)
37
+
38
+ ## Benchmarking
39
+ Benchmarks were performed on an M2 Apple Mac with 8GB of RAM and 8 Cores with the protein AF-A0A2K5XT84-F1 (AlphaFold).
40
+
41
+ - Biopython: ~150ms
42
+
43
+ - Freesasa: ~90ms
44
+
45
+ - RustSASA: ~40ms
46
+
@@ -0,0 +1,33 @@
1
+ # rust-sasa-python
2
+
3
+ rust-sasa-python is a Python library for computing SASA (Solvent Accessible Surface Area) far faster than biopython and other packages.
4
+ See [RustSasa](https://github.com/maxall41/RustSASA) for more info.
5
+
6
+ ## Features:
7
+ - 🦀 Backend written in Pure Rust
8
+ - ⚡️ 3X Faster than Biopython and ~120% faster than Freesasa
9
+ - 🐍 Quick drop-in replacement for Biopython
10
+
11
+ ## Usage
12
+
13
+ You can now utilize RustSasa within Python to speed up your scripts! Take a look at [rust-sasa-python](https://github.com/maxall41/rust-sasa-python)!
14
+
15
+ Installation:
16
+ ```
17
+ pip install rust-sasa-python
18
+ ```
19
+ Example:
20
+ ```python
21
+ from rust_sasa_python import calculate_sasa_at_residue_level
22
+ residue_sasa_values = calculate_sasa_at_residue_level("path_to_pdb_file.pdb") # Also supports mmCIF files!
23
+ ```
24
+ See full docs [here](https://github.com/maxall41/rust-sasa-python/blob/main/DOCS.md)
25
+
26
+ ## Benchmarking
27
+ Benchmarks were performed on an M2 Apple Mac with 8GB of RAM and 8 Cores with the protein AF-A0A2K5XT84-F1 (AlphaFold).
28
+
29
+ - Biopython: ~150ms
30
+
31
+ - Freesasa: ~90ms
32
+
33
+ - RustSASA: ~40ms
@@ -0,0 +1,85 @@
1
+ use pdbtbx::StrictnessLevel;
2
+ use pyo3::prelude::*;
3
+ use rust_sasa::{SASALevel, SASAResult};
4
+
5
+ #[pyfunction]
6
+ fn calculate_sasa_at_protein_level(
7
+ pdb_path: String,
8
+ probe_radius: Option<f32>,
9
+ n_points: Option<usize>,
10
+ ) -> PyResult<(f32, f32, f32)> {
11
+ let (pdb, _errors) = pdbtbx::open(pdb_path, StrictnessLevel::Medium).unwrap();
12
+ let result =
13
+ rust_sasa::calculate_sasa(&pdb, probe_radius, n_points, SASALevel::Protein).unwrap();
14
+ return match result {
15
+ SASAResult::Protein(v) => Ok((v.global_total, v.non_polar_total, v.polar_total)),
16
+ _ => panic!("This will never run"),
17
+ };
18
+ }
19
+
20
+ #[pyfunction]
21
+ fn calculate_sasa_at_residue_level(
22
+ pdb_path: String,
23
+ probe_radius: Option<f32>,
24
+ n_points: Option<usize>,
25
+ ) -> PyResult<Vec<(String, f32)>> {
26
+ let (pdb, _errors) = pdbtbx::open(pdb_path, StrictnessLevel::Medium).unwrap();
27
+ let result =
28
+ rust_sasa::calculate_sasa(&pdb, probe_radius, n_points, SASALevel::Residue).unwrap();
29
+ return match result {
30
+ SASAResult::Residue(v) => {
31
+ let mut temp: Vec<(String, f32)> = vec![];
32
+ for value in v {
33
+ temp.push((
34
+ format!("{}_{}_{}", value.chain_id, value.name, value.serial_number),
35
+ value.value,
36
+ ))
37
+ }
38
+ Ok(temp)
39
+ }
40
+ _ => panic!("This will never run"),
41
+ };
42
+ }
43
+
44
+ #[pyfunction]
45
+ fn calculate_sasa_at_atom_level(
46
+ pdb_path: String,
47
+ probe_radius: Option<f32>,
48
+ n_points: Option<usize>,
49
+ ) -> PyResult<Vec<f32>> {
50
+ let (pdb, _errors) = pdbtbx::open(pdb_path, StrictnessLevel::Medium).unwrap();
51
+ let result = rust_sasa::calculate_sasa(&pdb, probe_radius, n_points, SASALevel::Atom).unwrap();
52
+ return match result {
53
+ SASAResult::Atom(v) => Ok(v),
54
+ _ => panic!("This will never run"),
55
+ };
56
+ }
57
+
58
+ #[pyfunction]
59
+ fn calculate_sasa_at_chain_level(
60
+ pdb_path: String,
61
+ probe_radius: Option<f32>,
62
+ n_points: Option<usize>,
63
+ ) -> PyResult<Vec<f32>> {
64
+ let (pdb, _errors) = pdbtbx::open(pdb_path, StrictnessLevel::Medium).unwrap();
65
+ let result = rust_sasa::calculate_sasa(&pdb, probe_radius, n_points, SASALevel::Chain).unwrap();
66
+ return match result {
67
+ SASAResult::Chain(v) => {
68
+ let mut temp: Vec<f32> = vec![];
69
+ for value in v {
70
+ temp.push(value.value)
71
+ }
72
+ Ok(temp)
73
+ }
74
+ _ => panic!("This will never run"),
75
+ };
76
+ }
77
+
78
+ #[pymodule]
79
+ fn rust_sasa_python(_py: Python, m: &PyModule) -> PyResult<()> {
80
+ m.add_function(wrap_pyfunction!(calculate_sasa_at_protein_level, m)?)?;
81
+ m.add_function(wrap_pyfunction!(calculate_sasa_at_chain_level, m)?)?;
82
+ m.add_function(wrap_pyfunction!(calculate_sasa_at_residue_level, m)?)?;
83
+ m.add_function(wrap_pyfunction!(calculate_sasa_at_atom_level, m)?)?;
84
+ Ok(())
85
+ }
@@ -4,7 +4,8 @@ from Bio.PDB.SASA import ShrakeRupley
4
4
  from Bio.PDB.MMCIFParser import MMCIFParser
5
5
 
6
6
  start = time.time()
7
- rust_sasa_python.calculate_sasa_at_residue_level("example.cif")
7
+ v = rust_sasa_python.calculate_sasa_at_residue_level("example.cif")
8
+ print(v)
8
9
  end = time.time()
9
10
  print("Time for RustSasa:")
10
11
  print(end - start)
@@ -1,16 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: rust-sasa-python
3
- Version: 0.1.0
4
- Classifier: Programming Language :: Rust
5
- Classifier: Programming Language :: Python :: Implementation :: CPython
6
- Classifier: Programming Language :: Python :: Implementation :: PyPy
7
- License-File: LICENSE.md
8
- Summary: An ultra-fast package for computing Solvent Accessible Surface Area (SASA/ASA) for proteins
9
- Author: Max Campbell
10
- Requires-Python: >=3.8
11
- Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
12
-
13
- # rust-sasa-python
14
-
15
- rust-sasa-python is a tool for computing SASA (Solvent Accessible Surface Area) far faster than biopython and other packages.
16
- See [RustSasa](https://github.com/maxall41/RustSASA) for more info.
@@ -1,4 +0,0 @@
1
- # rust-sasa-python
2
-
3
- rust-sasa-python is a tool for computing SASA (Solvent Accessible Surface Area) far faster than biopython and other packages.
4
- See [RustSasa](https://github.com/maxall41/RustSASA) for more info.
@@ -1,78 +0,0 @@
1
- use pdbtbx::StrictnessLevel;
2
- use pyo3::prelude::*;
3
- use rust_sasa::{SASALevel, SASAResult};
4
-
5
- #[pyfunction]
6
- fn calculate_sasa_at_protein_level(pdb_path: String,probe_radius: Option<f32>,n_points: Option<usize>) -> PyResult<f32> {
7
- let (mut pdb, _errors) = pdbtbx::open(
8
- pdb_path,
9
- StrictnessLevel::Medium
10
- ).unwrap();
11
- let result = rust_sasa::calculate_sasa(&pdb,probe_radius,n_points,SASALevel::Protein).unwrap();
12
- return match result {
13
- SASAResult::Protein(v) => Ok(v),
14
- _ => panic!("This will never run")
15
- };
16
- }
17
-
18
- #[pyfunction]
19
- fn calculate_sasa_at_residue_level(pdb_path: String,probe_radius: Option<f32>,n_points: Option<usize>) -> PyResult<Vec<f32>> {
20
- let (mut pdb, _errors) = pdbtbx::open(
21
- pdb_path,
22
- StrictnessLevel::Medium
23
- ).unwrap();
24
- let result = rust_sasa::calculate_sasa(&pdb,probe_radius,n_points,SASALevel::Residue).unwrap();
25
- return match result {
26
- SASAResult::Residue(v) => {
27
- let mut temp : Vec<f32> = vec![];
28
- for value in v {
29
- temp.push(value.value)
30
- }
31
- Ok(temp)
32
- },
33
- _ => panic!("This will never run")
34
- };
35
- }
36
-
37
- #[pyfunction]
38
- fn calculate_sasa_at_atom_level(pdb_path: String,probe_radius: Option<f32>,n_points: Option<usize>) -> PyResult<Vec<f32>> {
39
- let (mut pdb, _errors) = pdbtbx::open(
40
- pdb_path,
41
- StrictnessLevel::Medium
42
- ).unwrap();
43
- let result = rust_sasa::calculate_sasa(&pdb,probe_radius,n_points,SASALevel::Atom).unwrap();
44
- return match result {
45
- SASAResult::Atom(v) => {
46
- Ok(v)
47
- },
48
- _ => panic!("This will never run")
49
- };
50
- }
51
-
52
- #[pyfunction]
53
- fn calculate_sasa_at_chain_level(pdb_path: String,probe_radius: Option<f32>,n_points: Option<usize>) -> PyResult<Vec<f32>> {
54
- let (mut pdb, _errors) = pdbtbx::open(
55
- pdb_path,
56
- StrictnessLevel::Medium
57
- ).unwrap();
58
- let result = rust_sasa::calculate_sasa(&pdb,probe_radius,n_points,SASALevel::Chain).unwrap();
59
- return match result {
60
- SASAResult::Chain(v) => {
61
- let mut temp : Vec<f32> = vec![];
62
- for value in v {
63
- temp.push(value.value)
64
- }
65
- Ok(temp)
66
- },
67
- _ => panic!("This will never run")
68
- };
69
- }
70
-
71
- #[pymodule]
72
- fn rust_sasa_python(_py: Python, m: &PyModule) -> PyResult<()> {
73
- m.add_function(wrap_pyfunction!(calculate_sasa_at_protein_level, m)?)?;
74
- m.add_function(wrap_pyfunction!(calculate_sasa_at_chain_level, m)?)?;
75
- m.add_function(wrap_pyfunction!(calculate_sasa_at_residue_level, m)?)?;
76
- m.add_function(wrap_pyfunction!(calculate_sasa_at_atom_level, m)?)?;
77
- Ok(())
78
- }