pub struct Interactor {
pub passive: HashSet<i16>,
/* private fields */
}
Expand description
Represents an interactor in a molecular system.
This struct contains information about a specific interactor, including its identification, residues, atoms, target interactions, and various parameters for interaction calculations.
Fields§
§passive: HashSet<i16>
Set of passive residue numbers.
Implementations§
Source§impl Interactor
impl Interactor
Sourcepub fn new(id: u16) -> Self
pub fn new(id: u16) -> Self
Creates a new Interactor
instance with default values.
This method initializes a new Interactor
with the given ID and default values for all other fields.
It’s marked with #[allow(clippy::too_many_arguments)]
to suppress warnings about the number of fields,
even though this constructor doesn’t actually take multiple arguments.
§Arguments
id
- Au16
that specifies the unique identifier for the newInteractor
.
§Returns
A new Interactor
instance with the specified ID and default values for all other fields.
Sourcepub fn is_valid(&self) -> Result<bool, &str>
pub fn is_valid(&self) -> Result<bool, &str>
Checks if the Interactor is in a valid state.
This method performs two validity checks:
- Ensures that the target set is not empty.
- Verifies that there’s no overlap between active and passive residues.
§Returns
Ok(true)
if the Interactor is valid.Err(&str)
with an error message if any validity check fails.
Sourcepub fn set_passive_from_active(&mut self)
pub fn set_passive_from_active(&mut self)
Sets passive residues based on the active residues and their neighboring residues.
This method performs the following steps:
- Opens the PDB file specified in the
structure
field. - Retrieves the residues corresponding to the active residues.
- Performs a neighbor search to find residues within 5.0 Å of the active residues.
- Adds these neighboring residues to the passive set.
§Panics
This method will panic if:
- The
structure
field isNone
. - There’s an error opening or parsing the PDB file.
§Side Effects
This method modifies the passive
set of the Interactor
, adding new residues based on
the neighbor search results.
§Dependencies
This method relies on external functions from the structure
module:
structure::get_residues
structure::neighbor_search
structure::load_pdb
Sourcepub fn set_surface_as_passive(&mut self)
pub fn set_surface_as_passive(&mut self)
Sets surface residues as passive based on their solvent accessible surface area (SASA).
This method performs the following steps:
- Opens the PDB file specified in the
structure
field. - Calculates the SASA for all residues in the structure.
- Identifies surface residues (those with relative SASA > 0.7) on the same chain as the interactor.
- Adds these surface residues to the passive set.
§Panics
This method will panic if:
- The
structure
field isNone
. - There’s an error opening or parsing the PDB file.
§Side Effects
This method modifies the passive
set of the Interactor
, adding new residues based on
the SASA calculation results.
§Dependencies
This method relies on external functions from the sasa
and structure
modules:
sasa::calculate_sasa
structure::load_pdb
§Note
The threshold for considering a residue as “surface” is set to 0.7 relative SASA. This value may need to be adjusted based on specific requirements.
Sourcepub fn remove_buried_residues(&mut self)
pub fn remove_buried_residues(&mut self)
Removes buried residues from both active and passive sets based on solvent accessible surface area (SASA).
This method performs the following steps:
- Opens the PDB file specified in the
structure
field. - Calculates the SASA for all residues in the structure.
- Identifies buried residues (those with relative SASA below a certain cutoff) on the same chain as the interactor.
- Removes these buried residues from both the active and passive sets.
§Panics
This method will panic if:
- The
structure
field isNone
. - There’s an error opening or parsing the PDB file.
§Side Effects
This method modifies both the active
and passive
sets of the Interactor
,
removing residues based on the SASA calculation results.
§Dependencies
This method relies on external functions from the sasa
and structure
module:
sasa::calculate_sasa
structure::load_pdb
§Note
The default threshold for considering a residue as “buried” is set to 0.7 relative SASA.
This can be customized by setting the filter_buried_cutoff
field of the Interactor
.
Sourcepub fn id(&self) -> u16
pub fn id(&self) -> u16
Returns the unique identifier of the Interactor.
§Returns
A u16
representing the ID of the Interactor.
Sourcepub fn chain(&self) -> &str
pub fn chain(&self) -> &str
Returns the chain identifier of the Interactor.
§Returns
A string slice (&str
) representing the chain of the Interactor.
Sourcepub fn active(&self) -> &HashSet<i16>
pub fn active(&self) -> &HashSet<i16>
Returns a reference to the set of active residues.
§Returns
A reference to a HashSet<i16>
containing the active residue numbers.
Sourcepub fn active_atoms(&self) -> &Option<Vec<String>>
pub fn active_atoms(&self) -> &Option<Vec<String>>
Returns a reference to a set of active atoms strings.
§Returns
A reference to a Option<Vec<String>>
containing active atom names.
Sourcepub fn passive(&self) -> &HashSet<i16>
pub fn passive(&self) -> &HashSet<i16>
Returns a reference to the set of passive residues.
§Returns
A reference to a HashSet<i16>
containing the passive residue numbers.
Sourcepub fn passive_atoms(&self) -> &Option<Vec<String>>
pub fn passive_atoms(&self) -> &Option<Vec<String>>
Returns a reference to a set of passive atoms strings.
§Returns
A reference to a Option<Vec<String>>
containing passive atom names.
Sourcepub fn wildcard(&self) -> &str
pub fn wildcard(&self) -> &str
Returns the wildcard string associated with this Interactor.
§Returns
- If a wildcard is set, returns a string slice (
&str
) containing the wildcard value. - If no wildcard is set, returns an empty string slice.
§Notes
- This method provides read-only access to the wildcard value.
- The wildcard is typically used to represent any residue or atom in certain contexts.
Sourcepub fn target(&self) -> &HashSet<u16>
pub fn target(&self) -> &HashSet<u16>
Returns a reference to the set of target interactor IDs.
§Returns
A reference to a HashSet<u16>
containing the IDs of target interactors.
Sourcepub fn structure(&self) -> &str
pub fn structure(&self) -> &str
Returns the structure file path of the Interactor.
§Returns
A string slice (&str
) representing the structure file path, or an empty string if not set.
Sourcepub fn set_structure(&mut self, structure: &str)
pub fn set_structure(&mut self, structure: &str)
Sets the structure file path for the Interactor.
§Arguments
structure
- A string slice containing the path to the structure file.
Sourcepub fn load_structure(
&mut self,
structure_path: &str,
) -> Result<(), Vec<PDBError>>
pub fn load_structure( &mut self, structure_path: &str, ) -> Result<(), Vec<PDBError>>
Loads a PDB structure from the given path and stores it.
§Returns
Ok(())
on success, or Vec<PDBError>
if loading failed.
Sourcepub fn pdb(&self) -> &Option<PDB>
pub fn pdb(&self) -> &Option<PDB>
Returns a reference to the stored PDB structure, if any.
§Returns
Reference to an Option<PDB>
containing the structure.
Sourcepub fn set_chain(&mut self, chain: &str)
pub fn set_chain(&mut self, chain: &str)
Sets the chain identifier for the Interactor.
§Arguments
chain
- A string slice containing the chain identifier.
Sourcepub fn set_active(&mut self, active: Vec<i16>)
pub fn set_active(&mut self, active: Vec<i16>)
Sets the active residues for the Interactor.
§Arguments
active
- A vector ofi16
values representing the active residue numbers.
Sourcepub fn set_passive(&mut self, passive: Vec<i16>)
pub fn set_passive(&mut self, passive: Vec<i16>)
Sets the passive residues for the Interactor.
§Arguments
passive
- A vector ofi16
values representing the passive residue numbers.
Sourcepub fn set_wildcard(&mut self, wildcard: &str)
pub fn set_wildcard(&mut self, wildcard: &str)
Sets the wildcard string for this Interactor.
This method allows you to set or update the wildcard value associated with the Interactor.
§Arguments
wildcard
- A string slice (&str
) that specifies the new wildcard value.
§Notes
- This method will overwrite any previously set wildcard value.
- The wildcard is stored as an owned
String
, so the input&str
is cloned. - An empty string is a valid wildcard value, though its interpretation may depend on the context.
- The wildcard is typically used to represent any residue or atom in certain contexts.
Sourcepub fn set_target_distance(&mut self, distance: f64)
pub fn set_target_distance(&mut self, distance: f64)
Sets the target distance for the Interactor.
§Arguments
distance
- Af64
value representing the target distance.
Sourcepub fn set_lower_margin(&mut self, margin: f64)
pub fn set_lower_margin(&mut self, margin: f64)
Sets the lower margin for the Interactor.
§Arguments
margin
- Af64
value representing the lower margin.
Sourcepub fn set_upper_margin(&mut self, margin: f64)
pub fn set_upper_margin(&mut self, margin: f64)
Sets the upper margin for the Interactor.
§Arguments
margin
- Af64
value representing the upper margin.
Sourcepub fn passive_from_active(&self) -> bool
pub fn passive_from_active(&self) -> bool
Returns whether passive residues should be derived from active residues.
§Returns
A bool
indicating if passive residues should be derived from active ones.
Sourcepub fn surface_as_passive(&self) -> bool
pub fn surface_as_passive(&self) -> bool
Returns whether surface residues should be treated as passive.
§Returns
A bool
indicating if surface residues should be treated as passive.
Sourcepub fn filter_buried(&self) -> bool
pub fn filter_buried(&self) -> bool
Returns whether buried residues should be filtered.
§Returns
A bool
indicating if buried residues should be filtered.
Sourcepub fn set_filter_buried_cutoff(&mut self, cutoff: f64)
pub fn set_filter_buried_cutoff(&mut self, cutoff: f64)
Sets whether passive residues should be derived from active residues.
§Arguments
cutoff
- Af64
value representing the cutoff to filter buried residues.
Sourcepub fn add_target(&mut self, target: u16)
pub fn add_target(&mut self, target: u16)
Adds a target interactor ID.
§Arguments
target
- Au16
value representing the ID of the target interactor to add.
Sourcepub fn set_active_atoms(&mut self, atoms: Vec<String>)
pub fn set_active_atoms(&mut self, atoms: Vec<String>)
Sets the active atoms for the Interactor.
§Arguments
atoms
- A vector ofString
s representing the active atom names.
Sourcepub fn set_passive_atoms(&mut self, atoms: Vec<String>)
pub fn set_passive_atoms(&mut self, atoms: Vec<String>)
Sets the passive atoms for the Interactor.
§Arguments
atoms
- A vector ofString
s representing the passive atom names.
Sourcepub fn create_block(&self, passive_res: Vec<PassiveResidues<'_>>) -> String
pub fn create_block(&self, passive_res: Vec<PassiveResidues<'_>>) -> String
Creates a block of restraints for the Interactor.
This method generates a string representation of restraints for the Interactor, based on its active residues and the provided target residues.
§Arguments
target_res
- A vector of tuples, each containing a chain identifier (&str) and a residue number (&i16) for the target residues.
§Returns
A String
containing the formatted block of restraints.
pub fn make_pml_string(&self, passive_res: Vec<PassiveResidues<'_>>) -> String
Trait Implementations§
Source§impl Clone for Interactor
impl Clone for Interactor
Source§fn clone(&self) -> Interactor
fn clone(&self) -> Interactor
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Interactor
impl Debug for Interactor
Source§impl<'de> Deserialize<'de> for Interactor
impl<'de> Deserialize<'de> for Interactor
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Interactor
impl RefUnwindSafe for Interactor
impl Send for Interactor
impl Sync for Interactor
impl Unpin for Interactor
impl UnwindSafe for Interactor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.