1#!/usr/local/bin/python3.8 2from _decorators import Attribute, Decorator, make_header, PathAttribute 3from _decorators import NodeAttribute, RangeAttribute, OptionalPathAttribute 4import os.path 5import os 6 7try: 8 os.makedirs(os.path.join("include", "RMF")) 9except OSError: 10 pass 11 12coordinates = Attribute( 13 "coordinates", 14 "Vector3") 15 16orientation = Attribute( 17 "orientation", 18 "Vector4") 19mass = Attribute("mass", "Float") 20radius = Attribute("radius", "Float") 21 22particle = Decorator(["REPRESENTATION"], "physics", 23 "Particle", 24 [mass, coordinates, radius]) 25gparticle = Decorator(["REPRESENTATION"], "physics", 26 "GaussianParticle", 27 [Attribute("variances", "Vector3"), mass]) 28iparticle = Decorator(["REPRESENTATION"], "physics", 29 "IntermediateParticle", 30 [radius, coordinates]) 31pparticle = Decorator(["REPRESENTATION"], "physics", 32 "RigidParticle", 33 [orientation, coordinates]) 34refframe = Decorator(["REPRESENTATION", "ORGANIZATIONAL"], "physics", 35 "ReferenceFrame", 36 [Attribute( 37 "rotation", "Vector4"), 38 Attribute( 39 "translation", "Vector3")]) 40 41 42atom = Decorator(["REPRESENTATION"], "physics", 43 "Atom", 44 [Attribute("element", "Int"), mass, radius 45 ]) 46 47diffuser = Decorator(["REPRESENTATION"], "physics", 48 "Diffuser", 49 [Attribute("diffusion coefficient", "Float")]) 50 51make_header( 52 "physics", [particle, iparticle, gparticle, pparticle, diffuser, 53 atom, refframe], 54 ["alias"]) 55 56 57score = Decorator(["FEATURE"], "feature", 58 "Score", 59 [Attribute("score", "Float")]) 60 61make_header("feature", [score], []) 62 63 64colored = Decorator( 65 ["REPRESENTATION", "ORGANIZATIONAL", "ALIAS", "FEATURE", "GEOMETRY"], 66 "shape", 67 "Colored", 68 [Attribute("rgb color", "Vector3")]) 69 70geometry_coordinates = Attribute("coordinates list", "Vector3s") 71 72geometry_index = Attribute( 73 "type", "Int") 74 75ball = Decorator(["GEOMETRY"], "shape", 76 "Ball", 77 [coordinates, radius]) 78 79ellipsoid = Decorator(["GEOMETRY"], "shape", 80 "Ellipsoid", 81 [Attribute("axis lengths", "Vector3"), orientation, 82 coordinates]) 83 84 85cylinder = Decorator(["GEOMETRY"], "shape", 86 "Cylinder", 87 [radius, geometry_coordinates], check_all_attributes=True) 88 89segment = Decorator(["GEOMETRY"], "shape", 90 "Segment", 91 [geometry_coordinates]) 92 93 94make_header("shape", [colored, ball, ellipsoid, cylinder, segment], []) 95 96 97journal = Decorator(["ORGANIZATIONAL"], "publication", 98 "JournalArticle", 99 [Attribute("title", "String"), 100 Attribute( 101 "journal", "String"), 102 Attribute("pubmed id", "String"), 103 Attribute("year", "Int"), 104 Attribute("authors", "Strings")]) 105 106make_header("publication", [journal], []) 107 108structure = Decorator(["PROVENANCE"], "provenance", 109 "StructureProvenance", 110 [PathAttribute("structure filename", 111 function_name='filename'), 112 Attribute("structure chain", "String", 113 function_name='chain'), 114 Attribute("structure residue offset", "Int", 115 function_name='residue_offset', 116 default=0)]) 117 118sample = Decorator(["PROVENANCE"], "provenance", 119 "SampleProvenance", 120 [Attribute("sampling method", "String", 121 function_name='method'), 122 Attribute("sampling frames", "Int", 123 function_name='frames'), 124 Attribute("sampling iterations", "Int", 125 function_name='iterations'), 126 Attribute("sampling replicas", "Int", 127 function_name='replicas')]) 128 129combine = Decorator(["PROVENANCE"], "provenance", 130 "CombineProvenance", 131 [Attribute("combined runs", "Int", function_name='runs'), 132 Attribute("combined frames", "Int", 133 function_name='frames')]) 134 135filterp = Decorator(["PROVENANCE"], "provenance", 136 "FilterProvenance", 137 [Attribute("filter method", "String", 138 function_name='method'), 139 Attribute("filter threshold", "Float", 140 function_name='threshold'), 141 Attribute("filter frames", "Int", 142 function_name='frames')]) 143 144cluster = Decorator(["PROVENANCE"], "provenance", 145 "ClusterProvenance", 146 [Attribute("cluster members", "Int", 147 function_name='members'), 148 Attribute("cluster precision", "Float", 149 function_name='precision', default=0.), 150 OptionalPathAttribute("cluster density", 151 function_name='density')]) 152 153script = Decorator(["PROVENANCE"], "provenance", 154 "ScriptProvenance", 155 [PathAttribute("script filename", 156 function_name='filename')]) 157 158software = Decorator(["PROVENANCE"], "provenance", 159 "SoftwareProvenance", 160 [Attribute("software name", "String", 161 function_name='name'), 162 Attribute("software version", "String", 163 function_name='version'), 164 Attribute("software location", "String", 165 function_name='location')]) 166 167make_header("provenance", 168 [structure, sample, combine, filterp, cluster, script, software], 169 []) 170 171residue = Decorator(["REPRESENTATION"], "sequence", 172 "Residue", 173 [Attribute("residue index", "Int"), 174 Attribute("residue type", "String")]) 175 176chain = Decorator(["REPRESENTATION"], "sequence", 177 "Chain", 178 [Attribute("chain id", "String"), 179 Attribute("sequence", "String", default=""), 180 Attribute("chain type", "String", 181 default='UnknownChainType')]) 182 183domain = Decorator(["REPRESENTATION"], "sequence", 184 "Domain", 185 [RangeAttribute( 186 "residue indexes", "Int", "first residue index", 187 "last residue index")]) 188 189fragment = Decorator(["REPRESENTATION"], "sequence", 190 "Fragment", 191 [Attribute("residue indexes", "Ints")]) 192 193bcfragment = Decorator(["REPRESENTATION"], "sequence", 194 "BackwardsCompatibilityFragment", 195 [Attribute("indexes", "Ints")]) 196 197 198copy = Decorator(["REPRESENTATION"], "sequence", 199 "Copy", 200 [Attribute("copy index", "Int")]) 201 202typed = Decorator(["REPRESENTATION"], "sequence", 203 "Typed", 204 [Attribute("type name", "String")]) 205 206state = Decorator(["REPRESENTATION"], "sequence", 207 "State", 208 [Attribute("state index", "Int")]) 209 210expres = Decorator(["REPRESENTATION"], "sequence", 211 "ExplicitResolution", 212 [Attribute("explicit resolution", "Float")]) 213 214 215make_header( 216 "sequence", 217 [residue, 218 chain, 219 fragment, bcfragment, 220 domain, 221 typed, 222 copy, 223 state, 224 expres], 225 []) 226 227scale = Decorator(["REPRESENTATION"], "uncertainty", 228 "Scale", 229 [Attribute("scale", "Float"), 230 Attribute("scale lower", "Float", function_name='lower'), 231 Attribute("scale upper", "Float", function_name='upper')]) 232make_header("uncertainty", [scale], []) 233 234salias = Decorator(["ALIAS"], "alias", 235 "Alias", 236 [NodeAttribute("aliased")]) 237 238make_header("alias", [salias], []) 239 240 241external = Decorator(["REPRESENTATION"], "external", 242 "External", 243 [PathAttribute("path")]) 244 245make_header("external", [external], []) 246