![]() |
Rosetta
2021.16
|
#include <ResidueTypeSetCache.hh>

Public Member Functions | |
| ResidueTypeSetCache (ResidueTypeSet const &rsd_type_set) | |
| ~ResidueTypeSetCache () override | |
| ResidueTypeSetCacheOP | clone (ResidueTypeSet const &rsd_type_set) const |
| ResidueTypeCOP | name_map (std::string const &name_in) const |
| ResidueTypeCOP | name_map_or_null (std::string const &name_in) const |
| void | add_residue_type (ResidueTypeCOP residue_type) |
| void | add_pass_through (ResidueTypeCOP residue_type) |
| Add a ResidueType to the cache which isn't strictly in the associated ResidueTypeSet, but is included here for efficiency/convenience. More... | |
| bool | is_pass_through (std::string const &name_in) |
| Is the ResidueType one of the pass-through convenience types? More... | |
| void | remove_residue_type (std::string const &name) |
| void | update_residue_type (ResidueTypeCOP residue_type_original, ResidueTypeCOP residue_type_new) |
| bool | has_generated_residue_type (ResidueTypeCOP rsd_type) const |
| bool | has_generated_residue_type (std::string const &rsd_name) const |
| void | add_prohibited (std::string const &rsd_name) |
| bool | is_prohibited (std::string const &rsd_name) const |
| bool | all_types_with_variants_aa_already_cached (AA aa, utility::vector1< std::string > const &variants, utility::vector1< VariantType > const &exceptions) const |
| Returns whether or not the all_types_with_variants_aa map already has an entry for the given combination of aa, variants, and exceptions. If so, then the cached data may be directly retrieved. More... | |
| void | cache_all_types_with_variants_aa (AA aa, utility::vector1< std::string > const &variants, utility::vector1< VariantType > const &exceptions, ResidueTypeCOPs cached_types) |
| ResidueTypeCOPs | retrieve_all_types_with_variants_aa (AA aa, utility::vector1< std::string > const &variants, utility::vector1< VariantType > const &exceptions) const |
| bool | all_types_with_variants_residuetypecops_already_cached (ResidueTypeCOP base_type, utility::vector1< VariantType > const &variants, utility::vector1< std::string > const &variant_strings, utility::vector1< VariantType > const &exceptions, bool const no_metapatches) const |
| Have we already cached this combination of base type, variants, and exceptions? More... | |
| void | cache_all_types_with_variants_residuetypecops (ResidueTypeCOP base_type, utility::vector1< VariantType > const &variants, utility::vector1< std::string > const &variant_strings, utility::vector1< VariantType > const &exceptions, bool const no_metapatches, ResidueTypeCOPs const &types_to_cache) |
| Cache this combination of base type, variants, and exceptions. More... | |
| ResidueTypeCOPs | retrieve_all_types_with_variants_residuetypecops (ResidueTypeCOP base_type, utility::vector1< VariantType > const &variants, utility::vector1< std::string > const &variant_strings, utility::vector1< VariantType > const &exceptions, bool const no_metapatches) const |
| Retrieve this combination of base type, variants, and exceptions. NOTE THAT THIS ASSUMES THIS INFORMATION WAS ALREADY CACHED! More... | |
| void | clear_cached_maps () |
| bool | maps_up_to_date () const |
| The RTSC performs just-in-time updates on data members that are accessed through two of its methods – before calling these methods, the ResidueTypeSet may need to obtain a write lock on the RTSC. Thse are: More... | |
| std::map< std::string, std::set< std::string > > const & | name3_generated_by_base_residue_name () |
| information on residue types whose name3's can be changed by patches. More... | |
| std::map< std::string, std::set< std::string > > const & | interchangeability_group_generated_by_base_residue_name () |
| interchangeability groups that appear upon patch application. More... | |
| bool | has_restype_with_name3 (std::string const &name3) const |
| Does this cache already have a residue with the given name3 This is likely to be slow, as it looks at all the generated residue types. More... | |
Private Member Functions | |
| void | regenerate_cached_maps () |
| ResidueTypeSetCache ()=delete | |
| ResidueTypeSetCache (ResidueTypeSetCache const &)=delete | |
Private Attributes | |
| ResidueTypeSet const & | rsd_type_set_ |
| std::map< std::string, ResidueTypeCOP > | name_map_ |
| map to ResidueType pointers by unique residue id More... | |
| std::set< std::string > | pass_throughs_ |
| ResidueTypes which don't directly belong to the associated ResidueTypeSet, but are included in the cache for efficiency. More... | |
| std::set< std::string > | prohibited_types_ |
| annotation about types which theoretically may exist but we don't want More... | |
| std::map < AA_VariantsExceptions, ResidueTypeCOPs > | cached_aa_variants_map_ |
| map to ResidueType pointers by AA enum – may deprecate soon. More... | |
| std::map < Restype_Variants_VariantStrings_Exceptions, ResidueTypeCOPs > | cached_restype_variants_map_ |
| Caching queries based on ResidueTypeCOP and variants to avoid recomputation with ResidueTypeFinder. More... | |
| bool | cache_up_to_date_ = false |
| True if the (batch) computed cached data is up to date. More... | |
| std::map< std::string, std::set< std::string > > | name3_generated_by_base_residue_name_ |
| information on residue types whose name3's can be changed by patches. More... | |
| std::map< std::string, std::set< std::string > > | interchangeability_group_generated_by_base_residue_name_ |
| interchangeability groups that appear upon patch application. More... | |
| core::chemical::ResidueTypeSetCache::ResidueTypeSetCache | ( | ResidueTypeSet const & | rsd_type_set | ) |
|
overridedefault |
|
privatedelete |
Referenced by clone().
|
privatedelete |
| void core::chemical::ResidueTypeSetCache::add_pass_through | ( | ResidueTypeCOP | residue_type | ) |
Add a ResidueType to the cache which isn't strictly in the associated ResidueTypeSet, but is included here for efficiency/convenience.
Must be write-locked by calling function
References add_residue_type(), and pass_throughs_.
| void core::chemical::ResidueTypeSetCache::add_prohibited | ( | std::string const & | rsd_name | ) |
Needs to be write-locked by calling function
References prohibited_types_.
| void core::chemical::ResidueTypeSetCache::add_residue_type | ( | ResidueTypeCOP | residue_type | ) |
Must be write-locked by calling function
References name_map_, and core::chemical::TR().
Referenced by add_pass_through().
| bool core::chemical::ResidueTypeSetCache::all_types_with_variants_aa_already_cached | ( | AA | aa, |
| utility::vector1< std::string > const & | variants, | ||
| utility::vector1< VariantType > const & | exceptions | ||
| ) | const |
Returns whether or not the all_types_with_variants_aa map already has an entry for the given combination of aa, variants, and exceptions. If so, then the cached data may be directly retrieved.
References cached_aa_variants_map_.
| bool core::chemical::ResidueTypeSetCache::all_types_with_variants_residuetypecops_already_cached | ( | ResidueTypeCOP | base_type, |
| utility::vector1< VariantType > const & | variants, | ||
| utility::vector1< std::string > const & | variant_strings, | ||
| utility::vector1< VariantType > const & | exceptions, | ||
| bool const | no_metapatches | ||
| ) | const |
Have we already cached this combination of base type, variants, and exceptions?
| [in] | base_type | A ResidueTypeCOP to a base residue type, used for looking up the variant. |
| [in] | variants | A list of VariantTypes that the returned ResidueTypes must have, used for looking up the variant. |
| [in] | variant_strings | A list of custom VariantTypes (that don't have enums) that the returned ResidueTypes must have, used for looking up the variant. |
| [in] | exceptions | A list of VariantTypes that are ignored in matching. |
| [in] | no_metapatches | If true, metapatches are ignored. |
References cached_restype_variants_map_.
| void core::chemical::ResidueTypeSetCache::cache_all_types_with_variants_aa | ( | AA | aa, |
| utility::vector1< std::string > const & | variants, | ||
| utility::vector1< VariantType > const & | exceptions, | ||
| ResidueTypeCOPs | cached_types | ||
| ) |
References cached_aa_variants_map_.
| void core::chemical::ResidueTypeSetCache::cache_all_types_with_variants_residuetypecops | ( | ResidueTypeCOP | base_type, |
| utility::vector1< VariantType > const & | variants, | ||
| utility::vector1< std::string > const & | variant_strings, | ||
| utility::vector1< VariantType > const & | exceptions, | ||
| bool const | no_metapatches, | ||
| ResidueTypeCOPs const & | types_to_cache | ||
| ) |
Cache this combination of base type, variants, and exceptions.
| [in] | base_type | A ResidueTypeCOP to a base residue type, used for looking up the variant. |
| [in] | variants | A list of VariantTypes that the returned ResidueTypes must have, used for looking up the variant. |
| [in] | variant_strings | A list of custom VariantTypes (that don't have enums) that the returned ResidueTypes must have, used for looking up the variant. |
| [in] | exceptions | A list of VariantTypes that are ignored in matching. |
| [in] | no_metapatches | If true, metapatches are ignored. |
| [in] | types_to_cache | A vector of ResidueTypeCOPs to associate with the key defined by the five variables above. |
References cached_restype_variants_map_.
| void core::chemical::ResidueTypeSetCache::clear_cached_maps | ( | ) |
Danger danger danger. Unsafe in a multithreaded environment.
References cache_up_to_date_, cached_aa_variants_map_, cached_restype_variants_map_, interchangeability_group_generated_by_base_residue_name_, and name3_generated_by_base_residue_name_.
Referenced by remove_residue_type(), and update_residue_type().
| ResidueTypeSetCacheOP core::chemical::ResidueTypeSetCache::clone | ( | ResidueTypeSet const & | rsd_type_set | ) | const |
References name_map_, pass_throughs_, prohibited_types_, and ResidueTypeSetCache().
| bool core::chemical::ResidueTypeSetCache::has_generated_residue_type | ( | ResidueTypeCOP | residue_type | ) | const |
Must be read-locked by calling function
References name_map_.
| bool core::chemical::ResidueTypeSetCache::has_generated_residue_type | ( | std::string const & | rsd_name | ) | const |
Must be read-locked by calling function
References name_map_.
| bool core::chemical::ResidueTypeSetCache::has_restype_with_name3 | ( | std::string const & | name3 | ) | const |
Does this cache already have a residue with the given name3 This is likely to be slow, as it looks at all the generated residue types.
References name_map_, and core::scoring::pair.
| std::map< std::string, std::set< std::string > > const & core::chemical::ResidueTypeSetCache::interchangeability_group_generated_by_base_residue_name | ( | ) |
interchangeability groups that appear upon patch application.
To call this function, the ResidueTypeSet will need to obtain a write lock if the maps_up_to_date function returns false. Otherwise, a read lock will suffice.
References cache_up_to_date_, interchangeability_group_generated_by_base_residue_name_, and regenerate_cached_maps().
| bool core::chemical::ResidueTypeSetCache::is_pass_through | ( | std::string const & | name_in | ) |
Is the ResidueType one of the pass-through convenience types?
Must be read-locked by calling function
References pass_throughs_.
| bool core::chemical::ResidueTypeSetCache::is_prohibited | ( | std::string const & | rsd_name | ) | const |
Needs to be read-locked by calling function
References prohibited_types_.
|
inline |
The RTSC performs just-in-time updates on data members that are accessed through two of its methods – before calling these methods, the ResidueTypeSet may need to obtain a write lock on the RTSC. Thse are:
References cache_up_to_date_.
| std::map< std::string, std::set< std::string > > const & core::chemical::ResidueTypeSetCache::name3_generated_by_base_residue_name | ( | ) |
information on residue types whose name3's can be changed by patches.
To call this function, the ResidueTypeSet will need to obtain a write lock if the maps_up_to_date function returns false. Otherwise, a read lock will suffice.
References cache_up_to_date_, name3_generated_by_base_residue_name_, and regenerate_cached_maps().
| ResidueTypeCOP core::chemical::ResidueTypeSetCache::name_map | ( | std::string const & | name_in | ) | const |
Main accessor function into ResidueTypeSetCache
Main accessor function into ResidueTypeSetCache. Must be read locked by calling function.
References name_map_.
| ResidueTypeCOP core::chemical::ResidueTypeSetCache::name_map_or_null | ( | std::string const & | name_in | ) | const |
Like name_map, but returns a nullptr rather than raising an error if the entry can't be found
Must be read locked by calling function.
References name_map_.
|
private |
following assumes that all new name3 and interchangeability groups for residue types can be discovered by applying patches to base residue types – i.e. on the 'first patch'. Probably should set up a runtime_assert in ResidueTypeFinder to check this assumption.
References core::chemical::ResidueTypeSet::base_residue_types(), cache_up_to_date_, interchangeability_group_generated_by_base_residue_name_, name3_generated_by_base_residue_name_, core::chemical::ResidueTypeSet::patches(), and rsd_type_set_.
Referenced by interchangeability_group_generated_by_base_residue_name(), and name3_generated_by_base_residue_name().
| void core::chemical::ResidueTypeSetCache::remove_residue_type | ( | std::string const & | name | ) |
Danger Danger Danger. Unsafe in a multi-threaded environment.
References clear_cached_maps(), name_map_, and pass_throughs_.
| ResidueTypeCOPs core::chemical::ResidueTypeSetCache::retrieve_all_types_with_variants_aa | ( | AA | aa, |
| utility::vector1< std::string > const & | variants, | ||
| utility::vector1< VariantType > const & | exceptions | ||
| ) | const |
References cached_aa_variants_map_.
| ResidueTypeCOPs core::chemical::ResidueTypeSetCache::retrieve_all_types_with_variants_residuetypecops | ( | ResidueTypeCOP | base_type, |
| utility::vector1< VariantType > const & | variants, | ||
| utility::vector1< std::string > const & | variant_strings, | ||
| utility::vector1< VariantType > const & | exceptions, | ||
| bool const | no_metapatches | ||
| ) | const |
Retrieve this combination of base type, variants, and exceptions. NOTE THAT THIS ASSUMES THIS INFORMATION WAS ALREADY CACHED!
| [in] | base_type | A ResidueTypeCOP to a base residue type, used for looking up the variant. |
| [in] | variants | A list of VariantTypes that the returned ResidueTypes must have, used for looking up the variant. |
| [in] | variant_strings | A list of custom VariantTypes (that don't have enums) that the returned ResidueTypes must have, used for looking up the variant. |
| [in] | exceptions | A list of VariantTypes that are ignored in matching. |
| [in] | no_metapatches | If true, metapatches are ignored. |
References cached_restype_variants_map_.
| void core::chemical::ResidueTypeSetCache::update_residue_type | ( | ResidueTypeCOP | residue_type_original, |
| ResidueTypeCOP | residue_type_new | ||
| ) |
Danger Danger Danger. Unsafe in a multi-threaded environment
References clear_cached_maps(), and name_map_.
|
private |
True if the (batch) computed cached data is up to date.
Referenced by clear_cached_maps(), interchangeability_group_generated_by_base_residue_name(), maps_up_to_date(), name3_generated_by_base_residue_name(), and regenerate_cached_maps().
|
private |
map to ResidueType pointers by AA enum – may deprecate soon.
map to ResidueType pointers by 3-letter string name – may deprecate soon. caching queries based on aa & variants to avoid recomputation with ResidueTypeFinder
Referenced by all_types_with_variants_aa_already_cached(), cache_all_types_with_variants_aa(), clear_cached_maps(), and retrieve_all_types_with_variants_aa().
|
private |
Caching queries based on ResidueTypeCOP and variants to avoid recomputation with ResidueTypeFinder.
The key is a tuple of < BASE residue type COP, included variant list (enum and string), excluded variant list (enum and string) >.
Referenced by all_types_with_variants_residuetypecops_already_cached(), cache_all_types_with_variants_residuetypecops(), clear_cached_maps(), and retrieve_all_types_with_variants_residuetypecops().
|
private |
interchangeability groups that appear upon patch application.
Referenced by clear_cached_maps(), interchangeability_group_generated_by_base_residue_name(), and regenerate_cached_maps().
|
private |
information on residue types whose name3's can be changed by patches.
Referenced by clear_cached_maps(), name3_generated_by_base_residue_name(), and regenerate_cached_maps().
|
private |
map to ResidueType pointers by unique residue id
Referenced by add_residue_type(), clone(), has_generated_residue_type(), has_restype_with_name3(), name_map(), name_map_or_null(), remove_residue_type(), and update_residue_type().
|
private |
ResidueTypes which don't directly belong to the associated ResidueTypeSet, but are included in the cache for efficiency.
Referenced by add_pass_through(), clone(), is_pass_through(), and remove_residue_type().
|
private |
annotation about types which theoretically may exist but we don't want
For example, for PDB components which duplicate standard types.
Referenced by add_prohibited(), clone(), and is_prohibited().
|
private |
Referenced by regenerate_cached_maps().
1.8.7