![]() |
Rosetta
2019.12
|
Namespaces | |
insert_statement_generator | |
schema_generator | |
Classes | |
class | DatabaseSessionLoader |
class | DatabaseSessionLoaderCreator |
class | DatabaseSessionOptions |
Typedefs | |
typedef utility::pointer::shared_ptr < DatabaseSessionLoader > | DatabaseSessionLoaderOP |
typedef utility::pointer::shared_ptr < DatabaseSessionLoader const > | DatabaseSessionLoaderCOP |
typedef utility::pointer::shared_ptr < DatabaseSessionOptions > | DatabaseSessionOptionsOP |
typedef utility::pointer::shared_ptr < DatabaseSessionOptions const > | DatabaseSessionOptionsCOP |
Functions | |
bool | open (utility::io::izstream &db_stream, std::string const &db_file, bool warn) |
Open a database file on a provided stream. More... | |
std::string | full_name (std::string const &db_file, bool warn) |
Full-path database file name. More... | |
std::string | find_database_path (std::string const &dir, std::string const &filename, bool const mute_error_if_failure) |
Find a path to a file. More... | |
std::string | find_database_path (std::string const &dir, std::string const &filename, std::string const &ext) |
Find a path to a file. More... | |
bool | find_cache_file (std::string const &cache_file, bool dir_only) |
Does cache file (absolute path) exist? if dir_only is true, will return true if the cache file could be created. More... | |
std::string | full_cache_name (std::string const &short_name, std::string const &source_file, bool for_writing) |
Get the (absolute) path to a given cached file. If source_file is given, it's the full path to the source database file that's being cached. If for_writing is true, will only check that the given file would be creatable. Will return an empty string if it can't find a cache file. More... | |
sessionOP | get_db_session () |
Aquire a database session using the command line options transaction type is set to standard. More... | |
sessionOP | get_db_session (std::string const &db_name, std::string const &pq_schema="") |
Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database. Transaction type set to standard. More... | |
sessionOP | get_db_session (string const &db_name, TransactionMode::e transaction_mode, Size chunk_size, string const &pq_schema) |
utility::sql_database::sessionOP | get_db_session (utility::sql_database::DatabaseMode::e db_mode, std::string const &db_name, std::string const &pq_schema) |
sessionOP | get_db_session (DatabaseMode::e db_mode, TransactionMode::e transaction_mode, Size chunk_size, string const &db_name, string const &pq_schema) |
platform::SSize | db_partition_from_options (DatabaseMode::e db_mode) |
@ More... | |
platform::SSize | resolve_db_partition (bool partition_by_mpi_process, platform::SSize manual_partition=-1) |
Returns partition identifer from mpi rank if in partitioned database mode, or valid manual partition, otherwise -1. More... | |
statement | safely_prepare_statement (string const &statement_string, sessionOP db_session) |
statement | prepare_statement_no_catch (string const &statement_string, sessionOP db_session) |
void | safely_write_to_database (statement &statement) |
result | safely_read_from_database (statement &statement) |
bool | table_exists (sessionOP db_session, string const &table_name) |
void | check_statement_sanity (string sql) |
void | insert_or_ignore (string table_name, std::vector< string > column_names, std::vector< string > values, sessionOP db_session) |
void | write_schema_to_database (string schema_str, sessionOP db_session) |
void | set_cache_size (sessionOP db_session, Size cache_size) |
std::string | make_compound_statement (std::string const &table_name, std::vector< std::string > const &column_names, platform::Size const &row_count) |
utility::sql_database::sessionOP | parse_database_connection (utility::tag::TagCOP tag) |
void | attributes_for_parse_database_connection (utility::tag::AttributeList &attlist, utility::tag::XMLSchemaDefinition &xsd) |
utility::sql_database::sessionOP | get_db_session (std::string const &db_name, utility::sql_database::TransactionMode::e transaction_mode, platform::Size chunk_size, std::string const &pq_schema="") |
Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database. More... | |
utility::sql_database::sessionOP | get_db_session (utility::sql_database::DatabaseMode::e db_mode, utility::sql_database::TransactionMode::e transaction_mode, platform::Size chunk_size, std::string const &db_name, std::string const &pq_schema="") |
Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database. More... | |
cppdb::statement | safely_prepare_statement (std::string const &statement_string, utility::sql_database::sessionOP db_session) |
cppdb::statement | prepare_statement_no_catch (std::string const &statement_string, utility::sql_database::sessionOP db_session) |
Do not catch the error - leave the catch for the code using it. Do not use this unless YOU are catching any erorrs (cppdb::error). More... | |
void | safely_write_to_database (cppdb::statement &statement) |
cppdb::result | safely_read_from_database (cppdb::statement &statement) |
void | insert_or_ignore (std::string table_name, std::vector< std::string > column_names, std::vector< std::string > values, utility::sql_database::sessionOP db_session) |
bool | table_exists (utility::sql_database::sessionOP db_session, std::string const &table_name) |
void | set_cache_size (utility::sql_database::sessionOP db_session, platform::Size cache_size) |
set the number of 1kb pages to use for cache More... | |
void | write_schema_to_database (std::string schema, utility::sql_database::sessionOP db_session) |
Variables | |
static basic::Tracer | TR ("basic.io.database") |
static basic::Tracer | TR ("basic.database.sql_utils") |
typedef utility::pointer::shared_ptr< DatabaseSessionLoader const > basic::database::DatabaseSessionLoaderCOP |
typedef utility::pointer::shared_ptr< DatabaseSessionLoader > basic::database::DatabaseSessionLoaderOP |
typedef utility::pointer::shared_ptr< DatabaseSessionOptions const > basic::database::DatabaseSessionOptionsCOP |
typedef utility::pointer::shared_ptr< DatabaseSessionOptions > basic::database::DatabaseSessionOptionsOP |
void basic::database::attributes_for_parse_database_connection | ( | utility::tag::AttributeList & | attlist, |
utility::tag::XMLSchemaDefinition & | xsd | ||
) |
References utility::tag::XMLSchemaDefinition::add_top_level_element(), basic::options::OptionKeys::dna::specificity::mode, utility::tag::XMLSchemaRestriction::name(), tag, utility::tag::xs_integer, utility::tag::xs_string, utility::tag::xsct_non_negative_integer, utility::tag::xsct_rosetta_bool, utility::tag::xsr_enumeration, and utility::tag::xsr_pattern.
Referenced by basic::resource_manager::locator::DatabaseResourceLocator::provide_xml_schema().
void basic::database::check_statement_sanity | ( | string | sql | ) |
References utility_exit_with_message.
Referenced by basic::resource_manager::locator::DatabaseResourceLocator::parse_my_tag().
platform::SSize basic::database::db_partition_from_options | ( | DatabaseMode::e | db_mode | ) |
@
Returns partition identifer if in partitioned database mode, otherwise -1.
References inout::dbms::database_partition(), utility::sql_database::DatabaseMode::mysql, option, options, utility::sql_database::DatabaseMode::postgres, resolve_db_partition(), inout::dbms::separate_db_per_mpi_process(), utility::sql_database::DatabaseMode::sqlite3, basic::options::OptionKeys::inout::dbms::user, and utility_exit_with_message.
Referenced by get_db_session().
Does cache file (absolute path) exist? if dir_only is true, will return true if the cache file could be created.
References utility::file::create_directory_recursive(), utility::file::create_temp_filename(), basic::Tracer::Debug, utility::file::file_delete(), utility::file::file_exists(), utility::file::FileName::path(), TR, and basic::Tracer::TracerProxy::visible().
Referenced by full_cache_name().
std::string basic::database::find_database_path | ( | std::string const & | dir, |
std::string const & | filename, | ||
bool const | mute_error_if_failure | ||
) |
Find a path to a file.
Try various combinations to locate the specific file being requested by the user. (inspired by core::scoring::ScoreFunction::find_weights_file())
Labonte JWLab onte @jhu. edu
Try various combinations to locate the specific file being requested by the user. (inspired by core::scoring::ScoreFunction::find_weights_file())
mute_error_if_failure returns "" if the file does not exist instead of throwing a loud exception
dir like chemical/carbohydrates/linkage_conformers/
References test.G202_Module_PythonPDB::filename, full_name(), utility::io::izstream::good(), basic::options::OptionKeys::in::path::path, and utility_exit_with_message.
std::string basic::database::find_database_path | ( | std::string const & | dir, |
std::string const & | filename, | ||
std::string const & | ext | ||
) |
Find a path to a file.
Try various combinations to locate the specific file being requested by the user. (inspired by core::scoring::ScoreFunction::find_weights_file())
Labonte JWLab onte @jhu. edu
Try various combinations to locate the specific file being requested by the user. (inspired by core::scoring::ScoreFunction::find_weights_file())
dir like chemical/carbohydrates/linkage_conformers/
References test.G202_Module_PythonPDB::filename, full_name(), utility::io::izstream::good(), basic::options::OptionKeys::in::path::path, and utility_exit_with_message.
std::string basic::database::full_cache_name | ( | std::string const & | short_name, |
std::string const & | source_file, | ||
bool | for_writing | ||
) |
Get the (absolute) path to a given cached file. If source_file is given, it's the full path to the source database file that's being cached. If for_writing is true, will only check that the given file would be creatable. Will return an empty string if it can't find a cache file.
References utility::file::FileName::bare_name(), in::path::database_cache_dir(), find_cache_file(), utility::file::get_home_dir(), option, options, basic::options::OptionKeys::in::path::path, utility::file::FileName::path(), and basic::options::OptionKeys::inout::dbms::user.
std::string basic::database::full_name | ( | std::string const & | db_file, |
bool | warn | ||
) |
Full-path database file name.
References in::path::database(), utility::file::file_exists(), name, option, options, amino_acids::size, TR, and basic::Tracer::Warning.
Referenced by find_database_path(), main(), make_scorefxn(), and open().
utility::sql_database::sessionOP basic::database::get_db_session | ( | std::string const & | db_name, |
utility::sql_database::TransactionMode::e | transaction_mode, | ||
platform::Size | chunk_size, | ||
std::string const & | pq_schema = "" |
||
) |
Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database.
utility::sql_database::sessionOP basic::database::get_db_session | ( | utility::sql_database::DatabaseMode::e | db_mode, |
utility::sql_database::TransactionMode::e | transaction_mode, | ||
platform::Size | chunk_size, | ||
std::string const & | db_name, | ||
std::string const & | pq_schema = "" |
||
) |
Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database.
utility::sql_database::sessionOP basic::database::get_db_session | ( | ) |
Aquire a database session using the command line options transaction type is set to standard.
References inout::dbms::database_name(), get_db_session(), option, options, inout::dbms::pq_schema(), and utility::sql_database::TransactionMode::standard.
Referenced by DatabaseIOBenchmark::setUp().
utility::sql_database::sessionOP basic::database::get_db_session | ( | string const & | db_name, |
string const & | pq_schema | ||
) |
Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database. Transaction type set to standard.
References utility::sql_database::database_mode_from_name(), get_db_session(), inout::dbms::mode(), option, options, and utility::sql_database::TransactionMode::standard.
sessionOP basic::database::get_db_session | ( | string const & | db_name, |
TransactionMode::e | transaction_mode, | ||
Size | chunk_size, | ||
string const & | pq_schema | ||
) |
References utility::sql_database::database_mode_from_name(), get_db_session(), inout::dbms::mode(), option, and options.
utility::sql_database::sessionOP basic::database::get_db_session | ( | utility::sql_database::DatabaseMode::e | db_mode, |
std::string const & | db_name, | ||
std::string const & | pq_schema | ||
) |
References get_db_session(), and utility::sql_database::TransactionMode::standard.
sessionOP basic::database::get_db_session | ( | DatabaseMode::e | db_mode, |
TransactionMode::e | transaction_mode, | ||
Size | chunk_size, | ||
string const & | db_name, | ||
string const & | pq_schema | ||
) |
References db_partition_from_options(), utility::SingletonBase< DatabaseSessionManager >::get_instance(), utility::sql_database::DatabaseSessionManager::get_session_mysql(), utility::sql_database::DatabaseSessionManager::get_session_postgres(), utility::sql_database::DatabaseSessionManager::get_session_sqlite3(), inout::dbms::host(), utility::sql_database::DatabaseMode::mysql, utility::sql_database::name_from_database_mode(), option, options, inout::dbms::password(), inout::dbms::port(), utility::sql_database::DatabaseMode::postgres, inout::dbms::readonly(), utility::sql_database::DatabaseMode::sqlite3, TR, basic::options::OptionKeys::inout::dbms::user, inout::dbms::user(), utility_exit_with_message, and basic::Tracer::Warning.
Referenced by get_db_session().
void basic::database::insert_or_ignore | ( | std::string | table_name, |
std::vector< std::string > | column_names, | ||
std::vector< std::string > | values, | ||
utility::sql_database::sessionOP | db_session | ||
) |
void basic::database::insert_or_ignore | ( | string | table_name, |
std::vector< string > | column_names, | ||
std::vector< string > | values, | ||
sessionOP | db_session | ||
) |
References utility::sql_database::DatabaseMode::mysql, utility::sql_database::name_from_database_mode(), utility::sql_database::DatabaseMode::postgres, res, pyrosetta.tests.__main__::result, safely_prepare_statement(), safely_read_from_database(), safely_write_to_database(), utility::sql_database::DatabaseMode::sqlite3, and utility_exit_with_message.
std::string basic::database::make_compound_statement | ( | std::string const & | table_name, |
std::vector< std::string > const & | column_names, | ||
platform::Size const & | row_count | ||
) |
References basic::options::OptionKeys::frags::j, and utility::join().
Referenced by basic::database::insert_statement_generator::InsertGenerator::write_to_database(), basic::database::insert_statement_generator::InsertGenerator::write_to_database_chunked(), and basic::database::insert_statement_generator::InsertGenerator::write_to_database_sequential().
bool basic::database::open | ( | utility::io::izstream & | db_stream, |
std::string const & | db_file, | ||
bool | warn = true |
||
) |
Open a database file on a provided stream.
Does a database file exist?
Open a database file on a provided stream
References utility::io::izstream::clear(), utility::io::izstream::close(), CREATE_EXCEPTION, full_name(), utility::io::izstream::good(), utility::io::izstream::open(), and TR.
Referenced by pyrosetta.toolbox.load_ligand::add_cid_to_database(), pyrosetta.toolbox.cleaning::cleanATOM(), options.KeepSameFile::close(), combine_pdbs::combine_pdbs(), compare_times::compare_times(), make_bindings_via_cmake::compile_sources(), ez_setup::download_file_insecure(), pyrosetta.toolbox.rcsb::download_from_web(), pyrosetta.toolbox.atom_pair_energy::dump_atom_pair_energy_table(), pyrosetta.toolbox.atom_pair_energy::dump_residue_pair_energies(), erraser_wrapper::erraser(), erraser_wrapper::erraser_minimize(), erraser_wrapper::erraser_single_res(), build::execute(), erraser_single_res_analysis::extract_info(), erraser_util::extract_pdb(), mutant_modeler::figure_out_WT_seq(), fmt::File::File(), erraser_util::find_chi_angle(), erraser_single_res_analysis::find_chi_angle_std_pdb(), erraser_analysis::find_chi_angle_std_pdb(), build::generate_bindings(), build::generate_cmake_file(), build::generate_documentation(), pyrosetta.toolbox.generate_resfile::generate_resfile_from_pose(), demo.D050_Packer_task::generate_resfile_from_pose(), build::generate_rosetta_cmake_files(), build::generate_rosetta_external_cmake_files(), sphinx-doc-generator::generate_rst_sphinx_files(), DRRAFTER::get_coord_csts(), erraser_util::get_fasta(), mutant_modeler.MutantModeler::get_high_res_command_lines(), mutant_modeler.MutantModeler::get_med_res_command_lines(), setup::get_package_version(), get_final_ddG_scores::get_scores(), DRRAFTER::get_sequences(), mutant_modeler::get_ss(), erraser_util::get_total_res(), erraser_util::grep(), ez_setup::has_curl(), ez_setup::has_powershell(), ez_setup::has_wget(), build::install_llvm_tool(), pyrosetta.toolbox.rcsb::load_fasta_from_rcsb(), compare_times::load_files(), pyrosetta.toolbox.load_ligand::load_from_pubchem(), pyrosetta.toolbox.rcsb::load_from_rcsb(), erraser_util::load_pdb_coord(), erraser_util::load_pdb_coord_old(), find_lowest_scoring_relaxed_struct::main(), get_lowest_scoring_relaxed_models::main(), general_RNP_setup_script::main(), get_final_ddG_scores::main(), best_ifaceE::main(), get_scores::main(), prune_atdiff_top5pct::main(), relax_starting_structure::main(), sidechain_cst_3::main(), self-test::main(), sphinx-doc-generator::main(), arls_impl::main(), make_bindings_via_cmake::make_all_includes(), make_bindings_via_cmake::make_bindings_code(), mutant_modeler.MutantModeler::make_high_res_subsets_and_cmd_lines(), pyrosetta.io.silent_file_map::open_compressed(), utility::sql_database::session::open_mysql_session(), utility::sql_database::session::open_postgres_session(), utility::sql_database::session::open_sqlite3_session(), pyrosetta.toolbox.py_jobdistributor::output_scorefile(), DRRAFTER::parse_fasta(), DRRAFTER::parse_secstruct(), erraser_util::pdb2fasta(), erraser_util::pdb2rosetta(), erraser_util::pdb_slice(), DRRAFTER::pdbslice(), ObjexxFCL::process_file(), util::read_pdb(), DRRAFTER::read_pdb(), read_rama_map_file(), erraser_wrapper::rebuild_completed(), erraser_util::regularize_OP1_OP2(), erraser_util::regularize_pdb(), self-test::remover_absolute_paths(), basic::sampling::orientations::QuaternionGridManager::request_by_name(), erraser_util::rosetta2phenix_merge_back(), erraser_util::rosetta2std_pdb(), self-test::run_test(), demo.D090_Ala_scan::scanning(), demo.D090_Ala_scan::scanning_analysis(), erraser_wrapper::seq_rebuild(), erraser_wrapper::seq_rebuild_new(), DRRAFTER::setup_job(), erraser_util::sliced2orig_merge_back(), erraser_util::subprocess_call(), erraser_util::subprocess_out(), erraser_wrapper::SWA_rebuild_erraser(), pyrosetta.tests.distributed.test_dask_worker.TestDaskArgs::test_worker_extra(), build::update_source_file(), DRRAFTER::write_flags_file(), arls_impl::write_if_not_exists(), and mutant_modeler.MutantModeler::write_mutfile().
utility::sql_database::sessionOP basic::database::parse_database_connection | ( | utility::tag::TagCOP | tag | ) |
build database connection from options in a tag, this is useful make sure the fields for constructing a database connection are consistent across different tags.
References out::path::all(), utility::sql_database::TransactionMode::chunk, utility::sql_database::database_mode_from_name(), basic::options::OptionKeys::inout::dbms::database_name, basic::options::OptionKeys::inout::dbms::database_partition, inout::dbms::database_partition(), out::path::db(), utility::sql_database::DatabaseSessionManager::get_db_session(), utility::SingletonBase< DatabaseSessionManager >::get_instance(), basic::options::OptionKeys::cloud::host, basic::options::OptionKeys::inout::inout, basic::options::OptionKeys::dna::specificity::mode, utility::sql_database::DatabaseMode::mysql, utility::sql_database::name_from_database_mode(), utility::sql_database::name_from_transaction_mode(), utility::sql_database::TransactionMode::none, option, options, basic::options::OptionKeys::inout::dbms::password, basic::options::OptionKeys::in::path::path, inout::dbms::path(), basic::options::OptionKeys::cloud::port, utility::sql_database::DatabaseMode::postgres, basic::options::OptionKeys::inout::dbms::pq_schema, resolve_db_partition(), inout::dbms::separate_db_per_mpi_process(), utility::sql_database::DatabaseMode::sqlite3, utility::sql_database::TransactionMode::standard, TR, utility::sql_database::transaction_mode_from_name(), basic::options::OptionKeys::inout::dbms::user, utility_exit_with_message, and basic::Tracer::Warning.
Referenced by basic::database::DatabaseSessionOptions::parse_my_tag(), and basic::resource_manager::locator::DatabaseResourceLocator::parse_my_tag().
cppdb::statement basic::database::prepare_statement_no_catch | ( | std::string const & | statement_string, |
utility::sql_database::sessionOP | db_session | ||
) |
Do not catch the error - leave the catch for the code using it. Do not use this unless YOU are catching any erorrs (cppdb::error).
statement basic::database::prepare_statement_no_catch | ( | string const & | statement_string, |
sessionOP | db_session | ||
) |
platform::SSize basic::database::resolve_db_partition | ( | bool | partition_by_mpi_process, |
platform::SSize | manual_partition | ||
) |
Returns partition identifer from mpi rank if in partitioned database mode, or valid manual partition, otherwise -1.
References utility::mpi_rank().
Referenced by db_partition_from_options(), and parse_database_connection().
cppdb::statement basic::database::safely_prepare_statement | ( | std::string const & | statement_string, |
utility::sql_database::sessionOP | db_session | ||
) |
statement basic::database::safely_prepare_statement | ( | string const & | statement_string, |
sessionOP | db_session | ||
) |
References basic::Tracer::Error, TR, and utility_exit_with_message.
Referenced by insert_or_ignore(), basic::resource_manager::locator::DatabaseResourceLocator::locate_resource_stream(), set_cache_size(), table_exists(), basic::database::insert_statement_generator::InsertGenerator::write_to_database(), basic::database::insert_statement_generator::InsertGenerator::write_to_database_chunked(), and basic::database::insert_statement_generator::InsertGenerator::write_to_database_sequential().
cppdb::result basic::database::safely_read_from_database | ( | cppdb::statement & | statement | ) |
result basic::database::safely_read_from_database | ( | statement & | statement | ) |
void basic::database::safely_write_to_database | ( | cppdb::statement & | statement | ) |
void basic::database::safely_write_to_database | ( | statement & | statement | ) |
References utility_exit_with_message.
Referenced by insert_or_ignore(), set_cache_size(), write_schema_to_database(), basic::database::insert_statement_generator::InsertGenerator::write_to_database(), basic::database::insert_statement_generator::InsertGenerator::write_to_database_chunked(), and basic::database::insert_statement_generator::InsertGenerator::write_to_database_sequential().
void basic::database::set_cache_size | ( | utility::sql_database::sessionOP | db_session, |
platform::Size | cache_size | ||
) |
set the number of 1kb pages to use for cache
void basic::database::set_cache_size | ( | sessionOP | db_session, |
Size | cache_size | ||
) |
bool basic::database::table_exists | ( | utility::sql_database::sessionOP | db_session, |
std::string const & | table_name | ||
) |
bool basic::database::table_exists | ( | sessionOP | db_session, |
string const & | table_name | ||
) |
References utility::sql_database::DatabaseMode::mysql, utility::sql_database::DatabaseMode::postgres, res, pyrosetta.tests.__main__::result, safely_prepare_statement(), utility::sql_database::DatabaseMode::sqlite3, and utility_exit_with_message.
Referenced by basic::database::schema_generator::Schema::check_table_and_perform_write().
void basic::database::write_schema_to_database | ( | std::string | schema, |
utility::sql_database::sessionOP | db_session | ||
) |
void basic::database::write_schema_to_database | ( | string | schema_str, |
sessionOP | db_session | ||
) |
References test.T009_Exceptions::e, basic::Tracer::Error, safely_write_to_database(), TR, utility::trim(), and utility_exit.
|
static |
Referenced by find_cache_file(), full_name(), and open().
|
static |