Rosetta
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
protocols::drug_design::ReactionBasedAnalogSampler Class Reference

#include <ReactionBasedAnalogSampler.hh>

Inheritance diagram for protocols::drug_design::ReactionBasedAnalogSampler:
Inheritance graph
[legend]

Classes

struct  Product
 
struct  Reagent
 

Public Member Functions

 ReactionBasedAnalogSampler ()
 
 ~ReactionBasedAnalogSampler () override
 
void apply (core::chemical::MutableResidueType &) override
 Modify the passed ResidueType. More...
 
void parse_my_tag (utility::tag::TagCOP tag, basic::datacache::DataMap &datacache) override
 Initialize any data members of this instance from an input tag and a DataMap object. More...
 
core::chemical::VDVDMapping get_mapping () const override
 Get the vertex mapping that was used for the last apply() or get_additional_output() This is a mapping FROM the vds in the BEFORE MutableResidueType TO the vds in the AFTER MutableResidueType. The base class implementation defaults to an identity mapping. More...
 
void reset_spl_ratio ()
 
void load_reactions (std::string const &reaction_dir, std::string const &filename)
 load reaction files from a designated path (deprecated) More...
 
void load_reactions (std::string const &filename)
 load reactions from a single file More...
 
- Public Member Functions inherited from protocols::chemistries::Chemistry
 Chemistry (std::string const &name)
 
virtual void apply (core::chemical::MutableResidueType &restype, core::pose::Pose const &)
 Modify the passed ResidueType, context sensitive. More...
 
- Public Member Functions inherited from core::chemical::modifications::ChemistryBase
 ChemistryBase (std::string const &name)
 
std::string name () const
 Return the name of this Chemistry object. More...
 
virtual bool has_additional_output () const
 Are there alternate ResidueTypes which are availible from the last time we called apply? (That is, will get_addtional_output() return non-null?) More...
 
virtual core::chemical::MutableResidueTypeOP get_additional_output ()
 Get additional generated ResidueTypes, if any. This allows for 1-to-many Chemistries. More...
 
ChemistryStatus get_last_status () const
 What was the status of the last call to apply()/get_additional_output() More...
 
void set_last_status (ChemistryStatus setting)
 Set the status of the chemistry object. More...
 

Static Public Member Functions

static std::string class_name ()
 
static void provide_xml_schema (utility::tag::XMLSchemaDefinition &xsd)
 

Private Member Functions

void load_all_reagents ()
 load reagents through corresponding reactions (deprecated) More...
 
void load_all_reagents (std::string const &filename)
 load reagents from a single file More...
 
bool check_reagent_validity (::RDKit::ROMOL_SPTR reag) const
 check if the reagent contains bad structures that would later fail RDKit More...
 
utility::vector1< Productsample (std::list< std::pair< core::Real, core::Size > > &score_idx_set) const
 Draw samples given a list of fragment similarity to reference input. More...
 
utility::vector1< Productsample_fragment (utility::vector1< std::list< std::pair< core::Real, core::Size > > > &score_idx_set) const
 Draw samples given lists of fragment similarity to first round product reagents. More...
 
Product sample_candidate (const utility::vector1< Product > &candidate_set, const ::RDKit::RWMOL_SPTR rdmol)
 Draw a product from the given candidate set. More...
 
std::shared_ptr<::RDKit::SparseIntVect< unsigned int > > getMorganFingerprint (::RDKit::ROMol const &mol, bool useFeatures=false) const
 A helper function to easily switch between using ECFP and FCFP. More...
 
core::chemical::IndexIndexMapping find_O3A_mapping (::RDKit::ROMOL_SPTR from, ::RDKit::ROMOL_SPTR to) const
 Find a common substructure mapping using RDKit Open3DAlign method. More...
 
void geometric_sampling (numeric::random::WeightedSampler &sampler, core::Size N)
 Setup weights for a sampler. Weighted sampling with geometric distribution; common ratio dynamically decided by population size. More...
 
utility::vector1< Productanalog_search (const ReactionBasedAnalogSampler::Product &prod) const
 Return analogs of the chosen product, can be itself. More...
 
