「view this page in B3 βῆτα server」

Revisions №323

branch: release 「№323」
Commited by: Vikram K. Mulligan
GitHub commit link: 「cd16be2910907fd8」 「№6069」
Difference from previous tested commit:  code diff
Commit date: 2022-06-29 22:22:46

Merge pull request #6069 from RosettaCommons/vmullig/custom_real_valued_metric Add a CustomRealValueMetric class, analogous to the CustomStringValueMetric It is convenient to have an easy way to cache an arbitrary floating-point value in a pose from code, without doing a lot of manual steps. Simple metrics let you _compute_ particular types of floating-point values (scores, RMSDs, _etc._) and cache them, but if you've already computed whatever you want to compute, it's not easy to get that stored as a metric. This pull request adds a `CustomRealValueMetric` class, which lets you add an arbitrary input value and label to a pose. For instance, you might be testing an idea in a pilot app: ```c++ core::pose::PoseOP pose( utility::pointer::make_shared< core::pose::Pose >() ); // Create the pose and manipulate it. core::Real const my_computed_value = /*some new calculation to analyze the pose that's experimental enough or specialized enough that it's not worth turning into its own simple metric*/; core::simple_metrics::metrics::CustomRealValueMetric my_metric; my_metric.set_value( my_computed_value ); //I don't want the computation to be done by the metric. my_metric.apply( "custom_computed_value", *pose ); //Cache the computed value in the pose, and give it the label "custom_computed_value". ``` We already have this for string metrics. This pull request adds it for float-valued metrics. Note: this also gives you a way to pass in information from the commandline in RosettaScripts and cache it in the pose. For instance: ```xml <ROSETTASCRIPTS> <SIMPLE_METRICS> <CustomRealValueMetric name="my_metric" value="%%extrernal_val%%" /> </SIMPLE_METRICS> <PROTOCOLS> <Add metrics="my_metric" /> </PROTOCOLS> </ROSETTASCRIPTS> ``` ```sh ~/Rosetta/main/source/src/rosetta_scripts.default.linuxgccrelease -parser:protocol my_script.xml -script_vars external_val=25.3 -in:file:s first_file.pdb ~/Rosetta/main/source/src/rosetta_scripts.default.linuxgccrelease -parser:protocol my_script.xml -script_vars external_val=-12.9 -in:file:s second_file.pdb ``` It should also make it easier to put custom information into a Pose in PyRosetta. TODO: - [x] Unit test. - [x] Beauty. - [x] Documentation. Pull request RosettaCommons/documentation#59 has this.

...