cosmol-viewer 0.1.5.dev6__tar.gz → 0.1.5.dev7__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.
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/Cargo.lock +2 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/PKG-INFO +1 -1
- cosmol_viewer-0.1.5.dev6/crates/core/src/parser/compute_secondary_structure.rs → cosmol_viewer-0.1.5.dev7/crates/core/src/parser/DSSP.rs +12 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/parser/mmcif.rs +1 -1
- cosmol_viewer-0.1.5.dev7/crates/core/src/parser/mod.rs +3 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/shapes/molecules.rs +4 -4
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/utils.rs +23 -13
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/wasm/src/lib.rs +1 -1
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/pyproject.toml +1 -1
- cosmol_viewer-0.1.5.dev6/crates/core/src/parser/mod.rs +0 -3
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/Cargo.toml +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/README.md +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/Cargo.toml +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/lib.rs +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/parser/sdf.rs +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/scene.rs +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/shader/bg_fragment.glsl +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/shader/bg_vertex.glsl +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/shader/canvas.rs +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/shader/fragment.glsl +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/shader/mod.rs +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/shader/vertex.glsl +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/shader/vertex_sphere.glsl +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/shader/vertex_stick.glsl +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/shapes/mod.rs +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/shapes/protein.rs +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/shapes/sphere.rs +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/shapes/stick.rs +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/python/Cargo.toml +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/python/README.md +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/python/build.rs +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/python/cosmol_viewer.pyi +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/python/src/lib.rs +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/python/src/parser.rs +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/python/src/render_molecule.py +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/python/src/shapes.rs +0 -0
- {cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/wasm/Cargo.toml +0 -0
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
// DSSP secondary structure assignment
|
|
2
|
+
//
|
|
3
|
+
// Ported and adapted from ChimeraX:
|
|
4
|
+
// https://github.com/RBVI/ChimeraX/blob/develop/src/bundles/atomic_lib/atomic_cpp/atomstruct_cpp/CompSS.cpp
|
|
5
|
+
//
|
|
6
|
+
// Original ChimeraX code (c) 2004-2025 Regents of the University of California.
|
|
7
|
+
// Licensed under a BSD-style license; see the original repository for details.
|
|
8
|
+
//
|
|
9
|
+
// Original DSSP algorithm:
|
|
10
|
+
// Kabsch & Sander, Biopolymers 22:2577-2637 (1983)
|
|
11
|
+
// https://doi.org/10.1002/bip.360221211
|
|
12
|
+
|
|
1
13
|
use crate::parser::mmcif::Residue;
|
|
2
14
|
use crate::parser::mmcif::SecondaryStructure;
|
|
3
15
|
use glam::Vec3;
|
|
@@ -54,11 +54,11 @@ pub enum BondType {
|
|
|
54
54
|
|
|
55
55
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
|
56
56
|
pub struct Molecules {
|
|
57
|
-
atom_types: Vec<String>,
|
|
57
|
+
pub atom_types: Vec<String>,
|
|
58
58
|
#[serde(with = "vec_f16_scaled::vec")]
|
|
59
|
-
atoms: Vec<Vec3>,
|
|
60
|
-
bond_types: Vec<BondType>,
|
|
61
|
-
bonds: Vec<[usize; 2]>,
|
|
59
|
+
pub atoms: Vec<Vec3>,
|
|
60
|
+
pub bond_types: Vec<BondType>,
|
|
61
|
+
pub bonds: Vec<[usize; 2]>,
|
|
62
62
|
pub quality: u32,
|
|
63
63
|
|
|
64
64
|
pub style: VisualStyle,
|
|
@@ -200,7 +200,7 @@ pub struct Frames {
|
|
|
200
200
|
|
|
201
201
|
use half::f16;
|
|
202
202
|
use serde::{Deserializer, Serializer};
|
|
203
|
-
pub mod
|
|
203
|
+
pub mod vec_f16 {
|
|
204
204
|
use super::*;
|
|
205
205
|
|
|
206
206
|
pub fn serialize<S, T>(v: &T, s: S) -> Result<S::Ok, S::Error>
|
|
@@ -266,7 +266,7 @@ pub mod vec_f16_scaled {
|
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
pub mod
|
|
269
|
+
pub mod vec_f16_scaled {
|
|
270
270
|
use super::*;
|
|
271
271
|
|
|
272
272
|
// 你可以选择固定系数,或者运行时传
|
|
@@ -303,31 +303,41 @@ pub mod vec_f16_scaled_scaled {
|
|
|
303
303
|
pub mod vec {
|
|
304
304
|
use super::*;
|
|
305
305
|
|
|
306
|
-
|
|
307
|
-
pub fn serialize<S, T>(v: &T, s: S) -> Result<S::Ok, S::Error>
|
|
306
|
+
pub fn serialize<S, T>(v: &Vec<T>, s: S) -> Result<S::Ok, S::Error>
|
|
308
307
|
where
|
|
309
308
|
S: Serializer,
|
|
310
309
|
T: IntoF32Slice,
|
|
311
310
|
{
|
|
312
|
-
let bits: Vec<u16
|
|
313
|
-
.as_f32_slice()
|
|
311
|
+
let bits: Vec<Vec<u16>> = v
|
|
314
312
|
.iter()
|
|
315
|
-
.map(|
|
|
313
|
+
.map(|v| {
|
|
314
|
+
let floats: Vec<f32> = v.as_f32_slice().iter().map(|x| x * SCALE).collect();
|
|
315
|
+
floats
|
|
316
|
+
.into_iter()
|
|
317
|
+
.map(|x| f16::from_f32(x).to_bits())
|
|
318
|
+
.collect()
|
|
319
|
+
})
|
|
316
320
|
.collect();
|
|
317
321
|
bits.serialize(s)
|
|
318
322
|
}
|
|
319
323
|
|
|
320
|
-
pub fn deserialize<'de, D, T>(d: D) -> Result<T
|
|
324
|
+
pub fn deserialize<'de, D, T>(d: D) -> Result<Vec<T>, D::Error>
|
|
321
325
|
where
|
|
322
326
|
D: Deserializer<'de>,
|
|
323
327
|
T: FromF32Slice,
|
|
324
328
|
{
|
|
325
|
-
let bits: Vec<u16
|
|
326
|
-
let
|
|
327
|
-
.
|
|
328
|
-
.map(|
|
|
329
|
+
let bits: Vec<Vec<u16>> = Vec::<Vec<u16>>::deserialize(d)?;
|
|
330
|
+
let out = bits
|
|
331
|
+
.into_iter()
|
|
332
|
+
.map(|v| {
|
|
333
|
+
let floats: Vec<f32> = v
|
|
334
|
+
.iter()
|
|
335
|
+
.map(|b| f16::from_bits(*b).to_f32() / SCALE)
|
|
336
|
+
.collect();
|
|
337
|
+
T::from_f32_slice(&floats)
|
|
338
|
+
})
|
|
329
339
|
.collect();
|
|
330
|
-
Ok(
|
|
340
|
+
Ok(out)
|
|
331
341
|
}
|
|
332
342
|
}
|
|
333
343
|
}
|
|
@@ -8,7 +8,7 @@ use std::sync::Arc;
|
|
|
8
8
|
use std::sync::Mutex;
|
|
9
9
|
|
|
10
10
|
#[cfg(not(target_arch = "wasm32"))]
|
|
11
|
-
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
|
11
|
+
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
|
12
12
|
|
|
13
13
|
#[cfg(feature = "wasm")]
|
|
14
14
|
use web_sys::HtmlCanvasElement;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/shader/bg_fragment.glsl
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/shader/vertex_sphere.glsl
RENAMED
|
File without changes
|
{cosmol_viewer-0.1.5.dev6 → cosmol_viewer-0.1.5.dev7}/crates/core/src/shader/vertex_stick.glsl
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|