You are here

Parsing XML tags using pyrosetta

2 posts / 0 new
Last post
Parsing XML tags using pyrosetta
#1

Hi,

I'd like to be able to use some of the rosetta_scripts xml scripts that have been described in publications, but I'd like to be able to use pyrosetta to carry out the procedure.  Lots of movers and filters have a "parse_my_tag" function, and I'm wondering if it's possible to use pyrosetta call these function with a mover object created in pyrosetta.  As an example I've been trying to call this function from an "InterfaceAnalzyerMover" object, but it's not clear to me how to create a "TagCOP" objcet with the appropriate XML string, or how to properly create and use a Filters_map and Movers_map.

 

Thanks,

R

Category: 
Post Situation: 
Mon, 2015-10-19 06:37
rbehan

Ideally, there's a way to invoke whatever the tag does by using other property setters on the object. For example, the InterfaceAnalyserMover has a number of set_* functions which correspond pretty much with the corresponding XML option (pack_separated -> set_pack_separated(); packstat -> set_compute_packstat(); etc. ).

This isn't always true, though. Some movers/filters are set up such that they're only easily usable from XML. I've never done it, so I don't know how workable it is in PyRosetta, but the utility.tag.Tag.create() function (it's a class/static function) should return an object which should be usable as a "TagCOP" parameter.

The Filters_map, MoversMap and DataMap objects are protocols.filters.Filters_map, protocols::moves::Movers_map, and basic.datacache.DataMap. The former two are simply aliases for std::map< std::string const, FilterOP > and std::map< std::string const, MoverOP >, so you might have issues creating them at the Python level. (See http://www.pyrosetta.org/faq#TOC-3.-How-do-I-std::map-objects- though.)

One option is to simply make a full RosettaScripts XML file, parse the string with Tag.create() , and then pass it to protocols.rosetta_scripts.RosettaScriptsParser::generate_mover_for_protocol(). This should give you back a fully set up Mover which encapsulates the full protocol.

Mon, 2015-10-19 08:25
rmoretti