void pair (core::Size r_no, utility::vector1< utility::vector1< core::Size > > const &sets, utility::vector1< Product > &candidates, int &revisits) const
 Find all pair of reagents that can undergo the specific reaction from the current sets. More...
 
void pair (core::Size curr_no, core::Size r_no, utility::vector1< core::Size > single_pair, utility::vector1< utility::vector1< core::Size > > &all_pairs, utility::vector1< utility::vector1< core::Size > > const &sets) const
 Helper function for pairing. Use a DFS to generate all pairs. More...
 
Product run_reaction (utility::vector1< core::Size > const &reagents) const
 Run the reaction given the list of reagent indices. More...
 

Static Private Member Functions

static bool sortbySim (const std::pair< core::Real, core::Size > &a, const std::pair< core::Real, core::Size > &b)
 helper function for comparing score_index paires More...
 

Private Attributes

std::unordered_set< Product, Product::HashFunctionvisited_
 
std::string last_smiles_
 
std::unordered_map< std::string, ChemicalReactionOPrxns_
 
utility::vector1< Reagentreagents_
 
numeric::random::WeightedSampler reagent_sampler_
 
core::Real geo_spl_ratio_
 
bool dynamic_sampling_
 
utility::vector1< core::Realdynamic_spl_ratios_
 
core::Size minCandidates_
 
core::chemical::VDVDMapping mapping_
 

Constructor & Destructor Documentation

◆ ReactionBasedAnalogSampler()

protocols::drug_design::ReactionBasedAnalogSampler::ReactionBasedAnalogSampler ( )

◆ ~ReactionBasedAnalogSampler()

protocols::drug_design::ReactionBasedAnalogSampler::~ReactionBasedAnalogSampler ( )
override

Member Function Documentation

◆ analog_search()

utility::vector1< ReactionBasedAnalogSampler::Product > protocols::drug_design::ReactionBasedAnalogSampler::analog_search ( const ReactionBasedAnalogSampler::Product prod) const
private

◆ apply()

void protocols::drug_design::ReactionBasedAnalogSampler::apply ( core::chemical::MutableResidueType )
overridevirtual

Modify the passed ResidueType.

if you have a Pose, call the one which takes the Pose context

Implements protocols::chemistries::Chemistry.

References core::chemical::ResidueTypeBase::add_string_property(), core::chemical::MutableResidueType::atom_name(), core::chemical::MutableResidueType::bonded_heavyatoms(), core::chemical::AtomRefMapping< FromRef, ToRef >::clear(), core::chemical::combine(), dynamic_sampling_, dynamic_spl_ratios_, core::chemical::AtomRefMapping< FromRef, ToRef >::empty(), core::chemical::modifications::FAIL_DO_NOT_RETRY, find_O3A_mapping(), core::chemical::rdkit::RDMolToRestype::generate_restype(), geo_spl_ratio_, geometric_sampling(), core::chemical::AtomRefMapping< FromRef, ToRef >::identity(), core::chemical::rdkit::RDMolToRestype::index_to_vd(), core::chemical::AtomRefMapping< FromRef, ToRef >::invalid_entry(), core::chemical::INVALID_VD, core::chemical::rdkit::label_with_index(), last_smiles_, mapping_, protocols::mean_field::min(), core::chemical::rdkit::RestypeToRDMol::Mol(), core::chemical::MutableResidueType::nbr_vertex(), core::pack::dunbrack::product(), core::chemical::ResidueTypeBase::properties(), reagent_sampler_, reagents_, reset_spl_ratio(), rxns_, sample(), sample_candidate(), protocols::hybridization::score, core::chemical::modifications::ChemistryBase::set_last_status(), core::chemical::rdkit::RDMolToRestype::set_nbr(), core::chemical::ResidueProperties::string_properties(), core::chemical::modifications::SUCCESS, core::id::to_string(), protocols::drug_design::TR(), core::chemical::rdkit::RestypeToRDMol::vd_to_index(), and visited_.

◆ check_reagent_validity()

