Add torsion edges to aspirin reference data and update ToyReferenceData structure to include them in the toy pipeline
This commit is contained in:
@@ -339,5 +339,34 @@
|
||||
"length_angstrom": 1.417065754107979
|
||||
}
|
||||
],
|
||||
"torsion_edges": []
|
||||
"torsion_edges": [
|
||||
{
|
||||
"bond_index": 2,
|
||||
"atom_left": 1,
|
||||
"atom_right": 3,
|
||||
"rotating_side": [
|
||||
0,
|
||||
2
|
||||
]
|
||||
},
|
||||
{
|
||||
"bond_index": 3,
|
||||
"atom_left": 3,
|
||||
"atom_right": 4,
|
||||
"rotating_side": [
|
||||
0,
|
||||
1,
|
||||
2
|
||||
]
|
||||
},
|
||||
{
|
||||
"bond_index": 9,
|
||||
"atom_left": 10,
|
||||
"atom_right": 9,
|
||||
"rotating_side": [
|
||||
11,
|
||||
12
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -8,7 +8,7 @@ use riemann_flow_gnn::{
|
||||
api::{OneSampleToyBatch, OneSampleToyPipeline},
|
||||
conformer::LigandConformer,
|
||||
geometry::PoseState,
|
||||
graph::{Atom, Bond, LigandGraph},
|
||||
graph::{Atom, Bond, LigandGraph, TorsionEdge},
|
||||
viz::{export_simulation_video, plot_static_png},
|
||||
};
|
||||
use serde::Deserialize;
|
||||
@@ -48,6 +48,15 @@ struct ToyReferenceData {
|
||||
atoms: Vec<ToyAtom>,
|
||||
bonds: Vec<ToyBond>,
|
||||
coords_angstrom: Vec<[f32; 3]>,
|
||||
torsion_edges: Vec<TorsionEdgeJson>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct TorsionEdgeJson {
|
||||
bond_index: usize,
|
||||
atom_left: usize,
|
||||
atom_right: usize,
|
||||
rotating_side: Vec<usize>,
|
||||
}
|
||||
|
||||
fn load_toy_reference(path: &str) -> Result<(LigandGraph, LigandConformer), Box<dyn std::error::Error>> {
|
||||
@@ -76,7 +85,17 @@ fn load_toy_reference(path: &str) -> Result<(LigandGraph, LigandConformer), Box<
|
||||
is_rotatable: b.is_rotatable,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let graph = LigandGraph::new(atoms, bonds, vec![]);
|
||||
let torsion_edges = parsed
|
||||
.torsion_edges
|
||||
.into_iter()
|
||||
.map(|t| TorsionEdge {
|
||||
bond_index: t.bond_index,
|
||||
atom_left: t.atom_left,
|
||||
atom_right: t.atom_right,
|
||||
rotating_side: t.rotating_side,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let graph = LigandGraph::new(atoms, bonds, torsion_edges);
|
||||
let reference = LigandConformer::new(graph.clone(), parsed.coords_angstrom)?;
|
||||
Ok((graph, reference))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user