Rosetta 3.5
 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]
Collaboration diagram for protocols::jobdist::BasicJob:
Collaboration graph
[legend]

Public Member Functions

 BasicJob (std::string input_tag, std::string native_tag, int nstruct=1)
 You MUST ensure that input_tag is a UNIQUE identifier for this Job! More...
 
virtual ~BasicJob ()
 
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.

Definition at line 70 of file Jobs.hh.

Constructor & Destructor Documentation

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

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

Definition at line 75 of file Jobs.hh.

virtual protocols::jobdist::BasicJob::~BasicJob ( )
inlinevirtual

Definition at line 82 of file Jobs.hh.

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.

Definition at line 111 of file Jobs.hh.

References extra_data_.

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

Specialization for strings.

Definition at line 120 of file Jobs.hh.

References extra_data_.

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

The tag supplied at create time.

Definition at line 89 of file Jobs.hh.

References input_id_.

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

The tag supplied at create time.

Definition at line 93 of file Jobs.hh.

References native_id_.

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

The number of times this job should be repeated.

Definition at line 85 of file Jobs.hh.

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

Definition at line 100 of file Jobs.hh.

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

Definition at line 43 of file Jobs.cc.

References input_id_, nstruct_, preserve_whole_input_tag_, and core::io::pdb::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.

Definition at line 129 of file Jobs.hh.

References extra_data_.

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

Specialization for strings.

Definition at line 138 of file Jobs.hh.

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

Definition at line 105 of file Jobs.hh.

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

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

Definition at line 141 of file Jobs.hh.

References preserve_whole_input_tag_.

Member Data Documentation

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

Definition at line 147 of file Jobs.hh.

Referenced by get(), and set().

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

Definition at line 144 of file Jobs.hh.

Referenced by input_tag(), and output_tag().

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

Definition at line 145 of file Jobs.hh.

Referenced by native_tag().

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

name of the native

Definition at line 146 of file Jobs.hh.

Referenced by nstruct(), and output_tag().

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

Definition at line 148 of file Jobs.hh.

Referenced by output_file_name(), and set_output_file_name().

bool protocols::jobdist::BasicJob::preserve_whole_input_tag_
protected

Definition at line 149 of file Jobs.hh.

Referenced by output_tag(), and set_preserve_whole_input_tag().


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