bool protocols::drug_design::ReactionBasedAnalogSampler::check_reagent_validity ( ::RDKit::ROMOL_SPTR  reag) const
private

check if the reagent contains bad structures that would later fail RDKit

Referenced by load_all_reagents().

◆ class_name()

std::string protocols::drug_design::ReactionBasedAnalogSampler::class_name ( )
static

◆ find_O3A_mapping()

core::chemical::IndexIndexMapping protocols::drug_design::ReactionBasedAnalogSampler::find_O3A_mapping ( ::RDKit::ROMOL_SPTR  from,
::RDKit::ROMOL_SPTR  to 
) const
private

◆ geometric_sampling()

void protocols::drug_design::ReactionBasedAnalogSampler::geometric_sampling ( numeric::random::WeightedSampler &  sampler,
core::Size  N 
)
private

Setup weights for a sampler. Weighted sampling with geometric distribution; common ratio dynamically decided by population size.

References geo_spl_ratio_, protocols::mean_field::max(), core::chemical::element::N, and core::chemical::rings::q.

Referenced by apply(), load_all_reagents(), and sample_candidate().

◆ get_mapping()

core::chemical::VDVDMapping protocols::drug_design::ReactionBasedAnalogSampler::get_mapping ( ) const
overridevirtual

Get the vertex mapping that was used for the last apply() or get_additional_output() This is a mapping FROM the vds in the BEFORE MutableResidueType TO the vds in the AFTER MutableResidueType. The base class implementation defaults to an identity mapping.

Get the vertex mapping that was used for the last apply() The base class implementation defaults to an identity mapping.

Reimplemented from core::chemical::modifications::ChemistryBase.

References mapping_.

◆ getMorganFingerprint()

std::shared_ptr<::RDKit::SparseIntVect< unsigned int > > protocols::drug_design::ReactionBasedAnalogSampler::getMorganFingerprint ( ::RDKit::ROMol const &  mol,
bool  useFeatures = false 
) const
private

A helper function to easily switch between using ECFP and FCFP.

◆ load_all_reagents() [1/2]

void protocols::drug_design::ReactionBasedAnalogSampler::load_all_reagents ( )
private

◆ load_all_reagents() [2/2]

void protocols::drug_design::ReactionBasedAnalogSampler::load_all_reagents ( std::string const &  filename)
private

◆ load_reactions() [1/2]

void protocols::drug_design::ReactionBasedAnalogSampler::load_reactions ( std::string const &  filename)

load reactions from a single file

References protocols::abinitio::filename(), rxns_, and protocols::drug_design::TR().

◆ load_reactions() [2/2]

void protocols::drug_design::ReactionBasedAnalogSampler::load_reactions ( std::string const &  reaction_dir,
std::string const &  filename 
)

load reaction files from a designated path (deprecated)

References protocols::abinitio::filename(), rxns_, and protocols::drug_design::TR().

Referenced by parse_my_tag().

◆ pair() [1/2]

void protocols::drug_design::ReactionBasedAnalogSampler::pair ( core::Size  curr_no,
core::Size  r_no,
utility::vector1< core::Size single_pair,
utility::vector1< utility::vector1< core::Size > > &  all_pairs,
utility::vector1< utility::vector1< core::Size > > const &  sets 
) const
private

Helper function for pairing. Use a DFS to generate all pairs.

References pair().

◆ pair() [2/2]

void protocols::drug_design::ReactionBasedAnalogSampler::pair ( core::Size  r_no,
utility::vector1< utility::vector1< core::Size > > const &  sets,
utility::vector1< Product > &  candidates,
int &  revisits 
) const
private

Find all pair of reagents that can undergo the specific reaction from the current sets.

References protocols::drug_design::ReactionBasedAnalogSampler::Product::rdmol_, run_reaction(), and visited_.

Referenced by pair(), sample(), and sample_fragment().

◆ parse_my_tag()

void protocols::drug_design::ReactionBasedAnalogSampler::parse_my_tag ( utility::tag::TagCOP  tag,
basic::datacache::DataMap datacache 
)
overridevirtual

Initialize any data members of this instance from an input tag and a DataMap object.

