Rosetta  2021.16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
protocols::jobdist::BasicJob Class Reference

Each Job object describes a particular input to Rosetta. More...

#include <Jobs.hh>

Inheritance diagram for protocols::jobdist::BasicJob:
Inheritance graph
[legend]

Public Member Functions

 BasicJob (std::string const &input_tag, std::string const &native_tag, int nstruct=1)
 You MUST ensure that input_tag is a UNIQUE identifier for this Job! More...
 
 ~BasicJob () override=default
 
virtual int nstruct () const
 The number of times this job should be repeated. More...
 
virtual std::string input_tag () const
 The tag supplied at create time. More...
 
virtual std::string native_tag () const
 The tag supplied at create time. More...
 
virtual std::string output_tag (int struct_n) const
 The tag supplied at create time plus the nstruct number (from 1 to nstruct inclusive). More...
 
virtual std::string output_file_name () const
 The tag supplied at create time plus the nstruct number (from 1 to nstruct inclusive). More...
 
void set_output_file_name (std::string str)
 The tag supplied at create time plus the nstruct number (from 1 to nstruct inclusive). More...
 
template<typename T >
bool get (std::string const &key, T &value)
 Extracts named value. Works for anything that deserializes from string. Returns false on error. More...
 
bool get (std::string const &key, std::string &value)
 Specialization for strings. More...
 
template<typename T >
void set (std::string const &key, T const &value)
 Set named value. Works for anything that serializes to a string. More...
 
void set (std::string const &key, std::string const &value)
 Specialization for strings. More...
 
void set_preserve_whole_input_tag (bool setting)
 

Protected Attributes

std::string input_id_
 
std::string native_id_
 
int nstruct_
 name of the native More...
 
std::map< std::string,
std::string > 
extra_data_
 
std::string output_file_name_
 
bool preserve_whole_input_tag_
 

Detailed Description

Each Job object describes a particular input to Rosetta.

Ordinarily, an input is just a single PDB file. In other cases, e.g. docking, input might be a pair of PDB files. In still other cases, input might be a list of tags to extract from a silent file. And so on. One BasicJob class is defined below that should meet most needs, but if you need to carry additional information, you can subclass it.

Contains a map of strings to strings that can be used to store arbitrary extra data if you're too lazy to make a subclass. Templated get/set functions accept anything that can be read from and written to a C++ stream with >> and << operators. All data is stored as strings internally. Some numeric data may experience slight round-off error, though I think we're storing enough digits to avoid that.

Example: BasicJob jobdata("1abc.pdb", 10); jobdata.set("cmp_to", "1xyz.pdb"); jobdata.set("score", 42.42);

std::string cmp_to; core::Real score; if( jobdata.get("cmp_to", cmp_to) ) std::cout << "cmp_to = " << cmp_to << std::endl; else std::cout << "Unable to recover cmp_to!" << std::endl; if( jobdata.get("score", score) ) std::cout << "score = " << score << std::endl; else std::cout << "Unable to recover score!" << std::endl;

Although Jobs are small objects, it is common for Rosetta to loop many times over the same input. In order to avoid creating (size of -s and -l) * (nstruct) JobData objects, each Job also has an nstruct counter.

So, each Job represents a unique input, and each tuple of (Job, struct_n) represents a unique output.

Constructor & Destructor Documentation

protocols::jobdist::BasicJob::BasicJob ( std::string const &  input_tag,
std::string const &  native_tag,
int  nstruct = 1 
)
inline

You MUST ensure that input_tag is a UNIQUE identifier for this Job!

protocols::jobdist::BasicJob::~BasicJob ( )
overridedefault

Member Function Documentation

template<typename T >
bool protocols::jobdist::BasicJob::get ( std::string const &  key,
T &  value 
)
inline

Extracts named value. Works for anything that deserializes from string. Returns false on error.

References extra_data_.

bool protocols::jobdist::BasicJob::get ( std::string const &  key,
std::string &  value 
)
inline

Specialization for strings.

References extra_data_.

virtual std::string protocols::jobdist::BasicJob::input_tag ( ) const
inlinevirtual

The tag supplied at create time.

References input_id_.

virtual std::string protocols::jobdist::BasicJob::native_tag ( ) const
inlinevirtual

The tag supplied at create time.

References native_id_.

virtual int protocols::jobdist::BasicJob::nstruct ( ) const
inlinevirtual

The number of times this job should be repeated.

References nstruct_.

virtual std::string protocols::jobdist::BasicJob::output_file_name ( ) const
inlinevirtual

The tag supplied at create time plus the nstruct number (from 1 to nstruct inclusive).

References output_file_name_.

std::string protocols::jobdist::BasicJob::output_tag ( int  struct_n) const
virtual

The tag supplied at create time plus the nstruct number (from 1 to nstruct inclusive).

Deliberately discards any path information in the input tag as well as any file name extension (since input tags are usually file names). There is some possibility this could lead to non-unique output tags, which deserves further consideration at some point...

References input_id_, nstruct_, preserve_whole_input_tag_, and protocols::sparta::split().

template<typename T >
void protocols::jobdist::BasicJob::set ( std::string const &  key,
T const &  value 
)
inline

Set named value. Works for anything that serializes to a string.

References extra_data_.

void protocols::jobdist::BasicJob::set ( std::string const &  key,
std::string const &  value 
)
inline

Specialization for strings.

References extra_data_.

void protocols::jobdist::BasicJob::set_output_file_name ( std::string  str)
inline

The tag supplied at create time plus the nstruct number (from 1 to nstruct inclusive).

References output_file_name_, and protocols::kinmatch::str().

void protocols::jobdist::BasicJob::set_preserve_whole_input_tag ( bool  setting)
inline

Member Data Documentation

std::map< std::string, std::string > protocols::jobdist::BasicJob::extra_data_
protected

Referenced by get(), and set().

std::string protocols::jobdist::BasicJob::input_id_
protected

Referenced by input_tag(), and output_tag().

std::string protocols::jobdist::BasicJob::native_id_
protected

Referenced by native_tag().

int protocols::jobdist::BasicJob::nstruct_
protected

name of the native

Referenced by nstruct(), and output_tag().

std::string protocols::jobdist::BasicJob::output_file_name_
protected
bool protocols::jobdist::BasicJob::preserve_whole_input_tag_
protected

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