Struct Interactor

Source
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

Source

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 - A u16 that specifies the unique identifier for the new Interactor.
§Returns

A new Interactor instance with the specified ID and default values for all other fields.

Source

pub fn is_valid(&self) -> Result<bool, &str>

Checks if the Interactor is in a valid state.

This method performs two validity checks:

  1. Ensures that the target set is not empty.
  2. 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.
Source

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:

  1. Opens the PDB file specified in the structure field.
  2. Retrieves the residues corresponding to the active residues.
  3. Performs a neighbor search to find residues within 5.0 Å of the active residues.
  4. Adds these neighboring residues to the passive set.
§Panics

This method will panic if:

  • The structure field is None.
  • 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
Source

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:

  1. Opens the PDB file specified in the structure field.
  2. Calculates the SASA for all residues in the structure.
  3. Identifies surface residues (those with relative SASA > 0.7) on the same chain as the interactor.
  4. Adds these surface residues to the passive set.
§Panics

This method will panic if:

  • The structure field is None.
  • 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.

Source

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:

  1. Opens the PDB file specified in the structure field.
  2. Calculates the SASA for all residues in the structure.
  3. Identifies buried residues (those with relative SASA below a certain cutoff) on the same chain as the interactor.
  4. Removes these buried residues from both the active and passive sets.
§Panics

This method will panic if:

  • The structure field is None.
  • 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.

Source

pub fn id(&self) -> u16

Returns the unique identifier of the Interactor.

§Returns

A u16 representing the ID of the Interactor.

Source

pub fn chain(&self) -> &str

Returns the chain identifier of the Interactor.

§Returns

A string slice (&str) representing the chain of the Interactor.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.
Source

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.

Source

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.

Source

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.
Source

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.

Source

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.

Source

pub fn set_pdb(&mut self, pdb: PDB)

Stores a PDB structure in the Interactor.

§Arguments
  • pdb - The PDB structure to store
Source

pub fn set_chain(&mut self, chain: &str)

Sets the chain identifier for the Interactor.

§Arguments
  • chain - A string slice containing the chain identifier.
Source

pub fn set_active(&mut self, active: Vec<i16>)

Sets the active residues for the Interactor.

§Arguments
  • active - A vector of i16 values representing the active residue numbers.
Source

pub fn set_passive(&mut self, passive: Vec<i16>)

Sets the passive residues for the Interactor.

§Arguments
  • passive - A vector of i16 values representing the passive residue numbers.
Source

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.
Source

pub fn set_target_distance(&mut self, distance: f64)

Sets the target distance for the Interactor.

§Arguments
  • distance - A f64 value representing the target distance.
Source

pub fn set_lower_margin(&mut self, margin: f64)

Sets the lower margin for the Interactor.

§Arguments
  • margin - A f64 value representing the lower margin.
Source

pub fn set_upper_margin(&mut self, margin: f64)

Sets the upper margin for the Interactor.

§Arguments
  • margin - A f64 value representing the upper margin.
Source

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.

Source

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.

Source

pub fn filter_buried(&self) -> bool

Returns whether buried residues should be filtered.

§Returns

A bool indicating if buried residues should be filtered.

Source

pub fn set_filter_buried_cutoff(&mut self, cutoff: f64)

Sets whether passive residues should be derived from active residues.

§Arguments
  • cutoff - A f64 value representing the cutoff to filter buried residues.
Source

pub fn add_target(&mut self, target: u16)

Adds a target interactor ID.

§Arguments
  • target - A u16 value representing the ID of the target interactor to add.
Source

pub fn set_active_atoms(&mut self, atoms: Vec<String>)

Sets the active atoms for the Interactor.

§Arguments
  • atoms - A vector of Strings representing the active atom names.
Source

pub fn set_passive_atoms(&mut self, atoms: Vec<String>)

Sets the passive atoms for the Interactor.

§Arguments
  • atoms - A vector of Strings representing the passive atom names.
Source

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.

Source

pub fn make_pml_string(&self, passive_res: Vec<PassiveResidues<'_>>) -> String

Trait Implementations§

Source§

impl Clone for Interactor

Source§

fn clone(&self) -> Interactor

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Interactor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Interactor

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,