Implements protocols::chemistries::Chemistry.

References dynamic_sampling_, dynamic_spl_ratios_, geo_spl_ratio_, last_smiles_, load_all_reagents(), load_reactions(), minCandidates_, and protocols::drug_design::TR().

◆ provide_xml_schema()

void protocols::drug_design::ReactionBasedAnalogSampler::provide_xml_schema ( utility::tag::XMLSchemaDefinition &  xsd)
static

◆ reset_spl_ratio()

void protocols::drug_design::ReactionBasedAnalogSampler::reset_spl_ratio ( )
inline

References dynamic_spl_ratios_, and geo_spl_ratio_.

Referenced by apply().

◆ run_reaction()

ReactionBasedAnalogSampler::Product protocols::drug_design::ReactionBasedAnalogSampler::run_reaction ( utility::vector1< core::Size > const &  reagents) const
private

◆ sample()

utility::vector1< ReactionBasedAnalogSampler::Product > protocols::drug_design::ReactionBasedAnalogSampler::sample ( std::list< std::pair< core::Real, core::Size > > &  score_idx_set) const
private

Draw samples given a list of fragment similarity to reference input.

References core::sequence::end, minCandidates_, pair(), reagent_sampler_, reagents_, rxns_, and protocols::drug_design::TR().

Referenced by apply(), and sample_fragment().

◆ sample_candidate()

ReactionBasedAnalogSampler::Product protocols::drug_design::ReactionBasedAnalogSampler::sample_candidate ( const utility::vector1< Product > &  candidate_set,
const ::RDKit::RWMOL_SPTR  rdmol 
)
private

◆ sample_fragment()

utility::vector1< ReactionBasedAnalogSampler::Product > protocols::drug_design::ReactionBasedAnalogSampler::sample_fragment ( utility::vector1< std::list< std::pair< core::Real, core::Size > > > &  score_idx_set) const
private

Draw samples given lists of fragment similarity to first round product reagents.

References core::sequence::end, minCandidates_, pair(), reagent_sampler_, reagents_, rxns_, sample(), and protocols::drug_design::TR().

Referenced by analog_search().

◆ sortbySim()

bool protocols::drug_design::ReactionBasedAnalogSampler::sortbySim ( const std::pair< core::Real, core::Size > &  a,
const std::pair< core::Real, core::Size > &  b 
)
staticprivate

helper function for comparing score_index paires

References core::pose::motif::a(), and protocols::match::upstream::b.

Referenced by sample_candidate().

Member Data Documentation

◆ dynamic_sampling_

bool protocols::drug_design::ReactionBasedAnalogSampler::dynamic_sampling_
private

Referenced by apply(), and parse_my_tag().

◆ dynamic_spl_ratios_

utility::vector1< core::Real > protocols::drug_design::ReactionBasedAnalogSampler::dynamic_spl_ratios_
private

◆ geo_spl_ratio_

core::Real protocols::drug_design::ReactionBasedAnalogSampler::geo_spl_ratio_
private

◆ last_smiles_

std::string protocols::drug_design::ReactionBasedAnalogSampler::last_smiles_
private

Referenced by apply(), and parse_my_tag().

◆ mapping_

core::chemical::VDVDMapping protocols::drug_design::ReactionBasedAnalogSampler::mapping_
private

Referenced by apply(), and get_mapping().

◆ minCandidates_

core::Size protocols::drug_design::ReactionBasedAnalogSampler::minCandidates_
private

◆ reagent_sampler_

numeric::random::WeightedSampler protocols::drug_design::ReactionBasedAnalogSampler::reagent_sampler_
private

◆ reagents_

utility::vector1< Reagent > protocols::drug_design::ReactionBasedAnalogSampler::reagents_
private

◆ rxns_

std::unordered_map< std::string, ChemicalReactionOP > protocols::drug_design::ReactionBasedAnalogSampler::rxns_
private

◆ visited_

std::unordered_set< Product, Product::HashFunction > protocols::drug_design::ReactionBasedAnalogSampler::visited_
private

Referenced by apply(), and pair().


The documentation for this class was generated from the following files: