Module Spyder
[hide private]
[frames] | no frames]

Source Code for Module Spyder

1 -class Float(float):
2 """Wrapper class around a Python float 3 The conversion engine does not operate on Float""" 4 @staticmethod
5 - def typename(): return "Float"
6 - def dict(self):
7 """Called by the dict function of Spyder classes 8 that have Float members 9 For internal use only""" 10 return self
11 - def __validate__(self):
12 pass
13 - def __print__(self, spaces, mode):
14 """Called by the pretty-print function of Spyder classes 15 that have Float members 16 For internal use only""" 17 return str(self)
18
19 -class Integer(int):
20 """Wrapper class around a Python int 21 The conversion engine does not operate on Integer""" 22 @staticmethod
23 - def typename(): return "Integer"
24 - def dict(self):
25 """Called by the dict function of Spyder classes 26 that have Integer members 27 For internal use only""" 28 return self
29 - def __validate__(self):
30 pass
31 - def __print__(self, spaces, mode):
32 """Called by the pretty-print function of Spyder classes 33 that have Integer members 34 For internal use only""" 35 return str(self)
36
37 -class String(str):
38 """Wrapper class around a Python str 39 The conversion engine does not operate on String, conversion into something else is always a cast""" 40 @staticmethod
41 - def typename(): return "String"
42 - def __new__(self, s):
43 s = str(s) 44 if len(s) and s[0] == s[-1]: 45 if s[0] in ("'", '"'): 46 try: 47 ast = compiler.parse(s) 48 s = str(ast.getChildren()[0]) 49 except: 50 pass 51 ret = str.__new__(self,s) 52 ret.__validate__() 53 return ret
54 - def __validate__(self):
55 pass
56 - def dict(self):
57 """Called by the dict function of Spyder classes 58 that have String members 59 For internal use only""" 60 return self
61 - def __print__(self, spaces, mode):
62 """Called by the pretty-print function of Spyder classes 63 that have String members 64 For internal use only""" 65 return str.__repr__(self)
66 - def convert(self, targettype):
67 tar = targettype 68 if isinstance(tar, str): 69 tar = Spyder.core.__types__[tar] 70 return tar(self)
71 - def tofile(self, *args, **kargs):
72 return self.convert(Data).tofile(*args, **kargs)
73 - def totempfile(self, *args, **kargs):
74 return self.convert(Data).totempfile(*args, **kargs)
75 @classmethod
76 - def fromfile(c, *args, **kargs):
77 return c(Data.fromfile(*args, **kargs).data())
78
79 -class Bool(int):
80 """Class that emulates a Python bool 81 Unlike bool, 82 "True" is equivalent to True 83 and "False" is equivalent to False 84 The conversion engine does not operate on Bool""" 85 @staticmethod
86 - def typename(): return "Bool"
87 - def __new__(self, b):
88 if b == "True" or b == "\'True\'" or b == "\"True\"": return int.__new__(self,True) 89 elif b == "False" or b == "\'False\'" or b == "\"False\"": return int.__new__(self,False) 90 else: return int.__new__(self,bool(b))
91 - def __str__(self):
92 if self == False: return "False" 93 else: return "True"
94 - def __repr__(self):
95 if self == False: return "False" 96 else: return "True"
97 - def __validate__(self):
98 pass
99 - def dict(self):
100 """Called by the dict function of Spyder classes 101 that have Bool members 102 For internal use only""" 103 return self
104 - def __print__(self, spaces, mode):
105 """Called by the pretty-print function of Spyder classes 106 that have Bool members 107 For internal use only""" 108 return str(self)
109
110 -class Data(object):
111 __constructor__ = "constructor_fromany" 112 """Data objects behave as strings or buffers. It should be used to store 113 binary data or file contents. It cannot be printed directly, but its 114 contents can be accessed with the data() or textdata() methods 115 116 It has a convert method, but the conversion engine is never used, 117 convert() on a Data object is equivalent to cast() 118 This behavior is NOT inherited if Data is Spyder-subclassed, 119 in that case, convert() works normally 120 121 It can be constructed from String or Data, but there is no parsing constructor 122 In File objects, Data is considered to be a general format, 123 convertible into and from everything 124 """ 125 @staticmethod
126 - def typename(): return "Data"
127 - def __init__(self, s):
128 return Data.__dict__[Data.__constructor__](self, s)
129 - def constructor_fromany(self, s):
130 try: 131 buf = s._buffer.raw 132 self._buffer = s._buffer 133 except AttributeError: 134 try: 135 buf = s.raw 136 self._buffer = s 137 except AttributeError: 138 if len(s) and s[0] == s[-1]: 139 if s[0] in ("'", '"'): 140 try: 141 ast = compiler.parse(s) 142 s = ast.getChildren()[0] 143 s = str(s) 144 except: 145 pass 146 self._buffer = ctypes.create_string_buffer(s)
147 - def cast(self, target):
148 return target(self._buffer.raw[:-1])
149 - def convert(self, target):
150 """Data class conversion method 151 Equivalent to a cast, unless Data is Spyder-subclassed""" 152 if self.typename() == "Data": 153 return self.cast(target) 154 else: return Spyder.core.convert(type(self),target, self, globals())
155 - def str(self):
156 return "<Data object of length %d>" % self.length()
157 - def __str__(self):
158 return "<Data object of length %d>" % self.length()
159 - def __print__(self, spaces, mode):
160 if mode == "str": 161 return "<Data object of length %d>" % self.length() 162 else: 163 return repr(self)
164 - def repr(self):
165 return repr(self._buffer.raw[:-1])
166 - def __repr__(self):
167 print "repr", repr(self._buffer.raw[:10]) 168 return repr(self._buffer.raw[:-1])
169 - def length(self):
170 return max(len(self._buffer.raw) - 1, 0)
171 - def __len__(self):
172 return max(len(self._buffer.raw) - 1, 0)
173 - def validate(self):
174 """<empty>""" 175 pass
176 - def data(self):
177 """Returns the underlying data as binary C string""" 178 return self._buffer.raw[:-1]
179 - def textdata(self):
180 """Returns the underlying data as Python ASCII string: 181 non-text characters are converted to whitespace""" 182 s = str(self._buffer.raw[:-1]) 183 return s.translate(transtable)
184 @classmethod
185 - def fromfile(c, filename, fastparse=False):
186 if fastparse: return Spyder.core.fastparse(filename, c) 187 else: return Spyder.core.__types__["File"](filename, c).data()
188 - def tofile(self, filename):
189 f = Spyder.core.__types__["File"](filename, type(self), "w", self) 190 f.save() 191 f.close()
192 - def totempfile(self):
193 tempdir = Spyder.getvar("tempdir") 194 import random, os 195 while 1: 196 tempnam = tempdir + os.sep + str(random.randrange(1,1000000000))+".tmp" 197 if not os.path.exists(tempnam): break 198 f = Spyder.core.__types__["File"](tempnam, type(self), "w", self) 199 f.temporary(True) 200 f.save() 201 return f
202 - def dict(self):
203 """Called by the dict function of Spyder classes 204 that have Data members 205 For internal use only""" 206 return self.data() 207
208 -class File(object):
209 """File class: can read/save files and read URLs 210 Permissions can be governed through various switches in system.fly 211 Upon construction, the file <name> is read and its contents stored in <data> 212 All File objects with the same <name> point to the same data 213 """ 214 __constructor__ = "constructor_fromany" 215 @staticmethod
216 - def typename(): return "File"
217 - def temporary(self, flag):
218 """Set a "temporary" flag as signal for applications 219 indicating that <data> should reside in memory, 220 not on disk, and that <name> can be safely deleted 221 """ 222 assert flag == True or flag == False 223 self.__temporary = flag
224 - def is_temporary(self):
225 """Query if the "temporary" flag was set""" 226 return self.__temporary
227 - def __validate__(self):
228 """<empty>""" 229 pass
230 - def validate(self):
231 """<empty>""" 232 pass
233 - def length(self):
234 """Redirects to __len__""" 235 return len(self)
236 - def dict(self):
237 """Returns a Python dict representation of the current object""" 238 ret = dict(self.__dict__) 239 ret["fileformat"] = self.fileformat() 240 return ret
241 - def __init__(self, *args, **kargs):
242 return File.__dict__[File.__constructor__](self, *args, **kargs)
243 - def constructor_fromany(self, *args, **kargs):
244 """Public general constructor, 245 implementing the following specialized constructors: 246 Keyword/value constructor: 247 File(name, fileformat, mode="Read", data=None, format=None) 248 <name>: file name or URL name 249 <fileformat>: The fileformat of the data from <name> 250 <fileformat> must be a Spyder type, 251 not a Python type or a string constant 252 if fileformat is Data, it is changed to the new type 253 of <data> as soon as <data> is converted 254 <mode>: "Read"/"read"/"r" or "Write"/"write"/"w" 255 URLS can never be opened in write mode 256 Allowed values for local files and URLs can be controlled 257 through switches in system.fly 258 <data>: only allowed in write mode 259 The contents of <name> are ignored, and the 260 underlying object <data> is copied from this argument instead 261 <format>: only allowed in write mode 262 Sets the current format of <data> 263 Copy constructor: File(<File>) 264 Dict constructor: File({'name':..., ...}) 265 List constructor: File([name, ...]) 266 A parsing constructor is yet to be implemented, but not deemed necessary 267 268 """ 269 try: 270 if len(kargs) > 0 or len(args) != 1: raise TypeError 271 self.__copy__(args[0]) 272 except TypeError: 273 try: 274 if len(kargs) > 0 or len(args) != 1: raise TypeError 275 self.__construct__(**args[0]) #dict 276 except TypeError: 277 if len(kargs) == 0 and len(args) == 1: raise 278 try: 279 self.__construct__(*args, **kargs) 280 except TypeError: 281 if len(args) > 1 or len(kargs) > 0: raise 282 self.__unpack__(args[0]) 283 self.__validate__()
284 - def __copy__(self, file0):
285 """Private copy constructor, for internal use only""" 286 try: 287 name = file0.name 288 fileformat = file0.fileformat() 289 mode = file0.mode 290 temporary = file0.is_temporary() 291 except AttributeError: 292 raise TypeError 293 if name not in fileobjects: 294 file0.close() 295 file0 = type(file0)(name, fileformat, mode) 296 return self.__construct__(name = file0.name, mode=file0.mode, fileformat = file0.fileformat(), temporary=temporary)
297 - def __construct__(self, *args, **kargs):
298 """Private general constructor, for internal use only""" 299 name = None 300 fileformat = None 301 mode = None 302 format = None 303 data = None 304 temporary = None 305 if len(args) > 0: 306 name = String(args[0]) 307 if len(args) > 1: 308 fileformat = args[1] 309 if not fileformat is None: 310 if isinstance(fileformat, str): fileformat = Spyder.core.__types__[String(fileformat)] 311 if hasattr(fileformat, "wrapclassname"): fileformat = fileformat.wrapclass 312 assert type(fileformat) == type(int) and hasattr(fileformat, "typename") 313 #it must be a Spyder type 314 if len(args) > 2: 315 mode0 = String(args[2]) 316 readcodes = ("r", "Read", "read") 317 writecodes = ("w", "Write", "write") 318 if mode0 not in readcodes and mode0 not in writecodes: raise TypeError("Unknown mode") 319 if mode0 in writecodes: mode = "Write" 320 else: mode = "Read" 321 if len(args) > 3: 322 data = args[3] 323 if len(args) > 4: 324 format = args[4] 325 if format != None: 326 if isinstance(format, str): format = Spyder.core.__types__[String(format)] 327 assert type(format) == type(int) and hasattr(format, "typename") 328 if len(args) > 4: 329 temporary = args[5] 330 assert temporary in (True, False) 331 332 if "name" in kargs: 333 if name != None: raise TypeError 334 name = String(kargs["name"]) 335 if "fileformat" in kargs: 336 if fileformat != None: raise TypeError 337 fileformat = kargs["fileformat"] 338 if fileformat != None: 339 if isinstance(fileformat, str): fileformat = Spyder.core.__types__[String(fileformat)] 340 assert type(fileformat) == type(int) and hasattr(fileformat, "typename") 341 if "mode" in kargs: 342 if mode != None: raise TypeError 343 mode0 = String(kargs["mode"]) 344 readcodes = ("r", "Read", "read") 345 writecodes = ("w", "Write", "write") 346 if mode0 not in readcodes and mode0 not in writecodes: raise TypeError 347 if mode0 in writecodes: mode = "Write" 348 else: mode = "Read" 349 if "format" in kargs: 350 if format != None: raise TypeError 351 format = kargs["format"] 352 if format != None: 353 if isinstance(format, str): format = Spyder.core.__types__[String(format)] 354 assert type(format) == type(int) and hasattr(format, "typename") 355 if "data" in kargs: 356 if data != None: raise TypeError 357 data = kargs["data"] 358 if "temporary" in kargs: 359 if temporary != None: raise TypeError 360 temporary = kargs["temporary"] 361 assert temporary in (True, False) 362 if mode == None: mode = "Read" #default is "Read" 363 if temporary == None: temporary = False 364 self.__temporary = temporary 365 366 #print "name", name, "fileformat", fileformat, "mode", mode, "data", data, "format", format, "nodata", data == None 367 368 if name == None: 369 raise TypeError("File must have a name") 370 371 if mode == "Read" and data != None: 372 raise TypeError("Data must be undefined in Read mode") 373 374 name_loaded = False 375 if name in fileobjects: 376 name_loaded = True 377 378 data_is_buffer = False 379 data_loaded = False 380 if data != None: 381 if hasattr(data,"data") and hasattr(data,"typename") and not hasattr(data, "name"): 382 data_is_buffer = True 383 else: 384 if hasattr(data,"name") and hasattr(data,"typename"): 385 if data in fileobjects: 386 data = data.name 387 data_loaded = True 388 else: data_is_buffer = True 389 390 #print "name-loaded", name_loaded, "data-is-buffer", data_is_buffer, "data_loaded", data_loaded 391 392 if name_loaded == True: #we are working with an existing File object 393 self.name = name 394 f = fileobjects[name] 395 if data != None: #and mode is write, has been checked! 396 if data_loaded == False and data_is_buffer == False and format == None: 397 raise TypeError 398 loadfile(self.name, True, True) #check if we have write access, but do not re-read in 399 if data_loaded == True: #copy from named File object <data> 400 d = fileobjects[data] 401 f = type(d)(d) 402 fformat = type(d) 403 elif data_is_buffer == True: #copy from buffer <data>, with specified format <format> 404 fformat = type(data) 405 f = fformat(data) 406 self.mode = mode 407 self._fileformat = fileformat 408 if fileformat == None: 409 self._fileformat = fformat 410 else: #no data, so basically nothing happens perhaps except a read=>write mode change 411 if fileformat == None: raise TypeError 412 self._fileformat = fileformat 413 self.mode = mode 414 if self.mode == "Write": 415 loadfile(self.name, True, True) 416 f = fileobjects[name] 417 #copy data and format 418 self._refetodata = f 419 fileobjects[name] = f 420 if format != None: #convert to format <format> 421 self.convert(format) 422 else: #we are creating a new File object 423 self.name = name 424 self.mode = mode 425 if data != None: #and mode is write, has been checked! 426 loadfile(self.name, True, True) #only check if we have write access 427 if data_loaded == False and format == None: 428 if data_is_buffer == False: 429 if fileformat == None: raise TypeError("You must supply a data format or a file format") 430 else: format = fileformat 431 else: 432 format = type(data) 433 if isinstance(data, str): format = Data 434 if data_loaded == True: #copy from named File object <data> 435 d = fileobjects[data] 436 if fileformat == None: fileformat = type(d) 437 self._fileformat = fileformat 438 self._refetodata = d 439 fileobjects[name] = d 440 if format != None: self.convert(format) 441 elif data_is_buffer == True: #copy from buffer <data>, with specified format <format> 442 if isinstance(data, str): 443 self._refetodata = Data(data) 444 else: 445 self._refetodata = type(data)(data) 446 fileobjects[name] = self._refetodata 447 if fileformat == None: fileformat = format 448 self._fileformat = fileformat 449 if format != None: self.convert(format) 450 else: self.convert(fileformat) 451 else: #a new file without supplied data, just read the file in the specified format... 452 self._fileformat = fileformat 453 if fileformat == None: raise TypeError("You must supply a file format") 454 if format == None: format = fileformat 455 if mode == "Read": 456 d = loadfile(name, False, False) 457 self._refetodata = fileformat(d) #to prevent the weakref dict to remove the data as long as this file exists 458 fileobjects[name] = self._refetodata #just read it in 459 460 else: 461 loadfile(name, True, True) #check if we have write permission 462 self._refetodata = fileformat("") 463 fileobjects[name] = self._refetodata #initialize as empty buffer 464 try: #try to read from file, but no problem if file does not (yet) exist 465 d = loadfile(name, False, False) 466 self._refetodata = fileformat(d) 467 fileobjects[name] = self._refetodata #just read it in 468 except IOError: 469 pass 470 self.convert(format)
471 - def __unpack__(self, s):
472 """Private value/keyword/list constructor, for internal use only""" 473 args,kargs = Spyder.core.parse(s, "dict") 474 if len(args) > 1: 475 args[1]= Spyder.core.__types__[args[1]] 476 if len(args) > 3: 477 args[3]= Spyder.core.__types__[args[3]] 478 if "fileformat" in kargs: 479 kargs["fileformat"] = Spyder.core.__types__[kargs["fileformat"]] 480 if "format" in kargs: 481 kargs["format"] = Spyder.core.__types__[kargs["format"]] 482 return self.__construct__(*args, **kargs)
483 - def data(self):
484 """Returns <data>""" 485 return fileobjects[self.name]
486 - def fileformat(self):
487 """Returns <fileformat>, the original format of <data>""" 488 return self._fileformat
489 - def format(self):
490 """Returns <format>, the current format of <data>""" 491 return type(fileobjects[self.name])
492 - def convert(self, newformat):
493 """Operates on the underlying <data>, not on the current object 494 The underlying <data> is converted to "newformat" 495 """ 496 if fileobjects[self.name].typename() != newformat.typename(): 497 if self._fileformat == Data: 498 self._fileformat = newformat 499 d = fileobjects[self.name].convert(newformat) 500 self._refetodata = d 501 fileobjects[self.name] = d 502 return fileobjects[self.name]
503 - def cast(self, newformat):
504 """Operates on the underlying <data>, not on the current object 505 The underlying <data> is cast to "newformat" """ 506 if fileobjects[self.name].typename() != newformat.typename(): 507 if self._fileformat == Data: 508 self._fileformat = newformat 509 d = fileobjects[self.name].cast(newformat) 510 self._refetodata = d 511 fileobjects[self.name] = d 512 return fileobjects[self.name]
513 - def length(self):
514 """Returns the length of <data>""" 515 return fileobjects[self.name].length()
516 - def __print__(self, spaces, mode):
517 """Print handle for Spyder classes that embed File, for internal use only""" 518 if mode == "str": 519 return self.__str__(spaces) 520 elif mode == "repr": 521 return self.__repr__(spaces)
522 - def __str__(self,spaces=0):
523 """Triggers on str(self) and on print self 524 Returns a string representation 525 This representation can be parsed with Spyder.core.parse 526 """ 527 sp = (spaces+2) * " " 528 sp2 = spaces * " " 529 s = "%s (\n%sname = \'%s\',\n%sfileformat = %s,\n%smode = \'%s\',\n%sformat = %s,\n%s)" % (self.typename(), sp, self.name, sp, self.fileformat().typename(), sp, self.mode, sp, self.format().typename(), sp2) 530 return s
531 - def __repr__(self,spaces=0):
532 """Triggers on repr(self) 533 Returns a parsable string representation and saves the current object""" 534 s = self.__str__(spaces) 535 self.save() 536 return s
537 - def reload(self):
538 d = loadfile(self.name, False, False) 539 self._refetodata = self._fileformat(d) 540 fileobjects[self.name] = self._refetodata 541 self.convert(self.format())
542 - def save(self):
543 """ 544 If <mode> is "Write", saves <data> to disk 545 but first, it converts <data> to <fileformat> 546 unless <fileformat> is "Data" 547 """ 548 if self.mode == "Write": 549 self.convert(self._fileformat) 550 buf = self.data() 551 savefile(self.name, buf)
552 - def close(self):
553 """Unloads <data> from memory 554 The current object and all other objects 555 with the same <name> become invalid""" 556 fileobjects.pop(self.name) 557 self._refetodata = None
558 - def delete(self):
559 """Erases <name> from disk""" 560 os.remove(self.name)
561 @classmethod
562 - def fromfile(c, filename, fastparse=False):
563 if fastparse: return Spyder.core.fastparse(filename, c) 564 else: return Spyder.core.__types__["File"](filename, c).data()
565 - def tofile(self, filename):
566 f = Spyder.core.__types__["File"](filename, type(self), "w", self) 567 f.save() 568 f.close()
569 - def totempfile(self):
570 tempdir = Spyder.getvar("tempdir") 571 import random, os 572 while 1: 573 tempnam = tempdir + os.sep + str(random.randrange(1,1000000000))+".tmp" 574 if not os.path.exists(tempnam): break 575 f = Spyder.core.__types__["File"](tempnam, type(self), "w", self) 576 f.temporary(True) 577 f.save() 578 return f
579
580 -class Filename(String):
581 """Parent class: L{String} 582 583 Data type that checks that its value is a valid local file name""" 584 @staticmethod
585 - def typename(): return "Filename"
586 - def validate(self):
587 if not os.path.exists(self): raise Spyder.core.ValidationError
588 - def __new__(self, s0):
589 s = s0 590 if hasattr(s0, "typename") and s0.typename() == "File": 591 s = s0.name 592 593 l = None 594 while len(s) != l: 595 s = s.replace('\\\\', '\\') 596 l = len(s) 597 ret = String.__new__(self,s) 598 Filename.validate(ret) 599 return ret
600
601 -class ObjectList(Spyder.core.spyderlist):
602 """Parent class: U{(Spyder.core.spyderlist)<http://www.spyderware.nl/doc/Spyder.Spyder.core.spyderlist-class.html>} 603 604 This class is similar to a Spyder Array, but it its members need not 605 be of a single Spyder class. 606 Instead, every member must be of any Spyder class, i.e. it must have 607 a typename() method""" 608 __constructor__ = "constructor_fromany" 609 __multimethods = {} 610 multimethod = functools.partial (Spyder.core.__multimethod__,__multimethods) 611 612 @staticmethod
613 - def typename(): return "ObjectList"
614 - def __init__(self, *args, **kargs):
615 return ObjectList.__dict__[ObjectList.__constructor__](self, *args, **kargs)
616 - def constructor_fromany(self, *a):
617 self.Annotation = {} 618 for funcname in self.__multimethods: 619 func, arg = self.__multimethods[funcname] 620 self.__dict__[funcname] = functools.partial(func, **({arg:self})) 621 622 try: 623 Spyder.core.spyderlist.__init__(self,*a) 624 self.validate() 625 except Exception, e: 626 if len(a) > 1: raise 627 self.__parse__(a[0]) 628 self.validate()
629 - def constructor_fromdict(self, dic):
630 self.Annotation = {} 631 if isinstance(dic, dict): 632 for funcname in self.__multimethods: 633 func, arg = self.__multimethods[funcname] 634 self.__dict__[funcname] = functools.partial(func, **({arg:self})) 635 aa = [] 636 for key in dic: 637 try: 638 constr = globals()[key].fromdict 639 except AttributeError: 640 constr = globals()[key] 641 aa.append(constr(dic[key])) 642 Spyder.core.spyderlist.__init__(self,*aa) 643 self.validate() 644 elif isinstance(dic, list): 645 Spyder.core.spyderlist.__init__(self,*dic) 646 self.validate()
647 - def cast(self,othertype):
648 if type(othertype) == type(int): return othertype(self) 649 return globals()[othertype](self)
650 - def __getattr__(self, method):
651 m = Spyder.core.method(ObjectList, method, self, globals()) 652 return m
653 - def convert(self, target):
654 c = Spyder.core.convert(ObjectList, target, self, globals()) 655 return c
656 - def validate(self):
657 try: 658 self.__validate__() 659 except Exception,inst: 660 if isinstance(inst, Spyder.core.ValidationError): 661 raise 662 else: raise Spyder.core.ValidationError(inst)
663 - def __validate__(self):
664 for o in self: 665 assert hasattr(o,"typename")
666 - def list(self):
667 return list(self)
668 - def length(self): return len(self)
669 - def __parse__(self, s):
670 a = Spyder.core.parse(s, "Spyder") 671 if len(a) == 1: 672 Spyder.core.spyderlist.__init__(self,a) 673 elif len(a) == 2: 674 Spyder.core.spyderlist.__init__(self,a[0])
675 - def __print__(self,spaces,mode):
676 ret = "%s (\n" % self.typename() 677 for o in self: 678 p = o.__print__(spaces+2,mode) 679 tp = o.typename() 680 if tp in ("Integer","Float","Bool","String"): p = tp+"("+p+")" 681 ret += (spaces+2) * " " + p + ",\n" 682 ret += spaces * " " + ")" 683 return ret
684 - def __str__(self): return self.__print__(0, "str")
685 - def str(self): return self.__print__(0, "str")
686 - def data(self): return str(self)
687 - def __repr__(self): return self.__print__(0, "repr")
688 - def repr(self): return self.__print__(0, "repr")
689 @classmethod
690 - def fromfile(c, filename, fastparse=False):
691 if fastparse: return Spyder.core.fastparse(filename, c) 692 else: return Spyder.core.__types__["File"](filename, c).data()
693 - def tofile(self, filename):
694 f = Spyder.core.__types__["File"](filename, type(self), "w", self) 695 f.save() 696 f.close()
697 - def totempfile(self):
698 tempdir = Spyder.getvar("tempdir") 699 import random, os 700 while 1: 701 tempnam = tempdir + os.sep + str(random.randrange(1,1000000000))+".tmp" 702 if not os.path.exists(tempnam): break 703 f = Spyder.core.__types__["File"](tempnam, type(self), "w", self) 704 f.temporary(True) 705 f.save() 706 return f
707 - def dict(self):
708 """Called by the dict function of Spyder classes 709 that have ObjectList members 710 For internal use only""" 711 return self 712
713 -class Stream(object):
714 """ 715 Spyder-generated class 716 717 module builtin 718 719 720 file /home/sjoerd/Spyder-devel/builtin/Stream.spy 721 722 723 724 Description 725 =========== 726 727 728 729 Class representing the input/output of a UNIX pipe 730 731 732 "out" contains the data received from stdout / sent to stdin 733 734 735 "err" contains the data received from stderr 736 737 738 If "err" is empty, only "out" is printed by a "print" statement 739 740 741 742 743 744 745 Wiki 746 ==== 747 U{http://www.spyderware.nl/wiki/classes/Stream} 748 @ivar out: 749 @type out: L{*Data<Data>} 750 @ivar err: 751 @type err: L{*Data<Data>} 752 @sort: out,err 753 """ 754
755 - def pipe(self, cmd):
756 """Opens a pipe to system command cmd 757 self.out is sent to the pipe's stdin 758 Returns a Stream containing 759 the pipe's stdout in out 760 and self.err + the pipe's stderr in err 761 """ 762 err = self.err 763 if err == None: err = Data("") 764 if self.out == None: 765 s = Stream(pipe(cmd)) 766 else: 767 s = Stream(pipe(cmd, self.out.data())) 768 serr = s.err 769 if serr == None: serr = Data("") 770 return Stream(s.out, err.data() + serr.data())
771 - def __or__(self, cmd):
772 """Pipe operator | ; equivalent to self.pipe(...)""" 773 return self.pipe(cmd)
774 - def join(self):
775 """Adds self.err to self.out""" 776 ret = Stream(self) 777 if ret.err != None: 778 if ret.out == None: ret.out = ret.err 779 else: ret.out = Data(ret.out.data() + ret.err.data()) 780 ret.err = None 781 return ret
782 - def swap(self):
783 """Swaps self.out and self.err""" 784 return Stream(self.err, self.out)
785 - def chomp(self):
786 """Removes trailing EOL of self.out and self.err""" 787 if self.out != None and self.out.data().endswith('\n'): 788 self.out = Data(self.out.data()[:-len('\n')]) 789 if self.err != None and self.err.data().endswith('\n'): 790 self.err = Data(self.err.data()[:-len('\n')]) 791 return self
792 - def lines(self):
793 """Splits self.out into lines""" 794 if self.out == None: return [] 795 d = self.out.data() 796 if d.endswith('\n'): d = d[:-len('\n')] 797 return d.split('\n')
798 - def textdata(self):
799 """Returns self.out.textdata()""" 800 if self.out == None: return "" 801 return self.out.textdata()
802 - def data(self):
803 """Returns self.out.data()""" 804 if self.out == None: return "" 805 return self.out.data()
806 - def text(self):
807 """Returns self.out.textdata()""" 808 return self.textdata()
809 - def __str__(self):
810 """if self.err is None, this is equivalent to str(self.out)""" 811 if self.out == None and self.err == None: return "" 812 if self.err == None or self.err.data() == "": 813 if self.out != None: return self.out.textdata() 814 return "" 815 return "Stream (\n out = '%s',\n err = '%s',\n)" % (self.out.textdata(), self.err.textdata())
816
817 -class Range(object):
818 """ 819 Spyder-generated class 820 821 module basic 822 823 824 file /home/sjoerd/Spyder-devel/basic/range.spy 825 826 827 828 Wiki 829 ==== 830 U{http://www.spyderware.nl/wiki/classes/Range} 831 832 Validate block 833 ============== 834 835 >>> 836 assert end >= start 837 >>> 838 839 840 Form block 841 ========== 842 843 >>> 844 start First number 845 end Last number 846 >>> 847 848 @ivar start: 849 @type start: L{Integer} 850 @ivar end: 851 @type end: L{Integer} 852 @sort: start,end 853 """
854
855 -class OptionalRange(object):
856 """ 857 Spyder-generated class 858 859 module basic 860 861 862 file /home/sjoerd/Spyder-devel/basic/range.spy 863 864 865 866 Wiki 867 ==== 868 U{http://www.spyderware.nl/wiki/classes/OptionalRange} 869 870 Validate block 871 ============== 872 873 >>> 874 assert (start != None) == (end != None) 875 assert start == None or end >= start 876 >>> 877 878 879 Form block 880 ========== 881 882 >>> 883 TYPE start required 884 TYPE end required 885 start First number 886 end Last number 887 >>> 888 889 @ivar start: 890 @type start: L{*Integer<Integer>} 891 @ivar end: 892 @type end: L{*Integer<Integer>} 893 @sort: start,end 894 """
895
896 897 -class RGBAImage(File):
898 """ 899 Spyder-generated class 900 901 module image 902 903 904 file /home/sjoerd/Spyder-devel/image/image.spy 905 906 907 908 Wiki 909 ==== 910 U{http://www.spyderware.nl/wiki/classes/RGBAImage} 911 912 Validate block 913 ============== 914 915 >>> 916 assert file.data().length() > 0 917 assert file.convert(RGBAData) != None 918 >>> 919 920 @sort: 921 """
922
923 -class RGBImage(File):
924 """ 925 Spyder-generated class 926 927 module image 928 929 930 file /home/sjoerd/Spyder-devel/image/image.spy 931 932 933 934 Wiki 935 ==== 936 U{http://www.spyderware.nl/wiki/classes/RGBImage} 937 938 Validate block 939 ============== 940 941 >>> 942 assert file.data().length() > 0 943 assert file.convert(RGBData) != None 944 >>> 945 946 @sort: 947 """
948
949 -class ImageData(object):
950 """ 951 Spyder-generated class 952 953 module image 954 955 956 file /home/sjoerd/Spyder-devel/image/image.spy 957 958 959 960 Wiki 961 ==== 962 U{http://www.spyderware.nl/wiki/classes/ImageData} 963 @ivar data: 964 @type data: L{Data} 965 @ivar sizex: 966 @type sizex: L{Integer} 967 @ivar sizey: 968 @type sizey: L{Integer} 969 @sort: data,sizex,sizey 970 """ 971
972 - def length(self): return self.data.length()
973 -class RGBAData(ImageData):
974 """ 975 Spyder-generated class 976 977 module image 978 979 980 file /home/sjoerd/Spyder-devel/image/image.spy 981 982 983 984 Wiki 985 ==== 986 U{http://www.spyderware.nl/wiki/classes/RGBAData} 987 988 Validate block 989 ============== 990 991 >>> 992 assert data.length() == 4 * sizex * sizey 993 >>> 994 995 996 Converters 997 ========== 998 999 Can be converted to: 1000 -------------------- 1001 1002 - L{RGBData} 1003 - L{PIL.convertRGBAtoRGB <PIL.convertRGBAtoRGB>} 1004 1005 - L{Data_PNG} 1006 - L{PIL.writePNGImage <PIL.writePNGImage>} 1007 1008 - L{Data_BMP} 1009 - L{PIL.writeBMPImage <PIL.writeBMPImage>} 1010 1011 - L{Data_JPEG} 1012 - L{PIL.writeJPEGImage <PIL.writeJPEGImage>} 1013 1014 - L{Data_GIF} 1015 - L{PIL.writeGIFImage <PIL.writeGIFImage>} 1016 1017 Can be converted from: 1018 ---------------------- 1019 1020 - L{RGBData} 1021 - L{PIL.convertRGBtoRGBA <PIL.convertRGBtoRGBA>} 1022 1023 - L{Data_PNG} 1024 - L{PIL.readRGBAImage <PIL.readRGBAImage>} 1025 1026 - L{Data_BMP} 1027 - L{PIL.readRGBAImage <PIL.readRGBAImage>} 1028 1029 - L{Data_JPEG} 1030 - L{PIL.readRGBAImage <PIL.readRGBAImage>} 1031 1032 - L{Data_GIF} 1033 - L{PIL.readRGBAImage <PIL.readRGBAImage>} 1034 1035 Registered methods: 1036 =================== 1037 1038 - toPILImage 1039 - L{PIL.toPILImage <PIL.toPILImage>} 1040 1041 - show 1042 - L{basicview.showRGBAData <basicview.showRGBAData>} 1043 @sort: 1044 """ 1045
1046 - def length(self): return self.data.length()
1047 -class RGBData(ImageData):
1048 """ 1049 Spyder-generated class 1050 1051 module image 1052 1053 1054 file /home/sjoerd/Spyder-devel/image/image.spy 1055 1056 1057 1058 Wiki 1059 ==== 1060 U{http://www.spyderware.nl/wiki/classes/RGBData} 1061 1062 Validate block 1063 ============== 1064 1065 >>> 1066 assert data.length() == 3 * sizex * sizey 1067 >>> 1068 1069 1070 Converters 1071 ========== 1072 1073 Can be converted to: 1074 -------------------- 1075 1076 - L{RGBAData} 1077 - L{PIL.convertRGBtoRGBA <PIL.convertRGBtoRGBA>} 1078 1079 Can be converted from: 1080 ---------------------- 1081 1082 - L{RGBAData} 1083 - L{PIL.convertRGBAtoRGB <PIL.convertRGBAtoRGB>} 1084 1085 Registered methods: 1086 =================== 1087 1088 - toPILImage 1089 - L{PIL.toPILImage <PIL.toPILImage>} 1090 1091 - show 1092 - L{basicview.showRGBData <basicview.showRGBData>} 1093 @sort: 1094 """ 1095
1096 - def length(self): return self.data.length()
1097 -class Data_PNG(Data):
1098 """ 1099 Spyder-generated class 1100 1101 module image 1102 1103 1104 file /home/sjoerd/Spyder-devel/image/image.spy 1105 1106 1107 1108 Wiki 1109 ==== 1110 U{http://www.spyderware.nl/wiki/classes/Data_PNG} 1111 1112 Converters 1113 ========== 1114 1115 Can be converted to: 1116 -------------------- 1117 1118 - L{RGBAData} 1119 - L{PIL.readRGBAImage <PIL.readRGBAImage>} 1120 1121 Can be converted from: 1122 ---------------------- 1123 1124 - L{RGBAData} 1125 - L{PIL.writePNGImage <PIL.writePNGImage>} 1126 1127 - L{BlenderImage} 1128 - L{view converter (#8) <spyderconverterfunction_8>} 1129 @sort: 1130 """
1131
1132 -class Data_BMP(Data):
1133 """ 1134 Spyder-generated class 1135 1136 module image 1137 1138 1139 file /home/sjoerd/Spyder-devel/image/image.spy 1140 1141 1142 1143 Wiki 1144 ==== 1145 U{http://www.spyderware.nl/wiki/classes/Data_BMP} 1146 1147 Converters 1148 ========== 1149 1150 Can be converted to: 1151 -------------------- 1152 1153 - L{RGBAData} 1154 - L{PIL.readRGBAImage <PIL.readRGBAImage>} 1155 1156 Can be converted from: 1157 ---------------------- 1158 1159 - L{RGBAData} 1160 - L{PIL.writeBMPImage <PIL.writeBMPImage>} 1161 @sort: 1162 """
1163
1164 -class Data_JPEG(Data):
1165 """ 1166 Spyder-generated class 1167 1168 module image 1169 1170 1171 file /home/sjoerd/Spyder-devel/image/image.spy 1172 1173 1174 1175 Wiki 1176 ==== 1177 U{http://www.spyderware.nl/wiki/classes/Data_JPEG} 1178 1179 Converters 1180 ========== 1181 1182 Can be converted to: 1183 -------------------- 1184 1185 - L{RGBAData} 1186 - L{PIL.readRGBAImage <PIL.readRGBAImage>} 1187 1188 Can be converted from: 1189 ---------------------- 1190 1191 - L{Data_JPG} 1192 - CAST 1193 1194 - L{RGBAData} 1195 - L{PIL.writeJPEGImage <PIL.writeJPEGImage>} 1196 1197 - L{BlenderImage} 1198 - L{view converter (#6) <spyderconverterfunction_6>} 1199 @sort: 1200 """
1201
1202 -class Data_JPG(Data):
1203 """ 1204 Spyder-generated class 1205 1206 module image 1207 1208 1209 file /home/sjoerd/Spyder-devel/image/image.spy 1210 1211 1212 1213 Wiki 1214 ==== 1215 U{http://www.spyderware.nl/wiki/classes/Data_JPG} 1216 1217 Converters 1218 ========== 1219 1220 Can be converted to: 1221 -------------------- 1222 1223 - L{Data_JPEG} 1224 - CAST 1225 1226 Can be converted from: 1227 ---------------------- 1228 1229 - L{BlenderImage} 1230 - L{view converter (#5) <spyderconverterfunction_5>} 1231 @sort: 1232 """
1233
1234 -class Data_GIF(Data):
1235 """ 1236 Spyder-generated class 1237 1238 module image 1239 1240 1241 file /home/sjoerd/Spyder-devel/image/image.spy 1242 1243 1244 1245 Wiki 1246 ==== 1247 U{http://www.spyderware.nl/wiki/classes/Data_GIF} 1248 1249 Converters 1250 ========== 1251 1252 Can be converted to: 1253 -------------------- 1254 1255 - L{RGBAData} 1256 - L{PIL.readRGBAImage <PIL.readRGBAImage>} 1257 1258 Can be converted from: 1259 ---------------------- 1260 1261 - L{RGBAData} 1262 - L{PIL.writeGIFImage <PIL.writeGIFImage>} 1263 1264 - L{BlenderImage} 1265 - L{view converter (#7) <spyderconverterfunction_7>} 1266 @sort: 1267 """
1268
1269 1270 1271 -class PDBCode(String):
1272 """ 1273 Spyder-generated class 1274 1275 module atom 1276 1277 1278 file /home/sjoerd/Spyder-devel/atom/pdb.spy 1279 1280 1281 1282 Wiki 1283 ==== 1284 U{http://www.spyderware.nl/wiki/classes/PDBCode} 1285 1286 Validate block 1287 ============== 1288 1289 >>> 1290 if len(self) != 4 or not self[0].isdigit() or not self[1:].isalnum(): 1291 raise AtomValidationError("Invalid PDB code %s" % self) 1292 >>> 1293 1294 @sort: 1295 """
1296
1297 -class PDBCodeChain(String):
1298 """ 1299 Spyder-generated class 1300 1301 module atom 1302 1303 1304 file /home/sjoerd/Spyder-devel/atom/pdb.spy 1305 1306 1307 1308 Wiki 1309 ==== 1310 U{http://www.spyderware.nl/wiki/classes/PDBCodeChain} 1311 1312 Validate block 1313 ============== 1314 1315 >>> 1316 if len(self) != 5 or not self[0].isdigit() or not self[1:4].isalnum() or (not self[4].isalpha() and self[4] != "_"): 1317 raise AtomValidationError("Invalid PDB code + chain %s\\nPlease specify as e.g. 1AVXA, 1ACB_" % self) 1318 >>> 1319 1320 @sort: 1321 """
1322
1323 -class Data_PDB(Data):
1324 """ 1325 Spyder-generated class 1326 1327 module atom 1328 1329 1330 file /home/sjoerd/Spyder-devel/atom/pdb.spy 1331 1332 1333 1334 Description 1335 =========== 1336 1337 1338 1339 Data in Protein Data Bank (PDB) format 1340 1341 1342 1343 1344 1345 1346 Wiki 1347 ==== 1348 U{http://www.spyderware.nl/wiki/classes/Data_PDB} 1349 1350 Converters 1351 ========== 1352 1353 Can be converted to: 1354 -------------------- 1355 1356 - L{InterResidueDistanceArray<InterResidueDistance>} 1357 - L{view converter (#4) <spyderconverterfunction_4>} 1358 1359 - L{SurfaceAccessibilityArray<SurfaceAccessibility>} 1360 - L{view converter (#5) <spyderconverterfunction_5>} 1361 1362 Can be converted from: 1363 ---------------------- 1364 1365 - L{PDBInterface} 1366 - L{view converter (#2) <spyderconverterfunction_2>} 1367 1368 - L{PDBData} 1369 - L{view converter (#3) <spyderconverterfunction_3>} 1370 @sort: 1371 """
1372
1373 -class File_PDB(File):
1374 """ 1375 Spyder-generated class 1376 1377 module atom 1378 1379 1380 file /home/sjoerd/Spyder-devel/atom/pdb.spy 1381 1382 1383 1384 Description 1385 =========== 1386 1387 1388 1389 File in Protein Data Bank (PDB) format 1390 1391 1392 1393 1394 1395 1396 Wiki 1397 ==== 1398 U{http://www.spyderware.nl/wiki/classes/File_PDB} 1399 1400 Validate block 1401 ============== 1402 1403 >>> 1404 assert self.format().typename() == "Data_PDB" 1405 >>> 1406 1407 @sort: 1408 """
1409
1410 -class PDBInterface(object):
1411 """ 1412 Spyder-generated class 1413 1414 module atom 1415 1416 1417 file /home/sjoerd/Spyder-devel/atom/pdb.spy 1418 1419 1420 1421 Description 1422 =========== 1423 1424 1425 1426 Interface to specify Protein Data Bank (PDB) files 1427 1428 1429 Either a file (mode "submit") or a PDB code (mode "download") is specified 1430 1431 1432 The user can restrict the PDB to a specific chain, or else "All" must be specified as chain 1433 1434 1435 1436 1437 1438 1439 Wiki 1440 ==== 1441 U{http://www.spyderware.nl/wiki/classes/PDBInterface} 1442 1443 Validate block 1444 ============== 1445 1446 >>> 1447 if not (mode != "submit" or (pdbfile != None and code == None)): 1448 raise AtomValidationError("Please upload a PDB file, or select \"Download it from the PDB\" and provide a PDB code") 1449 if not (mode != "download" or (pdbfile == None and code != None)): 1450 raise AtomValidationError("Please provide a PDB code, or select \"I am submitting it\" and upload a PDB file") 1451 if chain not in ("All", "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"): 1452 raise AtomValidationError("Please provide a chain") 1453 >>> 1454 1455 1456 Converters 1457 ========== 1458 1459 Can be converted to: 1460 -------------------- 1461 1462 - L{PDBData} 1463 - L{view converter (#1) <spyderconverterfunction_1>} 1464 1465 - L{Data_PDB} 1466 - L{view converter (#2) <spyderconverterfunction_2>} 1467 @ivar mode: 1468 @type mode: L{String} 1469 @ivar chain: 1470 @type chain: L{String} 1471 @ivar pdbfile: 1472 @type pdbfile: L{*File_PDB<File_PDB>} 1473 @ivar code: 1474 @type code: L{*PDBCode<PDBCode>} 1475 @sort: mode,chain,pdbfile,code 1476 """
1477
1478 -class PDBData(PDBInterface):
1479 """ 1480 Spyder-generated class 1481 1482 module atom 1483 1484 1485 file /home/sjoerd/Spyder-devel/atom/pdb.spy 1486 1487 1488 1489 Description 1490 =========== 1491 1492 1493 1494 Data model to represent Protein Data Bank (PDB) data 1495 1496 1497 This replaces PDBInterface's pdbfile with a pdbdata string, 1498 1499 1500 allowing serialization without external dependencies 1501 1502 1503 1504 1505 1506 1507 Wiki 1508 ==== 1509 U{http://www.spyderware.nl/wiki/classes/PDBData} 1510 1511 Validate block 1512 ============== 1513 1514 >>> 1515 if not (mode != "submit" or (pdbdata!= None and code == None)): 1516 raise AtomValidationError("Please upload a PDB file, or select \"Download\" and provide a PDB code") 1517 if not (mode != "download" or (pdbdata == None and code != None)): 1518 raise AtomValidationError("Please provide a PDB code, or select \"Submit\" and upload a PDB file") 1519 >>> 1520 1521 1522 Converters 1523 ========== 1524 1525 Can be converted to: 1526 -------------------- 1527 1528 - L{Data_PDB} 1529 - L{view converter (#3) <spyderconverterfunction_3>} 1530 1531 Can be converted from: 1532 ---------------------- 1533 1534 - L{PDBInterface} 1535 - L{view converter (#1) <spyderconverterfunction_1>} 1536 @ivar (pdbfile): 1537 @type (pdbfile): Delete 1538 @ivar pdbdata: 1539 @type pdbdata: L{*String<String>} 1540 @ivar (validate): 1541 @type (validate): Delete 1542 @sort: pdbfile,pdbdata,validate 1543 """
1544
1545 -def spyderconverterfunction_1(i):
1546 ii = i.dict() 1547 if "pdbfile" in ii["p1"]["pdb"]: 1548 ii["p1"]["pdb"]["pdbdata"] = File(**ii["p1"]["pdb"]["pdbfile"]).data().textdata() 1549 ii["p1"]["pdb"] = PDBData(ii["p1"]["pdb"]) 1550 if "pdbfile" in ii["p2"]["pdb"]: 1551 ii["p2"]["pdb"]["pdbdata"] = File(**ii["p2"]["pdb"]["pdbfile"]).data().textdata() 1552 ii["p2"]["pdb"] = PDBData(ii["p2"]["pdb"]) 1553 r = "tblfile" 1554 if r in ii: 1555 ii["tbldata"] = File(**ii[r]).data().textdata() 1556 r = "unambigtblfile" 1557 if r in ii: 1558 ii["unambigtbldata"] = File(**ii[r]).data().textdata() 1559 dihedraldata = None 1560 r = "dihedralfile" 1561 if r in ii: 1562 fil = File(**ii[r]) 1563 dihedraldata = fil.data().textdata() 1564 ii["dihedraldata"] = dihedraldata 1565 hbonddata = None 1566 r = "hbondfile" 1567 if r in ii: 1568 fil = File(**ii[r]) 1569 hbonddata = fil.data().textdata() 1570 ii["hbonddata"] = hbonddata 1571 for v in ("rdc1", "rdc2", "rdc3", "rdc4", "rdc5"): 1572 vv = ii[v] 1573 rdcdata = None 1574 r = "rdcfile" 1575 if r in vv: 1576 fil = File(**vv[r]) 1577 rdcdata = fil.data().textdata() 1578 vv["rdcdata"] = rdcdata 1579 for v in ("dan1", "dan2", "dan3", "dan4", "dan5"): 1580 vv = ii[v] 1581 danidata = None 1582 r = "danifile" 1583 if r in vv: 1584 fil = File(**vv[r]) 1585 danidata = fil.data().textdata() 1586 vv["danidata"] = danidata 1587 return HaddockRunParameters(ii)
1588
1589 -def spyderconverterfunction_2(i):
1590 ii = i.dict() 1591 if "pdbdata" in ii["p1"]["pdb"]: 1592 v = Data_PDB(ii["p1"]["pdb"]["pdbdata"]) 1593 ii["p1"]["pdb"]["pdbfile"] = v.totempfile() 1594 ii["p1"]["pdb"] = PDBInterface.fromdict(ii["p1"]["pdb"]) 1595 if "pdbdata" in ii["p2"]["pdb"]: 1596 v = Data_PDB(ii["p2"]["pdb"]["pdbdata"]) 1597 ii["p2"]["pdb"]["mode"] = "submit" 1598 ii["p2"]["pdb"]["pdbfile"] = v.totempfile() 1599 ii["p2"]["pdb"] = PDBInterface.fromdict(ii["p2"]["pdb"]) 1600 r = "tbldata" 1601 if r in ii: 1602 ii["tblfile"] = ii[r].totempfile() 1603 r = "unambigtbldata" 1604 if r in ii: 1605 ii["unambigtblfile"] = ii[r].totempfile() 1606 dihedralfile = None 1607 r = "dihedraldata" 1608 if r in ii: 1609 dihedralfile = ii[r].totempfile() 1610 ii["dihedralfile"] = dihedralfile 1611 hbondfile = None 1612 r = "hbonddata" 1613 if r in ii: 1614 hbondfile = ii[r].totempfile() 1615 ii["hbondfile"] = hbondfile 1616 for v in ("rdc1", "rdc2", "rdc3", "rdc4", "rdc5"): 1617 vv = ii[v] 1618 rdcfile = None 1619 r = "rdcdata" 1620 if r in vv: 1621 rdcfile = vv[r].totempfile() 1622 vv["rdcfile"] = rdcfile 1623 for v in ("dan1", "dan2", "dan3", "dan4", "dan5"): 1624 vv = ii[v] 1625 danifile = None 1626 r = "danidata" 1627 if r in vv: 1628 danifile = vv[r].totempfile() 1629 vv["danifile"] = danifile 1630 return HaddockGuruInterface(ii)
1631
1632 -def spyderconverterfunction_3(i):
1633 if i.p == None or len(i.p) < 2: return None 1634 d = i.dict() 1635 d["p1"] = i.p[0].dict() 1636 d["p2"] = i.p[1].dict() 1637 ret = HaddockGuruInterface(d) 1638 return ret
1639
1640 -class PDBCodeList(PDBCodeArray):
1641 """Parent class: L{PDBCodeArray<PDBCode>}"""
1642 - def __parse__(self, s):
1643 try: 1644 if s.startswith('"') and s.endswith('"'): s = s[1:-1] 1645 if s.startswith("'") and s.endswith("'"): s = s[1:-1] 1646 except: 1647 pass 1648 try: 1649 ret = PDBCodeArray.__parse__(self, s) 1650 except: 1651 ret = PDBCodeArray.__parse__(self, "[" + s + "]") 1652 return ret
1653 - def __copy__(self, *args, **kargs):
1654 if len(args): 1655 v = None 1656 if isinstance(args[0],str): v = args[0] 1657 elif isinstance(args[0],tuple) and len(args[0]): v = args[0][0] 1658 if v != None and v.find(",") > -1: 1659 raise ValueError("Invalid PDB code %s" % v) 1660 return PDBCodeArray.__copy__(self, *args, **kargs)
1661 - def __repr__(self, *args, **kargs):
1662 return "'" + self.__str__(*args, **kargs) + "'"
1663 - def __str__(self, *args, **kargs):
1664 return ",".join([str(v) for v in self])
1665 - def __print__(self, *args, **kargs):
1666 return self.__repr__(*args,**kargs)
1667
1668 -class PDBCodeChainList(PDBCodeChainArray):
1669 """Parent class: L{PDBCodeChainArray<PDBCodeChain>}"""
1670 - def __parse__(self, s):
1671 try: 1672 if s.startswith('"') and s.endswith('"'): s = s[1:-1] 1673 if s.startswith("'") and s.endswith("'"): s = s[1:-1] 1674 except: 1675 pass 1676 try: 1677 ret = PDBCodeChainArray.__parse__(self, s) 1678 except: 1679 ret = PDBCodeChainArray.__parse__(self, "[" + s + "]") 1680 return ret
1681 - def __copy__(self, *args, **kargs):
1682 if len(args): 1683 v = None 1684 if isinstance(args[0],str): v = args[0] 1685 elif isinstance(args[0],tuple) and len(args[0]): v = args[0][0] 1686 if v != None and v.find(",") > -1: 1687 raise ValueError("Invalid PDB code %s" % v) 1688 return PDBCodeChainArray.__copy__(self, *args, **kargs)
1689 - def __repr__(self, *args, **kargs):
1690 return "'" + self.__str__(*args, **kargs) + "'"
1691 - def __str__(self, *args, **kargs):
1692 return ",".join([str(v) for v in self])
1693 - def __print__(self, *args, **kargs):
1694 return self.__repr__(*args,**kargs)
1695
1696 -class AtomValidationError(ValidationError):
1697 """Parent class: U{(ValidationError)<http://www.spyderware.nl/doc/Spyder.ValidationError-class.html>}""" 1698 pass
1699
1700 -class LabeledRange(Range):
1701 """ 1702 Spyder-generated class 1703 1704 module atom 1705 1706 1707 file /home/sjoerd/Spyder-devel/atom/atom.spy 1708 1709 1710 1711 Description 1712 =========== 1713 1714 1715 1716 Data model to specify protein residue ranges, consisting of start, end and chain 1717 1718 1719 1720 1721 1722 1723 Wiki 1724 ==== 1725 U{http://www.spyderware.nl/wiki/classes/LabeledRange} 1726 1727 Validate block 1728 ============== 1729 1730 >>> 1731 if chain != None: assert chain in ("All", "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z") 1732 >>> 1733 1734 1735 Form block 1736 ========== 1737 1738 >>> 1739 OPTION chain "All", "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z" 1740 TYPE chain required 1741 chain Chain 1742 >>> 1743 1744 @ivar chain: 1745 @type chain: L{String} 1746 @sort: chain 1747 """
1748
1749 -class BasePlanarSpecification(object):
1750 """ 1751 Spyder-generated class 1752 1753 module atom 1754 1755 1756 file /home/sjoerd/Spyder-devel/atom/atom.spy 1757 1758 1759 1760 Description 1761 =========== 1762 1763 1764 1765 TODO documentation 1766 1767 1768 1769 1770 1771 1772 Wiki 1773 ==== 1774 U{http://www.spyderware.nl/wiki/classes/BasePlanarSpecification} 1775 @ivar a: 1776 @type a: L{Range} 1777 @ivar b: 1778 @type b: L{Range} 1779 @sort: a,b 1780 """
1781
1782 -class AngleErr(object):
1783 """ 1784 Spyder-generated class 1785 1786 module atom 1787 1788 1789 file /home/sjoerd/Spyder-devel/atom/atom.spy 1790 1791 1792 1793 Description 1794 =========== 1795 1796 1797 1798 Data model to describe angles and their errors 1799 1800 1801 TODO: angle in radians, degrees? 1802 1803 1804 1805 1806 1807 1808 Wiki 1809 ==== 1810 U{http://www.spyderware.nl/wiki/classes/AngleErr} 1811 1812 Validate block 1813 ============== 1814 1815 >>> 1816 assert error >= 0 1817 >>> 1818 1819 @ivar angle: 1820 @type angle: L{Float} 1821 @ivar error: 1822 @type error: L{Float} 1823 @sort: angle,error 1824 """
1825
1826 -class BasePair(object):
1827 """ 1828 Spyder-generated class 1829 1830 module atom 1831 1832 1833 file /home/sjoerd/Spyder-devel/atom/atom.spy 1834 1835 1836 1837 Description 1838 =========== 1839 1840 1841 1842 Data model to describe a DNA/RNA base pair 1843 1844 1845 1846 1847 1848 1849 Wiki 1850 ==== 1851 U{http://www.spyderware.nl/wiki/classes/BasePair} 1852 @ivar a: 1853 @type a: L{Integer} 1854 @ivar b: 1855 @type b: L{Integer} 1856 @sort: a,b 1857 """
1858
1859 -class SurfaceAccessibility(object):
1860 """ 1861 Spyder-generated class 1862 1863 module atom 1864 1865 1866 file /home/sjoerd/Spyder-devel/atom/atom.spy 1867 1868 1869 1870 Description 1871 =========== 1872 1873 1874 1875 Data model to describe a residue's surface accessibility, 1876 1877 1878 such as returned by NACCESS 1879 1880 1881 absolute values are in square Angstrom 1882 1883 1884 relative values are as percentage of accessibility in a dipeptide 1885 1886 1887 relative percentages can be more than 100 % 1888 1889 1890 1891 1892 1893 1894 Wiki 1895 ==== 1896 U{http://www.spyderware.nl/wiki/classes/SurfaceAccessibility} 1897 1898 Validate block 1899 ============== 1900 1901 >>> 1902 assert absolute == None or absolute >= 0 1903 assert absolute_sidechain == None or absolute_sidechain >= 0 1904 assert absolute_mainchain == None or absolute_mainchain >= 0 1905 >>> 1906 1907 1908 Converters 1909 ========== 1910 1911 Can be converted from: 1912 ---------------------- 1913 1914 - L{Data_PDB} (converts to SurfaceAccessibilityArray) 1915 - L{view converter (#5) <spyderconverterfunction_5>} 1916 @ivar residue: 1917 @type residue: L{Integer} 1918 @ivar absolute: 1919 @type absolute: L{*Float<Float>} 1920 @ivar relative: 1921 @type relative: L{*Float<Float>} 1922 @ivar absolute_sidechain: 1923 @type absolute_sidechain: L{*Float<Float>} 1924 @ivar relative_sidechain: 1925 @type relative_sidechain: L{*Float<Float>} 1926 @ivar absolute_mainchain: 1927 @type absolute_mainchain: L{*Float<Float>} 1928 @ivar relative_mainchain: 1929 @type relative_mainchain: L{*Float<Float>} 1930 @sort: residue,absolute,relative,absolute_sidechain,relative_sidechain,absolute_mainchain,relative_mainchain 1931 """
1932
1933 -class InterResidueDistance(object):
1934 """ 1935 Spyder-generated class 1936 1937 module atom 1938 1939 1940 file /home/sjoerd/Spyder-devel/atom/atom.spy 1941 1942 1943 1944 Description 1945 =========== 1946 1947 1948 1949 The shortest heavy-atom distance (in Angstroms) 1950 1951 1952 between two residues 1953 1954 1955 Can be used for non-residues (nucleic acid basepairs) as well 1956 1957 1958 1959 1960 1961 1962 Wiki 1963 ==== 1964 U{http://www.spyderware.nl/wiki/classes/InterResidueDistance} 1965 1966 Converters 1967 ========== 1968 1969 Can be converted from: 1970 ---------------------- 1971 1972 - L{Data_PDB} (converts to InterResidueDistanceArray) 1973 - L{view converter (#4) <spyderconverterfunction_4>} 1974 @ivar residue1: 1975 @type residue1: L{Integer} 1976 @ivar residue2: 1977 @type residue2: L{Integer} 1978 @ivar distance: 1979 @type distance: L{Float} 1980 @sort: residue1,residue2,distance 1981 """
1982
1983 -class RasmolSelection(Data):
1984 """ 1985 Spyder-generated class 1986 1987 module atom 1988 1989 1990 file /home/sjoerd/Spyder-devel/atom/atom.spy 1991 1992 1993 1994 Description 1995 =========== 1996 1997 1998 1999 Data in Rasmol script language syntax 2000 2001 2002 used to specify red and green selections 2003 2004 2005 2006 2007 2008 2009 Wiki 2010 ==== 2011 U{http://www.spyderware.nl/wiki/classes/RasmolSelection} 2012 @sort: 2013 """
2014
2015 -def spyderconverterfunction_4(i):
2016 ii = i.dict() 2017 if i.p != None: 2018 for n in range(len(i.p)): 2019 cur = ii["p"][n] 2020 if "pdbfile" in cur["pdb"]: 2021 cur["pdb"]["pdbdata"] = File(**cur["pdb"]["pdbfile"]).data().textdata() 2022 cur["pdb"] = PDBData(cur["pdb"]) 2023 HaddockPartnerParameters(cur) 2024 r = "tblfile" 2025 if r in ii: 2026 ii["tbldata"] = File(**ii[r]).data().textdata() 2027 r = "unambigtblfile" 2028 if r in ii: 2029 ii["unambigtbldata"] = File(**ii[r]).data().textdata() 2030 dihedraldata = None 2031 r = "dihedralfile" 2032 if r in ii: 2033 fil = File(**ii[r]) 2034 dihedraldata = fil.data().textdata() 2035 ii["dihedraldata"] = dihedraldata 2036 hbonddata = None 2037 r = "hbondfile" 2038 if r in ii: 2039 fil = File(**ii[r]) 2040 hbonddata = fil.data().textdata() 2041 ii["hbonddata"] = hbonddata 2042 for v in ("rdc1", "rdc2", "rdc3", "rdc4", "rdc5"): 2043 vv = ii[v] 2044 rdcdata = None 2045 r = "rdcfile" 2046 if r in vv: 2047 fil = File(**vv[r]) 2048 rdcdata = fil.data().textdata() 2049 vv["rdcdata"] = rdcdata 2050 for v in ("dan1", "dan2", "dan3", "dan4", "dan5"): 2051 vv = ii[v] 2052 danidata = None 2053 r = "danifile" 2054 if r in vv: 2055 fil = File(**vv[r]) 2056 danidata = fil.data().textdata() 2057 vv["danidata"] = danidata 2058 return HaddockMultiRunParameters(ii)
2059
2060 -def spyderconverterfunction_5(i):
2061 ii = i.dict() 2062 if ii["p"] != None: 2063 for n in range(len(ii["p"])): 2064 cur = ii["p"][n] 2065 if "pdbdata" in cur["pdb"]: 2066 v = Data_PDB(cur["pdb"]["pdbdata"]) 2067 cur["pdb"]["pdbfile"] = v.totempfile() 2068 cur["pdb"] = PDBInterface.fromdict(cur["pdb"]) 2069 r = "tbldata" 2070 if r in ii: 2071 ii["tblfile"] = ii[r].totempfile() 2072 r = "unambigtbldata" 2073 if r in ii: 2074 ii["unambigtblfile"] = ii[r].totempfile() 2075 dihedralfile = None 2076 r = "dihedraldata" 2077 if r in ii: 2078 dihedralfile = ii[r].totempfile() 2079 ii["dihedralfile"] = dihedralfile 2080 hbondfile = None 2081 r = "hbonddata" 2082 if r in ii: 2083 hbondfile = ii[r].totempfile() 2084 ii["hbondfile"] = hbondfile 2085 for v in ("rdc1", "rdc2", "rdc3", "rdc4", "rdc5"): 2086 vv = ii[v] 2087 rdcfile = None 2088 r = "rdcdata" 2089 if r in vv: 2090 rdcfile = vv[r].totempfile() 2091 vv["rdcfile"] = rdcfile 2092 for v in ("dan1", "dan2", "dan3", "dan4", "dan5"): 2093 vv = ii[v] 2094 danifile = None 2095 r = "danidata" 2096 if r in vv: 2097 danifile = vv[r].totempfile() 2098 vv["danifile"] = danifile 2099 return HaddockMultiInterface(ii)
2100
2101 -class DNABasePuckerGroup(object):
2102 """ 2103 Spyder-generated class 2104 2105 module atom 2106 2107 2108 file /home/sjoerd/Spyder-devel/atom/DNA.spy 2109 2110 2111 2112 Description 2113 =========== 2114 2115 2116 2117 TODO documentation 2118 2119 2120 2121 2122 2123 2124 Wiki 2125 ==== 2126 U{http://www.spyderware.nl/wiki/classes/DNABasePuckerGroup} 2127 2128 Validate block 2129 ============== 2130 2131 >>> 2132 if form != None: assert form in ("a-form", "b-form", "other") 2133 assert (nu2 != None) == (nu3 != None) 2134 assert (nu2 != None) == (nu4 != None) 2135 >>> 2136 2137 2138 Form block 2139 ========== 2140 2141 >>> 2142 OPTION form "a-form", "b-form", "other" 2143 >>> 2144 2145 @ivar form: 2146 @type form: L{String} 2147 @ivar range: 2148 @type range: L{Range} 2149 @ivar nu2: 2150 @type nu2: L{*AngleErr<AngleErr>} 2151 @ivar nu3: 2152 @type nu3: L{*AngleErr<AngleErr>} 2153 @ivar nu4: 2154 @type nu4: L{*AngleErr<AngleErr>} 2155 @sort: form,range,nu2,nu3,nu4 2156 """ 2157 2158 form = "b-form"
2159 -class DNABaseDihedralGroup(object):
2160 """ 2161 Spyder-generated class 2162 2163 module atom 2164 2165 2166 file /home/sjoerd/Spyder-devel/atom/DNA.spy 2167 2168 2169 2170 Description 2171 =========== 2172 2173 2174 2175 TODO documentation 2176 2177 2178 2179 2180 2181 2182 Wiki 2183 ==== 2184 U{http://www.spyderware.nl/wiki/classes/DNABaseDihedralGroup} 2185 2186 Validate block 2187 ============== 2188 2189 >>> 2190 if form != None: assert form in ("a-form", "b-form", "other") 2191 assert (alpha != None) == (beta != None) 2192 assert (alpha != None) == (gamma != None) 2193 assert (alpha != None) == (delta != None) 2194 assert (alpha != None) == (epsilon != None) 2195 assert (alpha != None) == (zeta != None) 2196 >>> 2197 2198 2199 Form block 2200 ========== 2201 2202 >>> 2203 OPTION form "a-form", "b-form", "other" 2204 >>> 2205 2206 @ivar form: 2207 @type form: L{String} 2208 @ivar range: 2209 @type range: L{Range} 2210 @ivar alpha: 2211 @type alpha: L{*AngleErr<AngleErr>} 2212 @ivar beta: 2213 @type beta: L{*AngleErr<AngleErr>} 2214 @ivar gamma: 2215 @type gamma: L{*AngleErr<AngleErr>} 2216 @ivar delta: 2217 @type delta: L{*AngleErr<AngleErr>} 2218 @ivar epsilon: 2219 @type epsilon: L{*AngleErr<AngleErr>} 2220 @ivar zeta: 2221 @type zeta: L{*AngleErr<AngleErr>} 2222 @sort: form,range,alpha,beta,gamma,delta,epsilon,zeta 2223 """ 2224 2225 form = "b-form"
2226 -class DNA_definition(object):
2227 """ 2228 Spyder-generated class 2229 2230 module atom 2231 2232 2233 file /home/sjoerd/Spyder-devel/atom/DNA.spy 2234 2235 2236 2237 Description 2238 =========== 2239 2240 2241 2242 TODO documentation 2243 2244 2245 2246 2247 2248 2249 Wiki 2250 ==== 2251 U{http://www.spyderware.nl/wiki/classes/DNA_definition} 2252 2253 Validate block 2254 ============== 2255 2256 >>> 2257 assert puckergroup == None or len(puckergroup) == 4 2258 assert dihedralgroup == None or len(dihedralgroup) == 4 2259 assert(dna_pick_wc != basepair_planar) 2260 for g in puckergroup: 2261 mustexist = (dna_pick_pucdih == False and g.form == "other") 2262 assert mustexist == (nu2 != None) 2263 for g in dihedralgroup: 2264 mustexist = (dna_pick_bacdih == False and g.form == "other") 2265 assert mustexist == (alpha != None) 2266 >>> 2267 2268 2269 Form block 2270 ========== 2271 2272 >>> 2273 LENGTH puckergroup 4 2274 LENGTH dihedralgroup 4 2275 >>> 2276 2277 @ivar basepair_planar: 2278 @type basepair_planar: L{Bool} 2279 @ivar dna_pick_wc: 2280 @type dna_pick_wc: L{Bool} 2281 @ivar dna_pick_dih: 2282 @type dna_pick_dih: L{Bool} 2283 @ivar wc_low: 2284 @type wc_low: L{Float} 2285 @ivar wc_up: 2286 @type wc_up: L{Float} 2287 @ivar wc_low_uri: 2288 @type wc_low_uri: L{Float} 2289 @ivar wc_up_uri: 2290 @type wc_up_uri: L{Float} 2291 @ivar c1_low: 2292 @type c1_low: L{Float} 2293 @ivar c1_up: 2294 @type c1_up: L{Float} 2295 @ivar bases_planar: 2296 @type bases_planar: L{BasePlanarSpecification} 2297 @ivar dna_pick_puckdih: 2298 @type dna_pick_puckdih: L{Bool} 2299 @ivar puckergroup: 2300 @type puckergroup: L{DNABasePuckerGroupArray<DNABasePuckerGroup>} 2301 @ivar dihedralgroup: 2302 @type dihedralgroup: L{DNABaseDihedralGroupArray<DNABaseDihedralGroup>} 2303 @ivar bp: 2304 @type bp: L{BasePairArray<BasePair>} 2305 @sort: basepair_planar,dna_pick_wc,dna_pick_dih,wc_low,wc_up,wc_low_uri,wc_up_uri,c1_low,c1_up,bases_planar,dna_pick_puckdih,puckergroup,dihedralgroup,bp 2306 """ 2307 2308 basepair_planar = True 2309 dna_pick_wc = False 2310 dna_pick_dih = True 2311 wc_low = 0.05 2312 wc_up = 0.05 2313 wc_low_uri = 0.01 2314 wc_up_uri = 0.01 2315 c1_low = 0.05 2316 c1_up = 0.05 2317 dna_pick_puckdih = False
2318 -def determine_passive_residues(activereslist, surfacelist, pdb, radius):
2319 passivereslist0 = set() 2320 distances = pdb.convert(InterResidueDistanceArray) 2321 for d in distances: 2322 if d.distance > radius: continue 2323 if d.residue1 in activereslist: 2324 if d.residue2 in surfacelist: passivereslist0.add(d.residue2) 2325 elif d.residue2 in activereslist: 2326 if d.residue1 in surfacelist: passivereslist0.add(d.residue1) 2327 passivereslist = [] 2328 for r in passivereslist0: 2329 if r not in activereslist: passivereslist.append(r) 2330 passivereslist.sort() 2331 return passivereslist
2332
2333 -def detect_bodies(pdb):
2334 cutoffsq1 = 5 * 5 2335 cutoffsq2 = 5 * 5 2336 lines = [l for l in pdb.splitlines() if l.startswith("ATOM")] 2337 pairs = [] 2338 currpairnr = None 2339 def match_pair(pairnr, begin, cutoffsq): 2340 z1 = (len(pairs[pairnr][0]) == 0) 2341 z2 = (len(pairs[pairnr][1]) == 0) 2342 if z1 or z2: return False 2343 if begin: 2344 coor = pairs[pairnr][0] 2345 ends = [p[1] for p in pairs] 2346 else: 2347 coor = pairs[pairnr][1] 2348 ends = [p[0] for p in pairs] 2349 for enr, e in enumerate(ends): 2350 if enr == pairnr: continue 2351 zz1 = (len(pairs[enr][0]) == 0) 2352 zz2 = (len(pairs[enr][1]) == 0) 2353 if zz1 or zz2: return False 2354 dissq = (e[0]-coor[0])**2 + (e[1]-coor[1])**2 + (e[2]-coor[2])**2 2355 if dissq < cutoffsq: 2356 if begin: 2357 pairs[enr][1] = pairs[pairnr][1] 2358 else: 2359 pairs[enr][0] = pairs[pairnr][0] 2360 pairs[enr][2] += pairs[pairnr][2] 2361 pairs.pop(pairnr) 2362 return True 2363 return False
2364 oldresnr = None 2365 for l in lines: 2366 atom = l[13:16] 2367 resnr = int(l[22:26]) 2368 if resnr != oldresnr: 2369 if currpairnr != None: 2370 pairs.pop() 2371 currpairnr = None 2372 oldresnr = resnr 2373 if atom == "N ": 2374 coor = (float(l[30:38]), float(l[38:46]), float(l[46:54])) 2375 if currpairnr == None: 2376 currpairnr = len(pairs) 2377 pairs.append([coor, []]) 2378 elif len(pairs[currpairnr]) == 2: 2379 pairs[currpairnr][0] = coor 2380 pairs[currpairnr].append([resnr]) 2381 match_pair(currpairnr, True, cutoffsq1) 2382 currpairnr = None 2383 if atom == "C ": 2384 coor = (float(l[30:38]), float(l[38:46]), float(l[46:54])) 2385 if currpairnr == None: 2386 currpairnr = len(pairs) 2387 pairs.append([[],coor]) 2388 elif len(pairs[currpairnr]) == 2: 2389 pairs[currpairnr][1] = coor 2390 pairs[currpairnr].append([resnr]) 2391 match_pair(currpairnr, True, cutoffsq1) 2392 currpairnr = None 2393 found = True 2394 while found and len(pairs) > 1: 2395 found = False 2396 for n in range(len(pairs)): 2397 if match_pair(n, True, cutoffsq2): 2398 found = True 2399 break 2400 if match_pair(n, False, cutoffsq2): 2401 found = True 2402 break 2403 return [p[2] for p in pairs if len(p) == 3 and len(p[0]) == 3 and len(p[1]) == 3] 2404
2405 2406 -class Data_PHYLIP(Data):
2407 """ 2408 Spyder-generated class 2409 2410 module bio 2411 2412 2413 file /home/sjoerd/Spyder-devel/bio/sequencealignment.spy 2414 2415 2416 2417 Wiki 2418 ==== 2419 U{http://www.spyderware.nl/wiki/classes/Data_PHYLIP} 2420 @sort: 2421 """
2422
2423 -class Data_CLUSTAL(Data):
2424 """ 2425 Spyder-generated class 2426 2427 module bio 2428 2429 2430 file /home/sjoerd/Spyder-devel/bio/sequencealignment.spy 2431 2432 2433 2434 Wiki 2435 ==== 2436 U{http://www.spyderware.nl/wiki/classes/Data_CLUSTAL} 2437 @sort: 2438 """
2439
2440 -class Data_FASTA(Data):
2441 """ 2442 Spyder-generated class 2443 2444 module bio 2445 2446 2447 file /home/sjoerd/Spyder-devel/bio/sequencealignment.spy 2448 2449 2450 2451 Wiki 2452 ==== 2453 U{http://www.spyderware.nl/wiki/classes/Data_FASTA} 2454 @sort: 2455 """
2456
2457 -class Data_MSF(Data):
2458 """ 2459 Spyder-generated class 2460 2461 module bio 2462 2463 2464 file /home/sjoerd/Spyder-devel/bio/sequencealignment.spy 2465 2466 2467 2468 Wiki 2469 ==== 2470 U{http://www.spyderware.nl/wiki/classes/Data_MSF} 2471 @sort: 2472 """
2473
2474 -class File_SequenceAlignment(File):
2475 """ 2476 Spyder-generated class 2477 2478 module bio 2479 2480 2481 file /home/sjoerd/Spyder-devel/bio/sequencealignment.spy 2482 2483 2484 2485 Wiki 2486 ==== 2487 U{http://www.spyderware.nl/wiki/classes/File_SequenceAlignment} 2488 2489 Validate block 2490 ============== 2491 2492 >>> 2493 formats = (Data_PHYLIP, Data_CLUSTAL,Data_FASTA, Data_MSF) 2494 ok = False 2495 for f in formats: 2496 if ok == True: break 2497 if self.format() == f: ok = True 2498 for f in formats: 2499 if ok == True: break 2500 if self.convert(f) != None: ok = True 2501 assert ok == True 2502 >>> 2503 2504 @sort: 2505 """
2506
2507 -class SequenceAlignmentForm(object):
2508 """ 2509 Spyder-generated class 2510 2511 module bio 2512 2513 2514 file /home/sjoerd/Spyder-devel/bio/sequencealignment.spy 2515 2516 2517 2518 Wiki 2519 ==== 2520 U{http://www.spyderware.nl/wiki/classes/SequenceAlignmentForm} 2521 2522 Validate block 2523 ============== 2524 2525 >>> 2526 assert hsspid == None or len(hsspid) == 4 2527 assert format == None or format in ("PHYLIP", "CLUSTAL","FASTA", "MSF") 2528 if file == None and hsspid == None: 2529 raise Spyder.core.ValidationError("You must supply either a sequence alignment file or a PDB code") 2530 if file != None and format == None: 2531 raise Spyder.core.ValidationError("You supplied a sequence alignment file but you didn't specify its format") 2532 if file == None and format != None: 2533 raise Spyder.core.ValidationError("You supplied a format for a sequence alignment file but you didn't supply one") 2534 if hsspid != None: 2535 if format != None or file != None: 2536 raise Spyder.core.ValidationError("You supplied a sequence alignment file but you also specified to use the HSSP alignment") 2537 >>> 2538 2539 2540 Form block 2541 ========== 2542 2543 >>> 2544 LENGTH hsspid 4 2545 >>> 2546 2547 @ivar file: 2548 @type file: L{*File<File>} 2549 @ivar format: 2550 @type format: L{*String<String>} 2551 @ivar hsspid: 2552 @type hsspid: L{*String<String>} 2553 @sort: file,format,hsspid 2554 """
2555
2556 2557 -class BlenderUIbutton(object):
2558 """ 2559 Spyder-generated class 2560 2561 module blenderui 2562 2563 2564 file /home/sjoerd/data/Spyder-devel/blenderui/blenderui.spy 2565 2566 2567 2568 Wiki 2569 ==== 2570 U{http://www.spyderware.nl/wiki/classes/BlenderUIbutton} 2571 2572 Validate block 2573 ============== 2574 2575 >>> 2576 assert xsize > 0 2577 assert ysize > 0 2578 assert ymargin >= 0 2579 >>> 2580 2581 @ivar ymargin: 2582 @type ymargin: L{Integer} 2583 @ivar xsize: 2584 @type xsize: L{Integer} 2585 @ivar ysize: 2586 @type ysize: L{Integer} 2587 @ivar nr: 2588 @type nr: L{Integer} 2589 @ivar default: 2590 @type default: L{*String<String>} 2591 @ivar column: 2592 @type column: L{*Integer<Integer>} 2593 @ivar name: 2594 @type name: L{*String<String>} 2595 @ivar tooltip: 2596 @type tooltip: L{*String<String>} 2597 @ivar header: 2598 @type header: L{*String<String>} 2599 @sort: ymargin,xsize,ysize,nr,default,column,name,tooltip,header 2600 """
2601
2602 -class BlenderUIcustombutton(BlenderUIbutton):
2603 """ 2604 Spyder-generated class 2605 2606 module blenderui 2607 2608 2609 file /home/sjoerd/data/Spyder-devel/blenderui/blenderui.spy 2610 2611 2612 2613 Wiki 2614 ==== 2615 U{http://www.spyderware.nl/wiki/classes/BlenderUIcustombutton} 2616 2617 Validate block 2618 ============== 2619 2620 >>> 2621 if buttontype != None: assert buttontype in ("none","slider", "number", "toggle", "text", "password", "option", "radio", "file", "button", "vector", "color") 2622 assert fileformat == None or (len(fileformat) >= 2 and fileformat[0].isupper() and fileformat[1].islower()) 2623 if (optiontitles != None): 2624 assert options != None 2625 if len(options) != len(optiontitles): 2626 raise Exception("%s has %d options, %d optiontitles" % (name, len(options), len(optiontitles))) 2627 assert (minimum == None) == (maximum == None) 2628 if buttontype != "none": 2629 if buttontype in ("radio", "option"): 2630 assert options != None 2631 else: 2632 assert options == None 2633 if buttontype not in ("slider", "number"): 2634 assert minimum == None 2635 assert range == None 2636 else: 2637 assert (minimum == None) != (range == None) 2638 if buttontype in ("text","password"): assert memberlength > 0 2639 >>> 2640 2641 2642 Form block 2643 ========== 2644 2645 >>> 2646 OPTION buttontype "none","slider", "number", "toggle", "text", "password", "option", "radio", "file", "button", "vector", "color" 2647 >>> 2648 2649 @ivar buttontype: 2650 @type buttontype: L{String} 2651 @ivar optiontitles: 2652 @type optiontitles: L{*StringArray<String>} 2653 @ivar options: 2654 @type options: L{*StringArray<String>} 2655 @ivar minimum: 2656 @type minimum: L{*Float<Float>} 2657 @ivar maximum: 2658 @type maximum: L{*Float<Float>} 2659 @ivar range: 2660 @type range: L{*Float<Float>} 2661 @ivar memberlength: 2662 @type memberlength: L{*Integer<Integer>} 2663 @ivar fileformat: 2664 @type fileformat: L{*String<String>} 2665 @sort: buttontype,optiontitles,options,minimum,maximum,range,memberlength,fileformat 2666 """ 2667 2668 buttontype = "none"
2669 -class BlenderUImember(BlenderUIcustombutton):
2670 """ 2671 Spyder-generated class 2672 2673 module blenderui 2674 2675 2676 file /home/sjoerd/data/Spyder-devel/blenderui/blenderui.spy 2677 2678 2679 2680 Wiki 2681 ==== 2682 U{http://www.spyderware.nl/wiki/classes/BlenderUImember} 2683 2684 Validate block 2685 ============== 2686 2687 >>> 2688 assert buttontype != "button" 2689 >>> 2690 2691 @ivar member: 2692 @type member: L{String} 2693 @ivar membertype: 2694 @type membertype: L{String} 2695 @sort: member,membertype 2696 """
2697
2698 -class BlenderUIcomplexmember(BlenderUIbutton):
2699 """ 2700 Spyder-generated class 2701 2702 module blenderui 2703 2704 2705 file /home/sjoerd/data/Spyder-devel/blenderui/blenderui.spy 2706 2707 2708 2709 Wiki 2710 ==== 2711 U{http://www.spyderware.nl/wiki/classes/BlenderUIcomplexmember} 2712 @ivar member: 2713 @type member: L{String} 2714 @ivar membertype: 2715 @type membertype: L{String} 2716 @ivar ele: 2717 @type ele: L{*BlenderUImember<BlenderUImember>} 2718 @sort: member,membertype,ele 2719 """
2720
2721 -class BlenderUI(object):
2722 """ 2723 Spyder-generated class 2724 2725 module blenderui 2726 2727 2728 file /home/sjoerd/data/Spyder-devel/blenderui/blenderui.spy 2729 2730 2731 2732 Wiki 2733 ==== 2734 U{http://www.spyderware.nl/wiki/classes/BlenderUI} 2735 2736 Validate block 2737 ============== 2738 2739 >>> 2740 numbers = [] 2741 for mb in list(members)+list(complexmembers)+list(custombuttons): 2742 if mb.nr in numbers: raise ValidationError 2743 numbers.append(mb.nr) 2744 >>> 2745 2746 @ivar spydertype: 2747 @type spydertype: L{String} 2748 @ivar xmargin: 2749 @type xmargin: L{Integer} 2750 @ivar lastcol_xsize: 2751 @type lastcol_xsize: L{Integer} 2752 @ivar lastcol_xmargin: 2753 @type lastcol_xmargin: L{Integer} 2754 @ivar lastcol_ysize: 2755 @type lastcol_ysize: L{Integer} 2756 @ivar complexmembers: 2757 @type complexmembers: L{BlenderUIcomplexmemberArray<BlenderUIcomplexmember>} 2758 @ivar members: 2759 @type members: L{BlenderUImemberArray<BlenderUImember>} 2760 @ivar custombuttons: 2761 @type custombuttons: L{BlenderUIcustombuttonArray<BlenderUIcustombutton>} 2762 @ivar frames: 2763 @type frames: L{BlenderUIbuttonArray<BlenderUIbutton>} 2764 @ivar labels: 2765 @type labels: L{BlenderUIbuttonArray<BlenderUIbutton>} 2766 @ivar nodraw: 2767 @type nodraw: L{Bool} 2768 @sort: spydertype,xmargin,lastcol_xsize,lastcol_xmargin,lastcol_ysize,complexmembers,members,custombuttons,frames,labels,nodraw 2769 """ 2770 2771 complexmembers = [] 2772 members = [] 2773 custombuttons = [] 2774 frames = [] 2775 labels = [] 2776 nodraw = False
2777
2778 -def clear():
2779 if initialized == False: initialize() 2780 return tarantula.Clear()
2781
2782 -class Color(object):
2783 """ 2784 Spyder-generated class 2785 2786 module tarantula 2787 2788 2789 file /home/sjoerd/Spyder-devel/tarantula/material.spy 2790 2791 2792 2793 Wiki 2794 ==== 2795 U{http://www.spyderware.nl/wiki/classes/Color} 2796 2797 Validate block 2798 ============== 2799 2800 >>> 2801 assert r >= 0 and r <= 255 2802 assert g >= 0 and g <= 255 2803 assert b >= 0 and b <= 255 2804 >>> 2805 2806 @ivar r: 2807 @type r: L{Integer} 2808 @ivar g: 2809 @type g: L{Integer} 2810 @ivar b: 2811 @type b: L{Integer} 2812 @sort: r,g,b 2813 """
2814
2815 -class NewMaterial(object):
2816 """ 2817 Spyder-generated class 2818 2819 module tarantula 2820 2821 2822 file /home/sjoerd/Spyder-devel/tarantula/material.spy 2823 2824 2825 2826 Description 2827 =========== 2828 2829 2830 2831 This class defines object materials 2832 2833 2834 A new material must be defined as NewMaterial 2835 2836 2837 and then show()'ed 2838 2839 2840 Within an object, its material can then be 2841 2842 2843 defined to as Material(name) 2844 2845 2846 Any material can be accessed as 2847 2848 2849 Spyder.tarantula.get_material(name) 2850 2851 2852 2853 2854 2855 Currently, only the color property is implemented 2856 2857 2858 Textures and transparency will be implemented soon 2859 2860 2861 2862 2863 2864 2865 Wiki 2866 ==== 2867 U{http://www.spyderware.nl/wiki/classes/NewMaterial} 2868 2869 Validate block 2870 ============== 2871 2872 >>> 2873 #assert color != None or texture != None ## will be enabled when textures are supported 2874 assert color != None 2875 >>> 2876 2877 2878 Form block 2879 ========== 2880 2881 >>> 2882 DEFAULT color (0,0,0) 2883 TYPE color required 2884 TYPE texture none 2885 TYPE transparency none 2886 >>> 2887 2888 2889 Converters 2890 ========== 2891 2892 Can be converted from: 2893 ---------------------- 2894 2895 - L{NewBlenderMaterial} 2896 - L{view converter (#4) <spyderconverterfunction_4>} 2897 2898 Registered methods: 2899 =================== 2900 2901 - show 2902 - L{register_newmaterial <register_newmaterial>} 2903 @ivar name: 2904 @type name: L{String} 2905 @ivar color: 2906 @type color: L{*Color<Color>} 2907 @ivar texture: 2908 @type texture: L{*Filename<Filename>} 2909 @ivar transparency: 2910 @type transparency: L{Float} 2911 @sort: name,color,texture,transparency 2912 """ 2913 2914 transparency = 0
2915 -class Material(String):
2916 """Parent class: L{String} 2917 2918 This class provides access to object materials 2919 See NewMaterial for more details 2920 """ 2921 @staticmethod
2922 - def typename(): return "Material"
2923 - def __init__(self, a):
2924 try: 2925 self.construct(a) 2926 except: 2927 if len(a) > 1: raise 2928 self.__parse__(a[0])
2929 - def cast(self,othertype):
2930 if type(othertype) == type(int): return othertype(self) 2931 return globals()[othertype](self)
2932 - def __getattr__(self, method):
2933 if method in self.values().__dict__: 2934 return self.values().__dict__[method] 2935 else: 2936 m = Spyder.Method(Material, method, self, globals()) 2937 return m
2938 - def convert(self, target):
2939 c = Spyder.Convert(Material, target, self, globals()) 2940 return c
2941 - def construct(self, value):
2942 try: 2943 v = get_material(value).name 2944 except: 2945 try: 2946 v = NewMaterial(value).name 2947 except: 2948 if not isinstance(value, str): raise 2949 v = value 2950 String.__new__(type(self), v)
2951 - def values(self):
2952 try: 2953 return get_material(self) 2954 except: 2955 return None
2956 - def __parse__(self, s):
2957 a = Spyder.Parse(s, "Spyder") 2958 if len(a) == 1: 2959 self.construct(a) 2960 elif len(a) == 2: 2961 self.construct(a[0])
2962
2963 -def renderPolygon(a):
2964 vertices = [] 2965 for v in a.vertices: 2966 #x = v.x * a.axis.x.x + v.y * a.axis.y.x + v.z * a.axis.z.x + a.axis.origin.x 2967 #y = v.x * a.axis.x.y + v.y * a.axis.y.y + v.z * a.axis.z.y + a.axis.origin.y 2968 #z = v.x * a.axis.x.z + v.y * a.axis.y.z + v.z * a.axis.z.z + a.axis.origin.z 2969 #vertices.append(Coordinate(x,y,z)) 2970 vertices.append(Coordinate(v*a.axis)) 2971 2972 p = [] 2973 for l in vertices: 2974 p += (l.x, l.y, l.z) 2975 pointlisttype = ctypes.c_double * len(p) 2976 pp = pointlisttype(*p) 2977 colortype = ctypes.c_ubyte * 3 2978 mat = get_material(a.material) 2979 color = colortype(mat.color.r, mat.color.g, mat.color.b) 2980 normal = calc_normal(vertices) 2981 normals = a.vertexnormals 2982 if normals == None: 2983 normals = [] 2984 for nr in range(len(vertices)): 2985 normals += (normal.x, normal.y, normal.z) 2986 normals = pointlisttype(*normals) 2987 __render(len(vertices), pp, normals, color)
2988
2989 -def renderObject(o, norender=False):
2990 #print [v for v in o.__conversionstack__ if type(v) == int] 2991 ptrs = prepare_renderObject(o) 2992 ptrs.append(norender) 2993 displaylist = __renderObject(*ptrs) 2994 return (displaylist, o.axis)
2995
2996 -def renderObjectArray(a, norender=False):
2997 ret = [] 2998 onr = 0 2999 if len(a) > 500: 3000 print "Please wait patiently while Spyder sends a list of %d objects to Tarantula..." % len(a) 3001 ptrs = [] 3002 axes = [] 3003 for o in a: 3004 o.__conversionstack__ = list(a.__conversionstack__) 3005 onr += 1 3006 if not onr % 500: print onr, "/", len(a) 3007 ptrs.append(prepare_renderObject(o)) 3008 axes.append(o.axis) 3009 newptrs = [len(ptrs)] 3010 for nr in range(len(ptrs[0])): 3011 p = [a[nr] for a in ptrs] 3012 p = (type(p[0]) * len(p))(*p) 3013 newptrs.append(p) 3014 newptrs.append(norender) 3015 ret0 = __renderObjectArray(*newptrs) 3016 ret = range(ret0,ret0+len(ptrs)) 3017 return zip(ret,axes)
3018
3019 -def axissystem_to_matrix(a):
3020 import ctypes 3021 axistype = ctypes.c_double * 16 3022 axis = [a.x.x,a.x.y,a.x.z,0, 3023 a.y.x,a.y.y,a.y.z,0, 3024 a.z.x,a.z.y,a.z.z,0, 3025 a.origin.x, a.origin.y, a.origin.z, 1] 3026 return ctypes.cast(axistype(*axis), ctypes.POINTER(ctypes.c_double))
3027
3028 -def renderDisplayList(d,norender=False):
3029 import ctypes 3030 axis = d.axis.matrix() 3031 axestype = ctypes.POINTER(ctypes.c_double) * 1 3032 axes = axestype(axis) 3033 __renderList(d.displaylist, axes,1,norender==False) 3034 return (d.displaylist, d.axis)
3035
3036 -def renderMultiDisplayList(md,norender=False):
3037 import ctypes 3038 if len(md.instances) == 0: return None 3039 axestype = ctypes.POINTER(ctypes.c_double) * len(md.instances) 3040 axes = [] 3041 for a in md.instances: axes.append(a.matrix()) 3042 axes = axestype(*axes) 3043 ret = __renderList(md.displaylist, axes,len(md.instances),norender==False) 3044 return (ret, AxisSystem())
3045
3046 #print list(lengths) 3047 -def makeBlock(b):
3048 if b.pivot == "center": 3049 minmax = (-1,1) 3050 sc = Coordinate(b.dimensions / 2) 3051 elif b.pivot == "corner": 3052 minmax = (0,1) 3053 sc = Coordinate(b.dimensions) 3054 vertices = [] 3055 for n in minmax: 3056 for nn in minmax: 3057 for nnn in minmax: 3058 vertices.append(Coordinate(sc.x*n, sc.y*nn,sc.z*nnn)) 3059 vertices = CoordinateArray(vertices) 3060 faces = [] 3061 #indices = ((0,1,3,2), (4,5,7,6), (0,4,5,1), (1,5,7,3), (3,7,6,2), (2,6,4,0)) 3062 indices = ((0,1,3,2), (4,6,7,5), (0,4,5,1), (1,5,7,3), (3,7,6,2), (2,6,4,0)) 3063 for n in range(0,6): 3064 vertices0 = indices[n] 3065 p = Face3D(vertices=vertices0) 3066 faces.append(p) 3067 o = Object3D(vertices=vertices, faces=faces,material=b.material, axis=b.axis) 3068 return o
3069
3070 -def drawCircle16(c): return drawCircle(c,16)
3071 -def drawCircle32(c): return drawCircle(c,32)
3072 -def drawCircle64(c): return drawCircle(c,64)
3073
3074 -def drawCylinder16(c): return drawCylinder(c,16)
3075 -def drawCylinder32(c): return drawCylinder(c,32)
3076 -def drawCylinder64(c): return drawCylinder(c,64)
3077
3078 -def untieObject(o):
3079 polygons = [] 3080 for p in o.faces: 3081 vertices = [] 3082 for v in p.vertices: 3083 vertices.append(o.vertices[v]) 3084 mat = p.material 3085 if mat == None: mat = o.material 3086 pp = Polygon(vertices, mat, o.axis, p.texturecoords, p.normal, p.vertexnormals) 3087 polygons.append(pp) 3088 return PolygonArray(polygons)
3089
3090 -def renderMultiInstance(mi, norender=False):
3091 dlist = make_displaylist(mi.object.show(norender=True)) 3092 axes = [] 3093 import ctypes 3094 for a in mi.instances: 3095 p = a.matrix() 3096 axes.append(p) 3097 if len(axes) > 0: 3098 axestype = ctypes.POINTER(ctypes.c_double) * len(axes) 3099 axes2 = axestype(*axes) 3100 ret = __renderList(dlist, axes2,len(axes),int(norender==False)) 3101 else: 3102 ret = -1 3103 return ret, AxisSystem()
3104
3105 -def renderObjectGroup(og, norender=False):
3106 dlist = make_displaylist(og.group.show(norender=True)) 3107 import ctypes 3108 axestype = ctypes.POINTER(ctypes.c_double) * 1 3109 axes = axestype(og.axis.matrix()) 3110 ret = __renderList(dlist, axes,1,int(norender==False)) 3111 return ret, AxisSystem()
3112
3113 -def register_newmaterial(mat,*args,**kargs):
3114 assert mat.typename() == "NewMaterial" 3115 if mat.name == None: mat.name = generate_material_name() 3116 _materials[mat.name] = mat 3117 return mat.name
3118
3119 -def get_material(name):
3120 if name not in _materials: return None 3121 return _materials[name]
3122
3123 -class World3D(object):
3124 """ 3125 Spyder-generated class 3126 3127 module tarantula 3128 3129 3130 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 3131 3132 3133 3134 Description 3135 =========== 3136 3137 3138 3139 Class to store 3D objects in a self-contained way 3140 3141 3142 Contains a list of Tarantula objects 3143 3144 3145 and a list of the materials used by those objects 3146 3147 3148 Every object should be Tarantula-compatible, 3149 3150 3151 i.e. the show() method should work on it, 3152 3153 3154 but this is not validated beforehand. 3155 3156 3157 3158 3159 3160 3161 Wiki 3162 ==== 3163 U{http://www.spyderware.nl/wiki/classes/World3D} 3164 3165 Form block 3166 ========== 3167 3168 >>> 3169 BLENDER 3170 DEFAULT objects [] 3171 DEFAULT materials [] 3172 >>> 3173 3174 3175 Registered methods: 3176 =================== 3177 3178 - show 3179 - L{worldshow <worldshow>} 3180 @ivar materials: 3181 @type materials: L{NewMaterialArray<NewMaterial>} 3182 @ivar objects: 3183 @type objects: L{ObjectList3D} 3184 @sort: materials,objects 3185 """ 3186 3187 @staticmethod
3188 - def three_dimensional(): return True
3189 -def worldshow(w,show=True):
3190 """Calls show() on every material and then on every object in the World3D""" 3191 for m in w.materials: m.show(show) 3192 return w.objects.show(show=show)
3193 """Method show(World3D) worldshow 3194 """
3195 -class Coordinate2D(object):
3196 """ 3197 Spyder-generated class 3198 3199 module tarantula 3200 3201 3202 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 3203 3204 3205 3206 Wiki 3207 ==== 3208 U{http://www.spyderware.nl/wiki/classes/Coordinate2D} 3209 3210 Form block 3211 ========== 3212 3213 >>> 3214 DEFAULT x 0 3215 RANGE x 2 3216 DEFAULT y 0 3217 RANGE y 2 3218 >>> 3219 3220 @ivar x: 3221 @type x: L{Float} 3222 @ivar y: 3223 @type y: L{Float} 3224 @sort: x,y 3225 """
3226
3227 -class Coordinate(object):
3228 """ 3229 Spyder-generated class 3230 3231 module tarantula 3232 3233 3234 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 3235 3236 3237 3238 Description 3239 =========== 3240 3241 3242 3243 Class for 3D (x,y,z) coordinates. 3244 3245 3246 Coordinates are interpreted as x = right, y = up, z = towards the viewer 3247 3248 3249 3250 3251 3252 3253 Wiki 3254 ==== 3255 U{http://www.spyderware.nl/wiki/classes/Coordinate} 3256 3257 Form block 3258 ========== 3259 3260 >>> 3261 DEFAULT x 0 3262 RANGE x 2 3263 DEFAULT y 0 3264 RANGE y 2 3265 DEFAULT z 0 3266 RANGE z 2 3267 >>> 3268 3269 3270 Converters 3271 ========== 3272 3273 Can be converted to: 3274 -------------------- 3275 3276 - L{Vector} 3277 - L{Coordinate.normalize <Coordinate.normalize>} 3278 3279 - L{Vector} 3280 - L{view converter (#6) <spyderconverterfunction_6>} 3281 @ivar x: 3282 @type x: L{Float} 3283 @ivar y: 3284 @type y: L{Float} 3285 @ivar z: 3286 @type z: L{Float} 3287 @sort: x,y,z 3288 """ 3289
3290 - def __mul__(self, a):
3291 """Multiplication with either: 3292 a Float (scaling) 3293 a Coordinate (dot product) 3294 or an AxisSystem (vector-matrix multiplication) 3295 """ 3296 types = (Float, Coordinate, AxisSystem) 3297 for t in types: 3298 try: 3299 a = t(a) 3300 except: 3301 continue 3302 break 3303 else: 3304 raise TypeError("Unknown type") 3305 if t == Float: #scale 3306 return Coordinate(a*self.x,a*self.y, a*self.z) 3307 elif t == Coordinate: #dot product 3308 return a.x*self.x+a.y*self.y+a.z*self.z 3309 elif t == AxisSystem: #vector-matrix multiplication 3310 ret = Coordinate(a.origin) 3311 ret += self.x * a.x 3312 ret += self.y * a.y 3313 ret += self.z * a.z 3314 return ret
3315 - def __rmul__(self, a):
3316 """Inline multiplication""" 3317 return self * a
3318 - def __div__(self, a):
3319 """Division by Float: equivalent to 1/a multiplication""" 3320 a = Float(a) 3321 return self * (1/a)
3322 - def __rdiv__(self, a):
3323 """Inline division by Float""" 3324 a = Float(a) 3325 return self * (1/a)
3326 - def size(self):
3327 """The scalar length of the Coordinate""" 3328 return sqrt(self.x**2+self.y**2+self.z**2)
3329 - def normalize(self):
3330 """Re-scale the Coordinate length to 1 3331 , returns Vector""" 3332 v = Coordinate(self) 3333 size = v.size() 3334 if size > 0: v /= size 3335 else: v = (1,0,0) 3336 return Vector(v)
3337 - def crossproduct(self, v):
3338 """Returns a Coordinate perpendicular both to this one and to v""" 3339 v = Coordinate(v) 3340 x = self.y * v.z - self.z * v.y 3341 y = self.z * v.x - self.x * v.z 3342 z = self.x * v.y - self.y * v.x 3343 return Coordinate(x,y,z).normalize()
3344 - def __xor__(self,v): ## ^, cross product
3345 """Symbol ^, equivalent to crossproduct""" 3346 return self.crossproduct(v)
3347 - def __neg__(self):
3348 """Negation, returns -self""" 3349 return type(self)(-self.x,-self.y,-self.z)
3350 - def __add__(self, a):
3351 """Addition of another Coordinate""" 3352 a = Coordinate(a) 3353 return Coordinate(self.x+a.x, self.y+a.y, self.z+a.z)
3354 - def __iadd__(self,a):
3355 """Inline addition""" 3356 self = type(self)(self + a) 3357 return self
3358 - def __sub__(self,a):
3359 """Subtraction of another Coordinate""" 3360 return self + -a
3361 - def __isub__(self,a):
3362 """Inline subtraction""" 3363 self = type(self)(self - a) 3364 return self
3365 -class Vector(Coordinate):
3366 """ 3367 Spyder-generated class 3368 3369 module tarantula 3370 3371 3372 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 3373 3374 3375 3376 Description 3377 =========== 3378 3379 3380 3381 Fork of Coordinate that ensures a length of 1 3382 3383 3384 3385 Wiki 3386 ==== 3387 U{http://www.spyderware.nl/wiki/classes/Vector} 3388 3389 Validate block 3390 ============== 3391 3392 >>> 3393 assert abs(x**2+y**2+z**2 - 1) < 0.001 3394 >>> 3395 3396 3397 Form block 3398 ========== 3399 3400 >>> 3401 MIN x -1 3402 MAX x 1 3403 DEFAULT x 0 3404 MIN y -1 3405 MAX y 1 3406 DEFAULT y 0 3407 MIN z -1 3408 MAX z 1 3409 DEFAULT z 0 3410 >>> 3411 3412 3413 Converters 3414 ========== 3415 3416 Can be converted from: 3417 ---------------------- 3418 3419 - L{Coordinate} 3420 - L{Coordinate.normalize <Coordinate.normalize>} 3421 3422 - L{Coordinate} 3423 - L{view converter (#6) <spyderconverterfunction_6>} 3424 @ivar (form): 3425 @type (form): Delete 3426 @sort: form 3427 """ 3428
3429 - def __mul__(self, a):
3430 """Multiplication with either: 3431 a Float (scaling) 3432 a Coordinate (dot product) 3433 or an AxisSystem (vector-matrix multiplication) 3434 """ 3435 types = (Float, Coordinate, AxisSystem) 3436 for t in types: 3437 try: 3438 a = t(a) 3439 except: 3440 continue 3441 break 3442 else: 3443 raise TypeError("Unknown type") 3444 if t == Float: #scale 3445 return Coordinate(a*self.x,a*self.y, a*self.z) 3446 elif t == Coordinate: #dot product 3447 return a.x*self.x+a.y*self.y+a.z*self.z 3448 elif t == AxisSystem: #vector-matrix multiplication 3449 ret = Coordinate(a.origin) 3450 ret += self.x * a.x 3451 ret += self.y * a.y 3452 ret += self.z * a.z 3453 return ret
3454 - def __rmul__(self, a):
3455 """Inline multiplication""" 3456 return self * a
3457 - def __div__(self, a):
3458 """Division by Float: equivalent to 1/a multiplication""" 3459 a = Float(a) 3460 return self * (1/a)
3461 - def __rdiv__(self, a):
3462 """Inline division by Float""" 3463 a = Float(a) 3464 return self * (1/a)
3465 - def size(self):
3466 """The scalar length of the Coordinate""" 3467 return sqrt(self.x**2+self.y**2+self.z**2)
3468 - def normalize(self):
3469 """Re-scale the Coordinate length to 1 3470 , returns Vector""" 3471 v = Coordinate(self) 3472 size = v.size() 3473 if size > 0: v /= size 3474 else: v = (1,0,0) 3475 return Vector(v)
3476 - def crossproduct(self, v):
3477 """Returns a Coordinate perpendicular both to this one and to v""" 3478 v = Coordinate(v) 3479 x = self.y * v.z - self.z * v.y 3480 y = self.z * v.x - self.x * v.z 3481 z = self.x * v.y - self.y * v.x 3482 return Coordinate(x,y,z).normalize()
3483 - def __xor__(self,v): ## ^, cross product
3484 """Symbol ^, equivalent to crossproduct""" 3485 return self.crossproduct(v)
3486 - def __neg__(self):
3487 """Negation, returns -self""" 3488 return type(self)(-self.x,-self.y,-self.z)
3489 - def __add__(self, a):
3490 """Addition of another Coordinate""" 3491 a = Coordinate(a) 3492 return Coordinate(self.x+a.x, self.y+a.y, self.z+a.z)
3493 - def __iadd__(self,a):
3494 """Inline addition""" 3495 self = type(self)(self + a) 3496 return self
3497 - def __sub__(self,a):
3498 """Subtraction of another Coordinate""" 3499 return self + -a
3500 - def __isub__(self,a):
3501 """Inline subtraction""" 3502 self = type(self)(self - a) 3503 return self
3504 -class AxisSystem(object):
3505 """ 3506 Spyder-generated class 3507 3508 module tarantula 3509 3510 3511 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 3512 3513 3514 3515 Description 3516 =========== 3517 3518 3519 3520 Implementation of a coordinate system 3521 3522 3523 consisting of an origin and x,y and z axes 3524 3525 3526 3527 3528 3529 3530 Wiki 3531 ==== 3532 U{http://www.spyderware.nl/wiki/classes/AxisSystem} 3533 3534 Registered methods: 3535 =================== 3536 3537 - matrix 3538 - L{axissystem_to_matrix <axissystem_to_matrix>} 3539 @ivar origin: 3540 @type origin: L{Coordinate} 3541 @ivar x: 3542 @type x: L{Coordinate} 3543 @ivar y: 3544 @type y: L{Coordinate} 3545 @ivar z: 3546 @type z: L{Coordinate} 3547 @sort: origin,x,y,z 3548 """ 3549
3550 - def __mul__(self,a):
3551 """Multiplication with either: 3552 a Float (scaling) 3553 a Coordinate (vector-matrix multiplication) 3554 or an AxisSystem (matrix-matrix multiplication) 3555 """ 3556 types = (Float, Coordinate, AxisSystem) 3557 for t in types: 3558 try: 3559 a = t(a) 3560 except: 3561 continue 3562 break 3563 else: 3564 raise TypeError("Unknown type") 3565 if t == Float: 3566 ret = AxisSystem(self.origin, self.x*a, self.y*a, self.z*a) 3567 return ret 3568 if t == Coordinate: 3569 return t * self 3570 if t == AxisSystem: 3571 ret = AxisSystem() 3572 b = self 3573 ret.x = a.x * b.x.x + a.y * b.x.y + a.z * b.x.z 3574 ret.y = a.x * b.y.x + a.y * b.y.y + a.z * b.y.z 3575 ret.z = a.x * b.z.x + a.y * b.z.y + a.z * b.z.z 3576 ret.origin = a.x * b.origin.x + a.y * b.origin.y + a.z * b.origin.z + a.origin 3577 return ret
3578 - def rotateAxis(self, axis ,ang, full=False):
3579 """Rotate around an arbitrary axis by an angle in degrees 3580 if full == True, rotate the axis origin as well """ 3581 a = Coordinate(axis).normalize() 3582 x, y, z = a.x, a.y, a.z 3583 radang = ang/180.0 * pi 3584 c = cos(radang) 3585 s = sin(radang) 3586 t = 1 - c 3587 v1,v2,v3 = (Vector(t*x*x+c, t*x*y-s*z, t*x*z+s*y), 3588 Vector(t*y*x+s*z, t*y*y+c, t*y*z-s*x), 3589 Vector(t*x*z-s*y, t*y*z+s*x, t*z*z+c)) 3590 mat = AxisSystem((0,0,0),v1,v2,v3) 3591 ret = self * mat 3592 self.x,self.y,self.z = ret.x,ret.y,ret.z 3593 return self
3594 - def rotateX(self,ang):
3595 """Rotate around the global X axis by an angle in degrees""" 3596 return self.rotateAxis((1,0,0),ang)
3597 - def rotateY(self,ang):
3598 """Rotate around the global Y axis by an angle in degrees""" 3599 return self.rotateAxis((0,1,0),ang)
3600 - def rotateZ(self,ang):
3601 """Rotate around the global Z axis by an angle in degrees""" 3602 return self.rotateAxis((0,0,1),ang)
3603 - def rotateXFull(self,ang):
3604 """Rotate around the global X axis by an angle in degrees 3605 and rotate the axis origin as well""" 3606 return self.rotateAxis((1,0,0),ang,True)
3607 - def rotateYFull(self,ang):
3608 """Rotate around the global Y axis by an angle in degrees 3609 and rotate the axis origin as well""" 3610 return self.rotateAxis((0,1,0),ang,True)
3611 - def rotateZFull(self,ang):
3612 """Rotate around the global Z axis by an angle in degrees 3613 and rotate the axis origin as well""" 3614 return self.rotateAxis((0,0,1),ang,True)
3615 - def rotateLocalX(self,ang):
3616 """Rotate around the local X axis by an angle in degrees""" 3617 return self.rotateAxis(self.x,ang)
3618 - def rotateLocalY(self,ang):
3619 """Rotate around the local Y axis by an angle in degrees""" 3620 return self.rotateAxis(self.y,ang)
3621 - def rotateLocalZ(self,ang):
3622 """Rotate around the local Z axis by an angle in degrees""" 3623 return self.rotateAxis(self.z,ang)
3624 - def rotateLocalXFull(self,ang):
3625 """Rotate around the local X axis by an angle in degrees 3626 and rotate the axis origin as well""" 3627 return self.rotateAxis(self.x,ang,True)
3628 - def rotateLocalYFull(self,ang):
3629 """Rotate around the local Y axis by an angle in degrees 3630 and rotate the axis origin as well""" 3631 return self.rotateAxis(self.y,ang,True)
3632 - def rotateLocalZFull(self,ang):
3633 """Rotate around the local Z axis by an angle in degrees 3634 and rotate the axis origin as well""" 3635 return self.rotateAxis(self.z,ang,True) 3636 origin = (0,0,0) 3637 x = (1,0,0) 3638 y = (0,1,0) 3639 z = (0,0,1)
3640 -class Edge3D(object):
3641 """ 3642 Spyder-generated class 3643 3644 module tarantula 3645 3646 3647 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 3648 3649 3650 3651 Description 3652 =========== 3653 3654 3655 3656 Edge class, should be part of a class that defines vertices 3657 3658 3659 Consists of two vertex indices and a crease parameter 3660 3661 3662 A higher crease parameter indicates edge sharpness 3663 3664 3665 3666 3667 3668 3669 Wiki 3670 ==== 3671 U{http://www.spyderware.nl/wiki/classes/Edge3D} 3672 3673 Validate block 3674 ============== 3675 3676 >>> 3677 assert crease >= 0 and crease < 256 3678 >>> 3679 3680 @ivar v1: 3681 @type v1: L{Integer} 3682 @ivar v2: 3683 @type v2: L{Integer} 3684 @ivar crease: 3685 @type crease: L{Integer} 3686 @sort: v1,v2,crease 3687 """ 3688 3689 crease = 0
3690 -class Face3D(object):
3691 """ 3692 Spyder-generated class 3693 3694 module tarantula 3695 3696 3697 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 3698 3699 3700 3701 Description 3702 =========== 3703 3704 3705 3706 Face class, should be part of a class that defines vertices and materials 3707 3708 3709 Material definition is optional; 3710 3711 3712 if none is defined, the material of the parent class should be used 3713 3714 3715 Looking from the outside, vertices should be specified counter-clockwise 3716 3717 3718 If specified, the normal should point inward 3719 3720 3721 Normals for every vertex can be specified, too (for smooth lighting) 3722 3723 3724 Texture coordinates are not yet implemented in Tarantula 3725 3726 3727 3728 3729 3730 3731 Wiki 3732 ==== 3733 U{http://www.spyderware.nl/wiki/classes/Face3D} 3734 3735 Length block 3736 ============ 3737 3738 >>> 3739 return len(vertices) 3740 >>> 3741 3742 3743 Validate block 3744 ============== 3745 3746 >>> 3747 assert texturecoords == None or len(texturecoords) == len(vertices) 3748 assert vertexnormals == None or len(vertexnormals) == len(vertices) 3749 >>> 3750 3751 @ivar vertices: 3752 @type vertices: L{IntegerArray<Integer>} 3753 @ivar material: 3754 @type material: L{*Material<Material>} 3755 @ivar texturecoords: 3756 @type texturecoords: L{*Coordinate2DArray<Coordinate2D>} 3757 @ivar normal: 3758 @type normal: L{*Vector<Vector>} 3759 @ivar vertexnormals: 3760 @type vertexnormals: L{*VectorArray<Vector>} 3761 @sort: vertices,material,texturecoords,normal,vertexnormals 3762 """ 3763 3764 vertices = []
3765 -class Polygon(object):
3766 """ 3767 Spyder-generated class 3768 3769 module tarantula 3770 3771 3772 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 3773 3774 3775 3776 Description 3777 =========== 3778 3779 3780 3781 Self-contained class for polygon data 3782 3783 3784 Looking from the outside, vertices should be specified counter-clockwise 3785 3786 3787 If specified, the normal should point inward 3788 3789 3790 Normals for every vertex can be specified, too (for smooth lighting) 3791 3792 3793 If a material other than "defaultmaterial" is used, 3794 3795 3796 it must be elsewhere defined and show()'ed as a NewMaterial 3797 3798 3799 Texture coordinates are not yet implemented in Tarantula 3800 3801 3802 3803 3804 3805 3806 Wiki 3807 ==== 3808 U{http://www.spyderware.nl/wiki/classes/Polygon} 3809 3810 Length block 3811 ============ 3812 3813 >>> 3814 return len(vertices) 3815 >>> 3816 3817 3818 Validate block 3819 ============== 3820 3821 >>> 3822 assert texturecoords == None or len(texturecoords) == len(vertices) 3823 assert vertexnormals == None or len(vertexnormals) == len(vertices) 3824 >>> 3825 3826 3827 Converters 3828 ========== 3829 3830 Can be converted to: 3831 -------------------- 3832 3833 - L{Polygon} (converts from PolygonArray) 3834 - SPLIT 3835 3836 Can be converted from: 3837 ---------------------- 3838 3839 - L{Object3D} (converts to PolygonArray) 3840 - L{untieObject <untieObject>} 3841 3842 - L{PolygonArray<Polygon>} 3843 - SPLIT 3844 3845 Registered methods: 3846 =================== 3847 3848 - show 3849 - L{renderPolygon <renderPolygon>} 3850 @ivar vertices: 3851 @type vertices: L{CoordinateArray<Coordinate>} 3852 @ivar material: 3853 @type material: L{Material} 3854 @ivar axis: 3855 @type axis: L{AxisSystem} 3856 @ivar texturecoords: 3857 @type texturecoords: L{*CoordinateArray<Coordinate>} 3858 @ivar normal: 3859 @type normal: L{*Vector<Vector>} 3860 @ivar vertexnormals: 3861 @type vertexnormals: L{*VectorArray<Vector>} 3862 @sort: vertices,material,axis,texturecoords,normal,vertexnormals 3863 """ 3864 3865 @staticmethod
3866 - def three_dimensional(): return True
3867 material = "defaultmaterial" 3868 axis = AxisSystem()
3869 -class Vertex(Coordinate):
3870 """ 3871 Spyder-generated class 3872 3873 module tarantula 3874 3875 3876 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 3877 3878 3879 3880 Wiki 3881 ==== 3882 U{http://www.spyderware.nl/wiki/classes/Vertex} 3883 @ivar texturecoords: 3884 @type texturecoords: L{*Coordinate2D<Coordinate2D>} 3885 @sort: texturecoords 3886 """ 3887
3888 - def __mul__(self, a):
3889 """Multiplication with either: 3890 a Float (scaling) 3891 a Coordinate (dot product) 3892 or an AxisSystem (vector-matrix multiplication) 3893 """ 3894 types = (Float, Coordinate, AxisSystem) 3895 for t in types: 3896 try: 3897 a = t(a) 3898 except: 3899 continue 3900 break 3901 else: 3902 raise TypeError("Unknown type") 3903 if t == Float: #scale 3904 return Coordinate(a*self.x,a*self.y, a*self.z) 3905 elif t == Coordinate: #dot product 3906 return a.x*self.x+a.y*self.y+a.z*self.z 3907 elif t == AxisSystem: #vector-matrix multiplication 3908 ret = Coordinate(a.origin) 3909 ret += self.x * a.x 3910 ret += self.y * a.y 3911 ret += self.z * a.z 3912 return ret
3913 - def __rmul__(self, a):
3914 """Inline multiplication""" 3915 return self * a
3916 - def __div__(self, a):
3917 """Division by Float: equivalent to 1/a multiplication""" 3918 a = Float(a) 3919 return self * (1/a)
3920 - def __rdiv__(self, a):
3921 """Inline division by Float""" 3922 a = Float(a) 3923 return self * (1/a)
3924 - def size(self):
3925 """The scalar length of the Coordinate""" 3926 return sqrt(self.x**2+self.y**2+self.z**2)
3927 - def normalize(self):
3928 """Re-scale the Coordinate length to 1 3929 , returns Vector""" 3930 v = Coordinate(self) 3931 size = v.size() 3932 if size > 0: v /= size 3933 else: v = (1,0,0) 3934 return Vector(v)
3935 - def crossproduct(self, v):
3936 """Returns a Coordinate perpendicular both to this one and to v""" 3937 v = Coordinate(v) 3938 x = self.y * v.z - self.z * v.y 3939 y = self.z * v.x - self.x * v.z 3940 z = self.x * v.y - self.y * v.x 3941 return Coordinate(x,y,z).normalize()
3942 - def __xor__(self,v): ## ^, cross product
3943 """Symbol ^, equivalent to crossproduct""" 3944 return self.crossproduct(v)
3945 - def __neg__(self):
3946 """Negation, returns -self""" 3947 return type(self)(-self.x,-self.y,-self.z)
3948 - def __add__(self, a):
3949 """Addition of another Coordinate""" 3950 a = Coordinate(a) 3951 return Coordinate(self.x+a.x, self.y+a.y, self.z+a.z)
3952 - def __iadd__(self,a):
3953 """Inline addition""" 3954 self = type(self)(self + a) 3955 return self
3956 - def __sub__(self,a):
3957 """Subtraction of another Coordinate""" 3958 return self + -a
3959 - def __isub__(self,a):
3960 """Inline subtraction""" 3961 self = type(self)(self - a) 3962 return self
3963 -class Object3D(object):
3964 """ 3965 Spyder-generated class 3966 3967 module tarantula 3968 3969 3970 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 3971 3972 3973 3974 Description 3975 =========== 3976 3977 3978 3979 Self-contained class for 3D object (mesh) data 3980 3981 3982 Every face contains indices that point to a vertex in "vertices" 3983 3984 3985 If a material other than "defaultmaterial" is used, 3986 3987 3988 it must be elsewhere defined and show()'ed as a NewMaterial 3989 3990 3991 Edge specification is fully optional 3992 3993 3994 3995 3996 3997 3998 Wiki 3999 ==== 4000 U{http://www.spyderware.nl/wiki/classes/Object3D} 4001 4002 Validate block 4003 ============== 4004 4005 >>> 4006 if lighting != None: assert lighting in ("smooth", "flat") 4007 >>> 4008 4009 4010 Form block 4011 ========== 4012 4013 >>> 4014 OPTION lighting "smooth", "flat" 4015 >>> 4016 4017 4018 Converters 4019 ========== 4020 4021 Can be converted to: 4022 -------------------- 4023 4024 - L{Object3D} (converts from Object3DArray) 4025 - SPLIT 4026 4027 - L{PolygonArray<Polygon>} 4028 - L{untieObject <untieObject>} 4029 4030 - L{BlenderMesh} 4031 - L{view converter (#1) <spyderconverterfunction_1>} 4032 4033 Can be converted from: 4034 ---------------------- 4035 4036 - L{Circle16} 4037 - L{drawCircle16 <drawCircle16>} 4038 4039 - L{Circle32} 4040 - L{drawCircle32 <drawCircle32>} 4041 4042 - L{Circle64} 4043 - L{drawCircle64 <drawCircle64>} 4044 4045 - L{Cylinder16} 4046 - L{drawCylinder16 <drawCylinder16>} 4047 4048 - L{Cylinder32} 4049 - L{drawCylinder32 <drawCylinder32>} 4050 4051 - L{Cylinder64} 4052 - L{drawCylinder64 <drawCylinder64>} 4053 4054 - L{Object3DArray<Object3D>} 4055 - SPLIT 4056 4057 - L{Block3D} 4058 - L{makeBlock <makeBlock>} 4059 4060 - L{MultiInstance3D} (converts to Object3DArray) 4061 - L{view converter (#7) <spyderconverterfunction_7>} 4062 4063 - L{RubikSnake} 4064 - L{view converter (#23) <spyderconverterfunction_23>} 4065 4066 - L{Bolt3D} 4067 - L{view converter (#24) <spyderconverterfunction_24>} 4068 4069 - L{Pillar3D} (converts to Object3DArray) 4070 - L{view converter (#27) <spyderconverterfunction_27>} 4071 4072 - L{POrbital} 4073 - L{view converter (#28) <spyderconverterfunction_28>} 4074 4075 - L{CoordinateGrid2D} 4076 - L{view converter (#30) <spyderconverterfunction_30>} 4077 4078 - L{Pyramid} 4079 - L{view converter (#32) <spyderconverterfunction_32>} 4080 4081 - L{Sphere3D} 4082 - L{view converter (#34) <spyderconverterfunction_34>} 4083 4084 - L{Chunk3D} 4085 - L{view converter (#36) <spyderconverterfunction_36>} 4086 4087 Registered methods: 4088 =================== 4089 4090 - show 4091 - L{renderObject <renderObject>} 4092 4093 - show (registered for Object3DArray) 4094 - L{renderObjectArray <renderObjectArray>} 4095 @ivar vertices: 4096 @type vertices: L{VertexArray<Vertex>} 4097 @ivar faces: 4098 @type faces: L{Face3DArray<Face3D>} 4099 @ivar material: 4100 @type material: L{Material} 4101 @ivar axis: 4102 @type axis: L{AxisSystem} 4103 @ivar edges: 4104 @type edges: L{Edge3DArray<Edge3D>} 4105 @ivar lighting: 4106 @type lighting: L{String} 4107 @sort: vertices,faces,material,axis,edges,lighting 4108 """ 4109 4110 @staticmethod
4111 - def three_dimensional(): return True
4112 vertices = [] 4113 faces = [] 4114 material = "defaultmaterial" 4115 axis = AxisSystem() 4116 edges = [] 4117 lighting = "flat"
4118 -class Block3D(object):
4119 """ 4120 Spyder-generated class 4121 4122 module tarantula 4123 4124 4125 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 4126 4127 4128 4129 Description 4130 =========== 4131 4132 4133 4134 Class for rectangular blocks 4135 4136 4137 4138 Wiki 4139 ==== 4140 U{http://www.spyderware.nl/wiki/classes/Block3D} 4141 4142 Validate block 4143 ============== 4144 4145 >>> 4146 if pivot != None: assert pivot in ("center", "corner") 4147 >>> 4148 4149 4150 Form block 4151 ========== 4152 4153 >>> 4154 OPTION pivot "center", "corner" 4155 BLENDER 4156 MATRIX axis 4157 DEFAULT dimensions Coordinate(1,1,1) 4158 >>> 4159 4160 4161 Converters 4162 ========== 4163 4164 Can be converted to: 4165 -------------------- 4166 4167 - L{Block3D} (converts from Block3DArray) 4168 - SPLIT 4169 4170 - L{Object3D} 4171 - L{makeBlock <makeBlock>} 4172 4173 Can be converted from: 4174 ---------------------- 4175 4176 - L{Block3DArray<Block3D>} 4177 - SPLIT 4178 4179 - L{SphereCloud3D} (converts to Block3DArray) 4180 - L{view converter (#35) <spyderconverterfunction_35>} 4181 @ivar dimensions: 4182 @type dimensions: L{Coordinate} 4183 @ivar material: 4184 @type material: L{Material} 4185 @ivar axis: 4186 @type axis: L{AxisSystem} 4187 @ivar pivot: 4188 @type pivot: L{String} 4189 @sort: dimensions,material,axis,pivot 4190 """ 4191 4192 @staticmethod
4193 - def three_dimensional(): return True
4194 material = "defaultmaterial" 4195 axis = AxisSystem() 4196 pivot = "center"
4197 -class Circle(object):
4198 """ 4199 Spyder-generated class 4200 4201 module tarantula 4202 4203 4204 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 4205 4206 4207 4208 Wiki 4209 ==== 4210 U{http://www.spyderware.nl/wiki/classes/Circle} 4211 4212 Converters 4213 ========== 4214 4215 Can be converted to: 4216 -------------------- 4217 4218 - L{Circle64} 4219 - CAST 4220 @ivar radius: 4221 @type radius: L{Float} 4222 @ivar origin: 4223 @type origin: L{Coordinate} 4224 @ivar material: 4225 @type material: L{Material} 4226 @ivar normal: 4227 @type normal: L{Vector} 4228 @sort: radius,origin,material,normal 4229 """ 4230 4231 @staticmethod
4232 - def three_dimensional(): return True
4233 material = "defaultmaterial" 4234 normal = (0,0,1)
4235 -class Circle16(Circle):
4236 """ 4237 Spyder-generated class 4238 4239 module tarantula 4240 4241 4242 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 4243 4244 4245 4246 Wiki 4247 ==== 4248 U{http://www.spyderware.nl/wiki/classes/Circle16} 4249 4250 Converters 4251 ========== 4252 4253 Can be converted to: 4254 -------------------- 4255 4256 - L{Object3D} 4257 - L{drawCircle16 <drawCircle16>} 4258 @sort: 4259 """ 4260 4261 @staticmethod
4262 - def three_dimensional(): return True
4263 -class Circle32(Circle):
4264 """ 4265 Spyder-generated class 4266 4267 module tarantula 4268 4269 4270 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 4271 4272 4273 4274 Wiki 4275 ==== 4276 U{http://www.spyderware.nl/wiki/classes/Circle32} 4277 4278 Converters 4279 ========== 4280 4281 Can be converted to: 4282 -------------------- 4283 4284 - L{Object3D} 4285 - L{drawCircle32 <drawCircle32>} 4286 @sort: 4287 """ 4288 4289 @staticmethod
4290 - def three_dimensional(): return True
4291 -class Circle64(Circle):
4292 """ 4293 Spyder-generated class 4294 4295 module tarantula 4296 4297 4298 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 4299 4300 4301 4302 Wiki 4303 ==== 4304 U{http://www.spyderware.nl/wiki/classes/Circle64} 4305 4306 Converters 4307 ========== 4308 4309 Can be converted to: 4310 -------------------- 4311 4312 - L{Object3D} 4313 - L{drawCircle64 <drawCircle64>} 4314 4315 Can be converted from: 4316 ---------------------- 4317 4318 - L{Circle} 4319 - CAST 4320 @sort: 4321 """ 4322 4323 @staticmethod
4324 - def three_dimensional(): return True
4325 -class Cylinder(object):
4326 """ 4327 Spyder-generated class 4328 4329 module tarantula 4330 4331 4332 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 4333 4334 4335 4336 Description 4337 =========== 4338 4339 4340 4341 Defines a cylinder with its symmetry axis defined as axis.z 4342 4343 4344 and going through axis.origin 4345 4346 4347 The cylinder can be scaled using radius and height, 4348 4349 4350 or by scaling axis.x/y/z 4351 4352 4353 4354 4355 4356 4357 Wiki 4358 ==== 4359 U{http://www.spyderware.nl/wiki/classes/Cylinder} 4360 4361 Converters 4362 ========== 4363 4364 Can be converted to: 4365 -------------------- 4366 4367 - L{Cylinder32} 4368 - CAST 4369 @ivar radius: 4370 @type radius: L{Float} 4371 @ivar height: 4372 @type height: L{Float} 4373 @ivar axis: 4374 @type axis: L{AxisSystem} 4375 @ivar material: 4376 @type material: L{Material} 4377 @sort: radius,height,axis,material 4378 """ 4379 4380 @staticmethod
4381 - def three_dimensional(): return True
4382 axis = AxisSystem() 4383 material = "defaultmaterial"
4384 -class Cylinder16(Cylinder):
4385 """ 4386 Spyder-generated class 4387 4388 module tarantula 4389 4390 4391 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 4392 4393 4394 4395 Wiki 4396 ==== 4397 U{http://www.spyderware.nl/wiki/classes/Cylinder16} 4398 4399 Converters 4400 ========== 4401 4402 Can be converted to: 4403 -------------------- 4404 4405 - L{Object3D} 4406 - L{drawCylinder16 <drawCylinder16>} 4407 @sort: 4408 """ 4409 4410 @staticmethod
4411 - def three_dimensional(): return True
4412 -class Cylinder32(Cylinder):
4413 """ 4414 Spyder-generated class 4415 4416 module tarantula 4417 4418 4419 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 4420 4421 4422 4423 Wiki 4424 ==== 4425 U{http://www.spyderware.nl/wiki/classes/Cylinder32} 4426 4427 Converters 4428 ========== 4429 4430 Can be converted to: 4431 -------------------- 4432 4433 - L{Object3D} 4434 - L{drawCylinder32 <drawCylinder32>} 4435 4436 Can be converted from: 4437 ---------------------- 4438 4439 - L{Cylinder} 4440 - CAST 4441 @sort: 4442 """ 4443 4444 @staticmethod
4445 - def three_dimensional(): return True
4446 -class Cylinder64(Cylinder):
4447 """ 4448 Spyder-generated class 4449 4450 module tarantula 4451 4452 4453 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 4454 4455 4456 4457 Wiki 4458 ==== 4459 U{http://www.spyderware.nl/wiki/classes/Cylinder64} 4460 4461 Converters 4462 ========== 4463 4464 Can be converted to: 4465 -------------------- 4466 4467 - L{Object3D} 4468 - L{drawCylinder64 <drawCylinder64>} 4469 @sort: 4470 """ 4471 4472 @staticmethod
4473 - def three_dimensional(): return True
4474 -class DisplayList(object):
4475 """ 4476 Spyder-generated class 4477 4478 module tarantula 4479 4480 4481 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 4482 4483 4484 4485 Description 4486 =========== 4487 4488 4489 4490 If objects are show()'ed in Tarantula, 4491 4492 4493 an integer OpenGL display list is typically returned. 4494 4495 4496 This class specifies a display list to be 4497 4498 4499 show()'ed again, multiplied with an AxisSystem 4500 4501 4502 4503 4504 4505 4506 Wiki 4507 ==== 4508 U{http://www.spyderware.nl/wiki/classes/DisplayList} 4509 4510 Registered methods: 4511 =================== 4512 4513 - show 4514 - L{renderDisplayList <renderDisplayList>} 4515 @ivar displaylist: 4516 @type displaylist: L{Integer} 4517 @ivar axis: 4518 @type axis: L{AxisSystem} 4519 @sort: displaylist,axis 4520 """ 4521 4522 axis = AxisSystem()
4523 -class MultiDisplayList(object):
4524 """ 4525 Spyder-generated class 4526 4527 module tarantula 4528 4529 4530 file /home/sjoerd/Spyder-devel/tarantula/Tarantula.spy 4531 4532 4533 4534 Description 4535 =========== 4536 4537 4538 4539 If objects are show()'ed in Tarantula, 4540 4541 4542 an integer OpenGL display list is typically returned. 4543 4544 4545 This calss specifies duplicates of a displaylist, 4546 4547 4548 each with its own AxisSystem. 4549 4550 4551 The displaylist is rendered with for every 4552 4553 4554 instance, its axis system applied to it. 4555 4556 4557 4558 Wiki 4559 ==== 4560 U{http://www.spyderware.nl/wiki/classes/MultiDisplayList} 4561 4562 Registered methods: 4563 =================== 4564 4565 - show 4566 - L{renderMultiDisplayList <renderMultiDisplayList>} 4567 @ivar displaylist: 4568 @type displaylist: L{Integer} 4569 @ivar instances: 4570 @type instances: L{AxisSystemArray<AxisSystem>} 4571 @sort: displaylist,instances 4572 """
4573
4574 -def spyderconverterfunction_6(i):
4575 if i.p == None or len(i.p) < 2: return None 4576 d = i.dict() 4577 d["p1"] = i.p[0].dict() 4578 d["p2"] = i.p[1].dict() 4579 ret = HaddockRunParameters(d) 4580 return ret
4581
4582 -def spyderconverterfunction_7(i):
4583 d = i.dict() 4584 d["p"] = [d["p1"], d["p2"]] 4585 ret = HaddockMultiRunParameters(d) 4586 return ret
4587
4588 -def spyderconverterfunction_8(i):
4589 ret = Spyder.core.fastparsestring(i.params.data().data()) 4590 ret = ret.convert(HaddockMultiRunParameters) 4591 if i.runname != None: ret.runname = i.runname 4592 if i.username != None: ret.username = i.username 4593 if i.password != None: ret.password = i.password 4594 ret.validate() 4595 return ret
4596
4597 -def spyderconverterfunction_9(i):
4598 d = i.dict() 4599 d["randorien"] = False 4600 d["rigidmini"] = False 4601 d["initiosteps"] = 0 4602 d["cool1_steps"] = 0 4603 d["cool2_steps"] = 0 4604 d["cool3_steps"] = 0 4605 d["rotate180_0"] = False 4606 d["structures_0"] = 20 4607 d["structures_1"] = 20 4608 d["waterrefine"] = 20 4609 d["rigidtrans"] = False 4610 d["cmrest"] = True 4611 d["surfrest"] = True 4612 d["crossdock"] = False 4613 del d["w_vdw"] 4614 del d["w_elec"] 4615 del d["w_bsa"] 4616 del d["w_deint"] 4617 del d["w_desolv"] 4618 g = HaddockGuruInterface(d) 4619 g.w_vdw[2] = i.w_vdw 4620 g.w_elec[2] = i.w_elec 4621 g.w_bsa[2] = i.w_bsa 4622 g.w_deint[2] = i.w_deint 4623 g.w_desolv[2] = i.w_desolv 4624 g.ensemble_multiply = True 4625 return g
4626
4627 -class ObjectList3D(ObjectList):
4628 """ 4629 Spyder-generated class 4630 4631 module tarantula 4632 4633 4634 file /home/sjoerd/Spyder-devel/tarantula/ObjectList3D.spy 4635 4636 4637 4638 Wiki 4639 ==== 4640 U{http://www.spyderware.nl/wiki/classes/ObjectList3D} 4641 4642 Validate block 4643 ============== 4644 4645 >>> 4646 for onr,o in enumerate(self): 4647 while 1: 4648 typ = type(o) 4649 if o.typename() == None: 4650 typ = o._typev 4651 if not typ.typename().endswith("Array"): break 4652 if len(o) == 0: break 4653 o = o[0] 4654 if typ.three_dimensional() != True: raise ValidationError 4655 >>> 4656 4657 4658 Converters 4659 ========== 4660 4661 Can be converted to: 4662 -------------------- 4663 4664 - None 4665 - SPLIT 4666 4667 Can be converted from: 4668 ---------------------- 4669 4670 - U{(ObjectGroup)<http://www.spyderware.nl/doc/Spyder.ObjectGroup-class.html>} 4671 - L{view converter (#9) <spyderconverterfunction_9>} 4672 4673 - L{ObjectGroup3D} 4674 - L{view converter (#11) <spyderconverterfunction_11>} 4675 @sort: 4676 """ 4677 4678 @staticmethod
4679 - def three_dimensional():
4680 return True
4681 @staticmethod
4682 - def has_blenderform():
4683 return True
4684 @staticmethod
4685 - def blendermatrixmode():
4686 return "multi" 4687 @multimethod("self")
4688 - def blendersubmatrix(self,matrix,properties,splits):
4689 if self.typename() == None: 4690 v = self.value[splits[0]] 4691 else: 4692 v = self[splits[0]] 4693 currtype = type(v) 4694 if v.typename() == None: currtype = v._typev 4695 if len(splits) == 1: 4696 if currtype.blendermatrixmode() in ("all", "mono"): 4697 return currtype.blendersetmatrix(v,matrix,properties) 4698 else: 4699 if currtype.blendermatrixmode() in ("all", "multi"): 4700 return currtype.blendersubmatrix(v,matrix,properties,splits[1:]) 4701 return None, False
4702 @multimethod("self")
4703 - def blenderform(*args, **kargs):
4704 ol3d_blenderform(*args, **kargs)
4705 -class ObjectGroup3D(object):
4706 """ 4707 Spyder-generated class 4708 4709 module tarantula 4710 4711 4712 file /home/sjoerd/Spyder-devel/tarantula/ObjectList3D.spy 4713 4714 4715 4716 Wiki 4717 ==== 4718 U{http://www.spyderware.nl/wiki/classes/ObjectGroup3D} 4719 4720 Form block 4721 ========== 4722 4723 >>> 4724 BLENDER 4725 MATRIX axis 4726 MATRIXMODE all 4727 DEFAULT group [] 4728 >>> 4729 4730 4731 Converters 4732 ========== 4733 4734 Can be converted to: 4735 -------------------- 4736 4737 - L{MultiInstance3D} 4738 - L{view converter (#8) <spyderconverterfunction_8>} 4739 4740 - L{ObjectList3D} 4741 - L{view converter (#11) <spyderconverterfunction_11>} 4742 4743 Can be converted from: 4744 ---------------------- 4745 4746 - L{MultiInstance3D} (converts to ObjectGroup3DArray) 4747 - L{view converter (#10) <spyderconverterfunction_10>} 4748 4749 - L{Stairs3D} 4750 - L{view converter (#25) <spyderconverterfunction_25>} 4751 4752 - L{Tube3D} 4753 - L{view converter (#26) <spyderconverterfunction_26>} 4754 4755 - L{House3DWall} 4756 - L{view converter (#31) <spyderconverterfunction_31>} 4757 4758 - L{House3D} 4759 - L{view converter (#33) <spyderconverterfunction_33>} 4760 4761 Registered methods: 4762 =================== 4763 4764 - show 4765 - L{renderObjectGroup <renderObjectGroup>} 4766 @ivar group: 4767 @type group: L{ObjectList3D} 4768 @ivar axis: 4769 @type axis: L{AxisSystem} 4770 @sort: group,axis 4771 """ 4772
4773 - def blendersubmatrix(self,matrix,properties,splits):
4774 return ObjectList3D.blendersubmatrix(self.group, matrix, properties, splits)
4775 @staticmethod
4776 - def three_dimensional(): return True
4777 axis = AxisSystem()
4778 -class MultiInstance3D(object):
4779 """ 4780 Spyder-generated class 4781 4782 module tarantula 4783 4784 4785 file /home/sjoerd/Spyder-devel/tarantula/ObjectList3D.spy 4786 4787 4788 4789 Description 4790 =========== 4791 4792 4793 4794 Specifies duplicates of "object", each with its own 4795 4796 4797 AxisSystem. "object" is rendered with for every 4798 4799 4800 instance, its axis system applied to it. 4801 4802 4803 4804 Wiki 4805 ==== 4806 U{http://www.spyderware.nl/wiki/classes/MultiInstance3D} 4807 4808 Form block 4809 ========== 4810 4811 >>> 4812 BLENDER 4813 MATRIXMODE multi 4814 DEFAULT object [] 4815 DEFAULT instances [] 4816 ELEDEFAULT instances AxisSystem() 4817 >>> 4818 4819 4820 Converters 4821 ========== 4822 4823 Can be converted to: 4824 -------------------- 4825 4826 - L{Object3DArray<Object3D>} 4827 - L{view converter (#7) <spyderconverterfunction_7>} 4828 4829 - L{ObjectGroup3DArray<ObjectGroup3D>} 4830 - L{view converter (#10) <spyderconverterfunction_10>} 4831 4832 Can be converted from: 4833 ---------------------- 4834 4835 - L{ObjectGroup3D} 4836 - L{view converter (#8) <spyderconverterfunction_8>} 4837 4838 Registered methods: 4839 =================== 4840 4841 - show 4842 - L{renderMultiInstance <renderMultiInstance>} 4843 @ivar object: 4844 @type object: L{ObjectList3D} 4845 @ivar instances: 4846 @type instances: L{AxisSystemArray<AxisSystem>} 4847 @sort: object,instances 4848 """ 4849 4850 @staticmethod
4851 - def three_dimensional(): return True
4852 @multimethod("self")
4853 - def blendersubmatrix(self,matrix,properties,splits):
4854 return Spyder.blender.blender.mi_blendersubmatrix(self,matrix,properties,splits)
4855 -def spyderconverterfunction_10(i):
4856 ret = HaddockGuruInterface(i) 4857 ret.structures_0 = 10000 4858 ret.structures_1 = 400 4859 ret.waterrefine = 400 4860 ret.anastruc_1 = 400 4861 ret.ntrials = 1 4862 ret.ncvpart = 8.0/7 4863 return ret
4864
4865 -def spyderconverterfunction_11(mri):
4866 ret = "HADDOCK AIR restraints\n" 4867 numerals = ["st", "nd", "rd"] 4868 for n in range(4,21): numerals.append("th") 4869 numerals = [str(n)+num for n,num in zip(range(1,21), numerals)] 4870 for num, r in zip(numerals, mri.restraints): 4871 act1 = r.activereslist 4872 actpass2 = [] 4873 ret += "! HADDOCK AIR restraints for %s selection\n" % (num) 4874 ret += "!\n" 4875 for p in r.partners: 4876 rr = mri.restraints[p-1] 4877 actpass2 += [(r2, rr.segid) for r2 in rr.activereslist + rr.passivereslist] 4878 if len(actpass2) > 0: 4879 for r1 in act1: 4880 ret += "assign ( resid %d and segid %s)\n" % (r1, r.segid) 4881 ret += " (\n" 4882 first = True 4883 for r2,segid2 in actpass2: 4884 if (first == False): 4885 ret += " or\n" 4886 else: first = False 4887 ret += " ( resid %d and segid %s)\n" % (r2, segid2) 4888 ret += " ) 2.0 2.0 0.0\n\n" 4889 ret += "\n" 4890 return Data_TBL(ret)
4891
4892 4893 -def spydertextregister(text):
4894 text = str(text) 4895 global __spydertextregister, __spydertextregister_rev 4896 if __spydertextregister == None: load_spydertextregister() 4897 if text not in __spydertextregister_rev: 4898 entrynr = str(len(__spydertextregister)) 4899 __spydertextregister[entrynr] = text 4900 __spydertextregister_rev[text] = entrynr 4901 t = blender.Blender.Scene.GetCurrent() 4902 t.properties["spydertextregister"] = (str(__spydertextregister)) 4903 else: 4904 entrynr = __spydertextregister_rev[text] 4905 return entrynr 4906
4907 -def get_spydertext(entrynr):
4908 global __spydertextregister, __spydertextregister_rev 4909 if __spydertextregister == None: load_spydertextregister() 4910 return __spydertextregister[entrynr]
4911
4912 -class BlenderMVert(object):
4913 """ 4914 Spyder-generated class 4915 4916 module blender 4917 4918 4919 file /home/sjoerd/Spyder-devel/blender/blendermesh.spy 4920 4921 4922 4923 Description 4924 =========== 4925 4926 4927 4928 Representation of BlenderPython MVert 4929 4930 4931 Some features are not implemented yet 4932 4933 4934 Can be cast from Coordinate and Vector 4935 4936 4937 4938 4939 4940 4941 Wiki 4942 ==== 4943 U{http://www.spyderware.nl/wiki/classes/BlenderMVert} 4944 @ivar co: 4945 @type co: L{Coordinate} 4946 @ivar uvco: 4947 @type uvco: L{*Coordinate2D<Coordinate2D>} 4948 @sort: co,uvco 4949 """
4950
4951 -class BlenderMEdge(object):
4952 """ 4953 Spyder-generated class 4954 4955 module blender 4956 4957 4958 file /home/sjoerd/Spyder-devel/blender/blendermesh.spy 4959 4960 4961 4962 Description 4963 =========== 4964 4965 4966 4967 Representation of BlenderPython MEdge 4968 4969 4970 Some features are not implemented yet 4971 4972 4973 Note that v1 and v2 are MVerts in BlenderPython 4974 4975 4976 Can be cast from Edge 4977 4978 4979 4980 4981 4982 4983 Wiki 4984 ==== 4985 U{http://www.spyderware.nl/wiki/classes/BlenderMEdge} 4986 4987 Validate block 4988 ============== 4989 4990 >>> 4991 assert crease >= 0 and crease <= 255 4992 >>> 4993 4994 @ivar v1: 4995 @type v1: L{Integer} 4996 @ivar v2: 4997 @type v2: L{Integer} 4998 @ivar crease: 4999 @type crease: L{Integer} 5000 @sort: v1,v2,crease 5001 """ 5002 5003 crease = 0
5004 -class BlenderFaceModes(object):
5005 """ 5006 Spyder-generated class 5007 5008 module blender 5009 5010 5011 file /home/sjoerd/Spyder-devel/blender/blendermesh.spy 5012 5013 5014 5015 Description 5016 =========== 5017 5018 5019 5020 Representation of BlenderPython FaceModes 5021 5022 5023 5024 Wiki 5025 ==== 5026 U{http://www.spyderware.nl/wiki/classes/BlenderFaceModes} 5027 @ivar billboard: 5028 @type billboard: L{Bool} 5029 @ivar halo: 5030 @type halo: L{Bool} 5031 @ivar dynamic: 5032 @type dynamic: L{Bool} 5033 @ivar invisible: 5034 @type invisible: L{Bool} 5035 @ivar obcol: 5036 @type obcol: L{Bool} 5037 @ivar shadow: 5038 @type shadow: L{Bool} 5039 @ivar sharedcol: 5040 @type sharedcol: L{Bool} 5041 @ivar tiles: 5042 @type tiles: L{Bool} 5043 @ivar twoside: 5044 @type twoside: L{Bool} 5045 @sort: billboard,halo,dynamic,invisible,obcol,shadow,sharedcol,tiles,twoside 5046 """ 5047 5048 billboard = False 5049 halo = False 5050 dynamic = False 5051 invisible = False 5052 obcol = False 5053 shadow = False 5054 sharedcol = False 5055 tiles = False 5056 twoside = False
5057 -class BlenderMFace(object):
5058 """ 5059 Spyder-generated class 5060 5061 module blender 5062 5063 5064 file /home/sjoerd/Spyder-devel/blender/blendermesh.spy 5065 5066 5067 5068 Description 5069 =========== 5070 5071 5072 5073 Representation of BlenderPython MFace 5074 5075 5076 Some features are not implemented yet 5077 5078 5079 Note that verts are MVerts in BlenderPython 5080 5081 5082 5083 5084 5085 5086 Wiki 5087 ==== 5088 U{http://www.spyderware.nl/wiki/classes/BlenderMFace} 5089 5090 Validate block 5091 ============== 5092 5093 >>> 5094 if transp != None: assert transp in ("SOLID", "ADD","ALPHA","SUB") 5095 >>> 5096 5097 5098 Form block 5099 ========== 5100 5101 >>> 5102 OPTION transp "SOLID", "ADD","ALPHA","SUB" 5103 >>> 5104 5105 @ivar verts: 5106 @type verts: L{IntegerArray<Integer>} 5107 @ivar mat: 5108 @type mat: L{*Integer<Integer>} 5109 @ivar mode: 5110 @type mode: L{BlenderFaceModes} 5111 @ivar smooth: 5112 @type smooth: L{Bool} 5113 @ivar transp: 5114 @type transp: L{String} 5115 @ivar uv: 5116 @type uv: L{*Coordinate2DArray<Coordinate2D>} 5117 @sort: verts,mat,mode,smooth,transp,uv 5118 """ 5119 5120 verts = [] 5121 mode = BlenderFaceModes() 5122 smooth = False 5123 transp = "SOLID"
5124 -class BlenderMeshModes(object):
5125 """ 5126 Spyder-generated class 5127 5128 module blender 5129 5130 5131 file /home/sjoerd/Spyder-devel/blender/blendermesh.spy 5132 5133 5134 5135 Description 5136 =========== 5137 5138 5139 5140 Representation of BlenderPython MeshModes 5141 5142 5143 5144 Wiki 5145 ==== 5146 U{http://www.spyderware.nl/wiki/classes/BlenderMeshModes} 5147 @ivar novnormalsflip: 5148 @type novnormalsflip: L{Bool} 5149 @ivar twosided: 5150 @type twosided: L{Bool} 5151 @ivar autosmooth: 5152 @type autosmooth: L{Bool} 5153 @sort: novnormalsflip,twosided,autosmooth 5154 """ 5155 5156 novnormalsflip = False 5157 twosided = True 5158 autosmooth = False
5159 -class BlenderMesh(object):
5160 """ 5161 Spyder-generated class 5162 5163 module blender 5164 5165 5166 file /home/sjoerd/Spyder-devel/blender/blendermesh.spy 5167 5168 5169 5170 Description 5171 =========== 5172 5173 5174 5175 Representation of BlenderPython Mesh 5176 5177 5178 Some features are not implemented yet 5179 5180 5181 Note that "axis" is in BlenderPython defined 5182 5183 5184 not in Mesh but in Object 5185 5186 5187 5188 5189 5190 5191 Wiki 5192 ==== 5193 U{http://www.spyderware.nl/wiki/classes/BlenderMesh} 5194 5195 Validate block 5196 ============== 5197 5198 >>> 5199 assert materials == None or len(materials) <= 16 5200 #if faceUV == True: assert vertexColors == False 5201 #if faceUV == False: assert vertexColors == True 5202 >>> 5203 5204 5205 Integerarray block 5206 ================== 5207 5208 >>> 5209 subDivLevels[2] # The [display, rendering] subdivision levels in [1, 6]. 5210 >>> 5211 5212 5213 Converters 5214 ========== 5215 5216 Can be converted to: 5217 -------------------- 5218 5219 - L{BlenderMesh} (converts from BlenderMeshArray) 5220 - SPLIT 5221 5222 Can be converted from: 5223 ---------------------- 5224 5225 - L{Object3D} 5226 - L{view converter (#1) <spyderconverterfunction_1>} 5227 5228 - L{BlenderMeshArray<BlenderMesh>} 5229 - SPLIT 5230 @ivar verts: 5231 @type verts: L{BlenderMVertArray<BlenderMVert>} 5232 @ivar faces: 5233 @type faces: L{BlenderMFaceArray<BlenderMFace>} 5234 @ivar edges: 5235 @type edges: L{BlenderMEdgeArray<BlenderMEdge>} 5236 @ivar faceUV: 5237 @type faceUV: L{Bool} 5238 @ivar materials: 5239 @type materials: L{*MaterialArray<Material>} 5240 @ivar mode: 5241 @type mode: L{BlenderMeshModes} 5242 @ivar vertexColors: 5243 @type vertexColors: L{Bool} 5244 @ivar axis: 5245 @type axis: L{AxisSystem} 5246 @ivar name: 5247 @type name: L{*String<String>} 5248 @sort: verts,faces,edges,faceUV,materials,mode,vertexColors,axis,name 5249 """ 5250 5251 verts = [] 5252 faces = [] 5253 edges = [] 5254 faceUV = False 5255 mode = BlenderMeshModes() 5256 vertexColors = False 5257 axis = AxisSystem()
5258 -def spyderconverterfunction_1(i):
5259 ii = i.dict() 5260 if "pdbfile" in ii["p1"]["pdb"]: 5261 ii["p1"]["pdb"]["pdbdata"] = File(**ii["p1"]["pdb"]["pdbfile"]).data().textdata() 5262 ii["p1"]["pdb"] = PDBData(ii["p1"]["pdb"]) 5263 if "pdbfile" in ii["p2"]["pdb"]: 5264 ii["p2"]["pdb"]["pdbdata"] = File(**ii["p2"]["pdb"]["pdbfile"]).data().textdata() 5265 ii["p2"]["pdb"] = PDBData(ii["p2"]["pdb"]) 5266 r = "tblfile" 5267 if r in ii: 5268 ii["tbldata"] = File(**ii[r]).data().textdata() 5269 r = "unambigtblfile" 5270 if r in ii: 5271 ii["unambigtbldata"] = File(**ii[r]).data().textdata() 5272 dihedraldata = None 5273 r = "dihedralfile" 5274 if r in ii: 5275 fil = File(**ii[r]) 5276 dihedraldata = fil.data().textdata() 5277 ii["dihedraldata"] = dihedraldata 5278 hbonddata = None 5279 r = "hbondfile" 5280 if r in ii: 5281 fil = File(**ii[r]) 5282 hbonddata = fil.data().textdata() 5283 ii["hbonddata"] = hbonddata 5284 for v in ("rdc1", "rdc2", "rdc3", "rdc4", "rdc5"): 5285 vv = ii[v] 5286 rdcdata = None 5287 r = "rdcfile" 5288 if r in vv: 5289 fil = File(**vv[r]) 5290 rdcdata = fil.data().textdata() 5291 vv["rdcdata"] = rdcdata 5292 for v in ("dan1", "dan2", "dan3", "dan4", "dan5"): 5293 vv = ii[v] 5294 danidata = None 5295 r = "danifile" 5296 if r in vv: 5297 fil = File(**vv[r]) 5298 danidata = fil.data().textdata() 5299 vv["danidata"] = danidata 5300 return HaddockRunParameters(ii)
5301
5302 -class Data_BLEND(Data):
5303 """ 5304 Spyder-generated class 5305 5306 module blender 5307 5308 5309 file /home/sjoerd/Spyder-devel/blender/blenderlink.spy 5310 5311 5312 5313 Wiki 5314 ==== 5315 U{http://www.spyderware.nl/wiki/classes/Data_BLEND} 5316 @sort: 5317 """
5318
5319 -class Filename_BLEND(Filename):
5320 """ 5321 Spyder-generated class 5322 5323 module blender 5324 5325 5326 file /home/sjoerd/Spyder-devel/blender/blenderlink.spy 5327 5328 5329 5330 Wiki 5331 ==== 5332 U{http://www.spyderware.nl/wiki/classes/Filename_BLEND} 5333 5334 Form block 5335 ========== 5336 5337 >>> 5338 FILEFORMAT Data_BLEND 5339 >>> 5340 5341 @sort: 5342 """
5343
5383 -class BlenderMultiLinkInstance(object):
5384 """ 5385 Spyder-generated class 5386 5387 module blender 5388 5389 5390 file /home/sjoerd/Spyder-devel/blender/blenderlink.spy 5391 5392 5393 5394 Wiki 5395 ==== 5396 U{http://www.spyderware.nl/wiki/classes/BlenderMultiLinkInstance} 5397 5398 Registered methods: 5399 =================== 5400 5401 - show 5402 - L{blenderlink.show_blendermultilinkinstance <blenderlink.show_blendermultilinkinstance>} 5403 @ivar name: 5404 @type name: L{String} 5405 @ivar axis: 5406 @type axis: L{AxisSystem} 5407 @sort: name,axis 5408 """ 5409 5410 @staticmethod
5411 - def three_dimensional(): return True
5412 axis = AxisSystem()
5457 -class BlenderWrapper(object):
5458 """ 5459 Spyder-generated class 5460 5461 module blender 5462 5463 5464 file /home/sjoerd/Spyder-devel/blender/blenderwrapper.spy 5465 5466 5467 5468 Description 5469 =========== 5470 5471 5472 5473 Wraps a 3D object for grid usage 5474 5475 5476 Wrapped object must have a AxisSystem called axis 5477 5478 5479 and must implement a show() method 5480 5481 5482 5483 5484 5485 5486 Wiki 5487 ==== 5488 U{http://www.spyderware.nl/wiki/classes/BlenderWrapper} 5489 5490 Validate block 5491 ============== 5492 5493 >>> 5494 assert len(wrapped) == 1 5495 >>> 5496 5497 5498 Registered methods: 5499 =================== 5500 5501 - unshow 5502 - L{spyderdefinemethod_2 <spyderdefinemethod_2>} 5503 5504 - show 5505 - L{spyderdefinemethod_3 <spyderdefinemethod_3>} 5506 @ivar wrapped: 5507 @type wrapped: L{ObjectList3D} 5508 @sort: wrapped 5509 """ 5510
5511 - def set_axis(self, axis):
5512 self.wrapped[0].axis = axis
5513 -def spyderdefinemethod_2(bw):
5514 if "shown" not in bw.Annotation: return 5515 currid = bw.Annotation["shown"] 5516 sc = blender.Blender.Scene.GetCurrent() 5517 for ob in sc.objects: 5518 if "spyderid" in ob.properties: 5519 if ob.properties["spyderid"] == currid: 5520 sc.objects.unlink(ob)
5521
5522 -def spyderdefinemethod_3(bw):
5523 if "shown" not in bw.Annotation: #deep-copy the wrapped if it was never shown before 5524 bw.wrapped[0] = type(bw.wrapped[0])(bw.wrapped[0]) 5525 bw.wrapped[0].Annotation = bw.wrapped[0].Annotation.copy() 5526 bw.Annotation["shown"] = str(id(bw.wrapped[0])) 5527 bw.wrapped[0].show()
5528
5529 -class NewBlenderMaterial(object):
5530 """ 5531 Spyder-generated class 5532 5533 module blender 5534 5535 5536 file /home/sjoerd/Spyder-devel/blender/material.spy 5537 5538 5539 5540 Wiki 5541 ==== 5542 U{http://www.spyderware.nl/wiki/classes/NewBlenderMaterial} 5543 5544 Converters 5545 ========== 5546 5547 Can be converted to: 5548 -------------------- 5549 5550 - L{NewMaterial} 5551 - L{view converter (#4) <spyderconverterfunction_4>} 5552 @sort: 5553 """
5554
5555 -def spyderconverterfunction_4(i):
5556 ii = i.dict() 5557 if i.p != None: 5558 for n in range(len(i.p)): 5559 cur = ii["p"][n] 5560 if "pdbfile" in cur["pdb"]: 5561 cur["pdb"]["pdbdata"] = File(**cur["pdb"]["pdbfile"]).data().textdata() 5562 cur["pdb"] = PDBData(cur["pdb"]) 5563 HaddockPartnerParameters(cur) 5564 r = "tblfile" 5565 if r in ii: 5566 ii["tbldata"] = File(**ii[r]).data().textdata() 5567 r = "unambigtblfile" 5568 if r in ii: 5569 ii["unambigtbldata"] = File(**ii[r]).data().textdata() 5570 dihedraldata = None 5571 r = "dihedralfile" 5572 if r in ii: 5573 fil = File(**ii[r]) 5574 dihedraldata = fil.data().textdata() 5575 ii["dihedraldata"] = dihedraldata 5576 hbonddata = None 5577 r = "hbondfile" 5578 if r in ii: 5579 fil = File(**ii[r]) 5580 hbonddata = fil.data().textdata() 5581 ii["hbonddata"] = hbonddata 5582 for v in ("rdc1", "rdc2", "rdc3", "rdc4", "rdc5"): 5583 vv = ii[v] 5584 rdcdata = None 5585 r = "rdcfile" 5586 if r in vv: 5587 fil = File(**vv[r]) 5588 rdcdata = fil.data().textdata() 5589 vv["rdcdata"] = rdcdata 5590 for v in ("dan1", "dan2", "dan3", "dan4", "dan5"): 5591 vv = ii[v] 5592 danidata = None 5593 r = "danifile" 5594 if r in vv: 5595 fil = File(**vv[r]) 5596 danidata = fil.data().textdata() 5597 vv["danidata"] = danidata 5598 return HaddockMultiRunParameters(ii)
5599
5600 -class BlenderImage(object):
5601 """ 5602 Spyder-generated class 5603 5604 module blender 5605 5606 5607 file /home/sjoerd/Spyder-devel/blender/image.spy 5608 5609 5610 5611 Wiki 5612 ==== 5613 U{http://www.spyderware.nl/wiki/classes/BlenderImage} 5614 5615 Validate block 5616 ============== 5617 5618 >>> 5619 if source != None: assert source in ("STILL", "MOVIE", "SEQUENCE", "GENERATED") 5620 assert source != "SEQUENCE" #not implemented 5621 if clampX: assert xrep == 1 5622 if clampY: assert yrep == 1 5623 assert xrep >= 1 and xrep <= 16 5624 assert yrep >= 1 and yrep <= 16 5625 if source not in ("MOVIE", "SEQUENCE"): 5626 assert startframe == None 5627 assert endframe == None 5628 assert speed == None 5629 if source in ("MOVIE", "SEQUENCE"): 5630 assert speed != None 5631 if source != "MOVIE": 5632 assert fields == None 5633 assert fields_odd == None 5634 assert depth in (8, 16, 18, 24, 32) 5635 >>> 5636 5637 5638 Form block 5639 ========== 5640 5641 >>> 5642 OPTION source "STILL", "MOVIE", "SEQUENCE", "GENERATED" 5643 >>> 5644 5645 5646 Converters 5647 ========== 5648 5649 Can be converted to: 5650 -------------------- 5651 5652 - L{Data_JPG} 5653 - L{view converter (#5) <spyderconverterfunction_5>} 5654 5655 - L{Data_JPEG} 5656 - L{view converter (#6) <spyderconverterfunction_6>} 5657 5658 - L{Data_GIF} 5659 - L{view converter (#7) <spyderconverterfunction_7>} 5660 5661 - L{Data_PNG} 5662 - L{view converter (#8) <spyderconverterfunction_8>} 5663 5664 - U{(Data_TGA)<http://www.spyderware.nl/doc/Spyder.Data_TGA-class.html>} 5665 - L{view converter (#9) <spyderconverterfunction_9>} 5666 @ivar name: 5667 @type name: L{String} 5668 @ivar filename: 5669 @type filename: L{Filename} 5670 @ivar width: 5671 @type width: L{Integer} 5672 @ivar height: 5673 @type height: L{Integer} 5674 @ivar depth: 5675 @type depth: L{Integer} 5676 @ivar xrep: 5677 @type xrep: L{Integer} 5678 @ivar yrep: 5679 @type yrep: L{Integer} 5680 @ivar startframe: 5681 @type startframe: L{*Integer<Integer>} 5682 @ivar endframe: 5683 @type endframe: L{*Integer<Integer>} 5684 @ivar speed: 5685 @type speed: L{*Integer<Integer>} 5686 @ivar antialias: 5687 @type antialias: L{Bool} 5688 @ivar clampX: 5689 @type clampX: L{Bool} 5690 @ivar clampY: 5691 @type clampY: L{Bool} 5692 @ivar fields: 5693 @type fields: L{*Bool<Bool>} 5694 @ivar fields_odd: 5695 @type fields_odd: L{*Bool<Bool>} 5696 @ivar source: 5697 @type source: L{String} 5698 @sort: name,filename,width,height,depth,xrep,yrep,startframe,endframe,speed,antialias,clampX,clampY,fields,fields_odd,source 5699 """ 5700 5701 xrep = 1 5702 yrep = 1 5703 antialias = False 5704 clampX = True 5705 clampY = True 5706 source = "STILL"
5707 -def spyderconverterfunction_5(i):
5708 ii = i.dict() 5709 if ii["p"] != None: 5710 for n in range(len(ii["p"])): 5711 cur = ii["p"][n] 5712 if "pdbdata" in cur["pdb"]: 5713 v = Data_PDB(cur["pdb"]["pdbdata"]) 5714 cur["pdb"]["pdbfile"] = v.totempfile() 5715 cur["pdb"] = PDBInterface.fromdict(cur["pdb"]) 5716 r = "tbldata" 5717 if r in ii: 5718 ii["tblfile"] = ii[r].totempfile() 5719 r = "unambigtbldata" 5720 if r in ii: 5721 ii["unambigtblfile"] = ii[r].totempfile() 5722 dihedralfile = None 5723 r = "dihedraldata" 5724 if r in ii: 5725 dihedralfile = ii[r].totempfile() 5726 ii["dihedralfile"] = dihedralfile 5727 hbondfile = None 5728 r = "hbonddata" 5729 if r in ii: 5730 hbondfile = ii[r].totempfile() 5731 ii["hbondfile"] = hbondfile 5732 for v in ("rdc1", "rdc2", "rdc3", "rdc4", "rdc5"): 5733 vv = ii[v] 5734 rdcfile = None 5735 r = "rdcdata" 5736 if r in vv: 5737 rdcfile = vv[r].totempfile() 5738 vv["rdcfile"] = rdcfile 5739 for v in ("dan1", "dan2", "dan3", "dan4", "dan5"): 5740 vv = ii[v] 5741 danifile = None 5742 r = "danidata" 5743 if r in vv: 5744 danifile = vv[r].totempfile() 5745 vv["danifile"] = danifile 5746 return HaddockMultiInterface(ii)
5747
5748 -def spyderconverterfunction_6(i):
5749 if i.p == None or len(i.p) < 2: return None 5750 d = i.dict() 5751 d["p1"] = i.p[0].dict() 5752 d["p2"] = i.p[1].dict() 5753 ret = HaddockRunParameters(d) 5754 return ret
5755
5756 -def spyderconverterfunction_7(i):
5757 d = i.dict() 5758 d["p"] = [d["p1"], d["p2"]] 5759 ret = HaddockMultiRunParameters(d) 5760 return ret
5761
5762 -def spyderconverterfunction_8(i):
5763 ret = Spyder.core.fastparsestring(i.params.data().data()) 5764 ret = ret.convert(HaddockMultiRunParameters) 5765 if i.runname != None: ret.runname = i.runname 5766 if i.username != None: ret.username = i.username 5767 if i.password != None: ret.password = i.password 5768 ret.validate() 5769 return ret
5770
5771 -def spyderconverterfunction_9(i):
5772 d = i.dict() 5773 d["randorien"] = False 5774 d["rigidmini"] = False 5775 d["initiosteps"] = 0 5776 d["cool1_steps"] = 0 5777 d["cool2_steps"] = 0 5778 d["cool3_steps"] = 0 5779 d["rotate180_0"] = False 5780 d["structures_0"] = 20 5781 d["structures_1"] = 20 5782 d["waterrefine"] = 20 5783 d["rigidtrans"] = False 5784 d["cmrest"] = True 5785 d["surfrest"] = True 5786 d["crossdock"] = False 5787 del d["w_vdw"] 5788 del d["w_elec"] 5789 del d["w_bsa"] 5790 del d["w_deint"] 5791 del d["w_desolv"] 5792 g = HaddockGuruInterface(d) 5793 g.w_vdw[2] = i.w_vdw 5794 g.w_elec[2] = i.w_elec 5795 g.w_bsa[2] = i.w_bsa 5796 g.w_deint[2] = i.w_deint 5797 g.w_desolv[2] = i.w_desolv 5798 g.ensemble_multiply = True 5799 return g
5800
5801 5802 -class RubikSnake(object):
5803 """ 5804 Spyder-generated class 5805 5806 module models3d 5807 5808 5809 file /home/sjoerd/data/Spyder-devel/models3d/rubiksnake.spy 5810 5811 5812 5813 Description 5814 =========== 5815 5816 5817 5818 Representation of Rubik's Snake as an array of turns 5819 5820 5821 where 0 means no turn, 5822 5823 5824 1 a 45 degree right turn, 5825 5826 5827 2 a 90 degree turn 5828 5829 5830 and 3 a 45 degree left turn 5831 5832 5833 There is always one more segment than there is turns 5834 5835 5836 Unlike the traditional Rubik's Snake (23 turns) 5837 5838 5839 the snake can have any length 5840 5841 5842 Upon construction, the snake is validated for clashes 5843 5844 5845 5846 5847 5848 5849 Wiki 5850 ==== 5851 U{http://www.spyderware.nl/wiki/classes/RubikSnake} 5852 5853 Validate block 5854 ============== 5855 5856 >>> 5857 for t in turns: 5858 assert t in range(0,4) 5859 dir1,dir2,dir3 = 1,3,5 5860 posx,posy,posz = 0,0,0 5861 positions = {} 5862 positions[(posx,posy,posz)] = (dir1,dir2) 5863 for t in turns: 5864 posx,posy,posz = rubiksnake.move(posx,posy,posz,dir1) 5865 dir1,dir2,dir3 = rubiksnake.turn(dir1,dir2,dir3,t) 5866 if (posx,posy,posz) in positions: 5867 opposite = rubiksnake.get_opposite(positions[(posx,posy,posz)]) 5868 if dir1 != opposite[0] or dir2 != opposite[1]: 5869 raise ValidationError("Clash detected") 5870 positions[(posx,posy,posz)] = (dir1,dir2) 5871 >>> 5872 5873 5874 Form block 5875 ========== 5876 5877 >>> 5878 BLENDER 5879 MATRIX axis 5880 DEFAULT size 1 5881 RANGE size 1 5882 ELEMIN turns -1 5883 ELEMAX turns 4 5884 ELEDEFAULT turns 0 5885 >>> 5886 5887 5888 Converters 5889 ========== 5890 5891 Can be converted to: 5892 -------------------- 5893 5894 - L{RubikSnakeCode} 5895 - L{view converter (#22) <spyderconverterfunction_22>} 5896 5897 - L{Object3D} 5898 - L{view converter (#23) <spyderconverterfunction_23>} 5899 5900 Can be converted from: 5901 ---------------------- 5902 5903 - L{RubikSnakeCode} 5904 - L{view converter (#21) <spyderconverterfunction_21>} 5905 @ivar turns: 5906 @type turns: L{IntegerArray<Integer>} 5907 @ivar size: the size of each segment 5908 5909 @type size: L{Float} 5910 @ivar axis: 5911 @type axis: L{AxisSystem} 5912 @sort: turns,size,axis 5913 """ 5914 5915 @staticmethod
5916 - def three_dimensional(): return True
5917 @staticmethod
5918 - def blenderevent(self,blenderdata,currobj,currobjtype,currblenderdata,signalhead,signal,event=None,eventval=None,handles=None):
5919 if (signalhead, signal) == ("turns", "value-change"): 5920 v = currblenderdata["buttons"]["value"] 5921 if v.val == 4: v.val = 0 5922 if v.val == -1: v.val = 3 5923 return self.blendereventpass(self,blenderdata,currobj,currobjtype,currblenderdata,signalhead,signal,event,eventval,handles)
5924 turns = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) 5925 axis = AxisSystem()
5926 -class RubikSnakeCode(object):
5927 """ 5928 Spyder-generated class 5929 5930 module models3d 5931 5932 5933 file /home/sjoerd/data/Spyder-devel/models3d/rubiksnake.spy 5934 5935 5936 5937 Description 5938 =========== 5939 5940 5941 5942 Representation of Rubik's Snake as code string 5943 5944 5945 during object construction, the string is not validated! 5946 5947 5948 5949 5950 5951 5952 Wiki 5953 ==== 5954 U{http://www.spyderware.nl/wiki/classes/RubikSnakeCode} 5955 5956 Form block 5957 ========== 5958 5959 >>> 5960 BLENDER 5961 MATRIX axis 5962 DEFAULT code "" 5963 LENGTH code 100 5964 DEFAULT size 1 5965 RANGE size 1 5966 >>> 5967 5968 5969 Converters 5970 ========== 5971 5972 Can be converted to: 5973 -------------------- 5974 5975 - L{RubikSnake} 5976 - L{view converter (#21) <spyderconverterfunction_21>} 5977 5978 Can be converted from: 5979 ---------------------- 5980 5981 - L{RubikSnake} 5982 - L{view converter (#22) <spyderconverterfunction_22>} 5983 @ivar code: 5984 @type code: L{String} 5985 @ivar size: 5986 @type size: L{Float} 5987 @ivar axis: 5988 @type axis: L{AxisSystem} 5989 @sort: code,size,axis 5990 """ 5991 5992 @staticmethod
5993 - def three_dimensional(): return True
5994 axis = AxisSystem()
5995 -def spyderconverterfunction_21(c):
5996 turns = [0,] * 23 5997 k = [kk for kk in c.code.strip().split("-") if len(kk) > 0] 5998 for t in k: 5999 nr = 2*int(t[:-2])-2 6000 if t[-2] == 'R': 6001 turns[nr]=int(t[-1]) 6002 else: 6003 turns[nr-1]=4-int(t[-1]) 6004 r = RubikSnake ( 6005 turns = turns, 6006 size = c.size, 6007 axis = c.axis 6008 ) 6009 return r
6010
6011 -def spyderconverterfunction_22(r):
6012 l = len(r.turns) 6013 if l < 23: return None 6014 if l > 23: l = 23 6015 turns = [0,] * 23 6016 code = "" 6017 for nr in range(l): 6018 lr, ori = "R", r.turns[nr] 6019 t = (nr+2)/2 6020 if ori == 0: continue 6021 if nr % 2: 6022 lr,ori = "L", 4 - ori 6023 t += 1 6024 t = str(t)+ lr + str(ori) 6025 code += t + "-" 6026 code = code[:-1] 6027 c = RubikSnakeCode ( 6028 code = code, 6029 size = r.size, 6030 axis = r.axis 6031 ) 6032 return c
6033
6034 -def spyderconverterfunction_23(r):
6035 dir1,dir2,dir3 = 1,3,6 6036 posx,posy,posz = 0,0,0 6037 p1 = Coordinate(0,0,0) 6038 p2 = Coordinate(rubiksnake.move(p1.x,p1.y,p1.z,dir3)) 6039 p3 = Coordinate(rubiksnake.move(p1.x,p1.y,p1.z,dir1)) 6040 p4 = Coordinate(rubiksnake.move(p3.x,p3.y,p3.z,dir3)) 6041 i1,i2,i3,i4 = 0,1,2,3 6042 vertices = [p1,p2,p3,p4] 6043 if Spyder.tarantula.get_material("rubiksnake_white") == None: 6044 NewMaterial("rubiksnake_white", color=(255,255,255)).show() 6045 if Spyder.tarantula.get_material("rubiksnake_black") == None: 6046 NewMaterial("rubiksnake_black", color=(76,38,0)).show() 6047 materials = ("rubiksnake_black", "rubiksnake_white") 6048 currmaterial = 0 6049 faces = [Face3D(material=materials[currmaterial],vertices=(i1,i2,i4,i3)),] 6050 for t in r.turns: 6051 p5 = Coordinate(rubiksnake.move(p3.x,p3.y,p3.z,dir2)) 6052 p6 = Coordinate(rubiksnake.move(p4.x,p4.y,p4.z,dir2)) 6053 i5, i6 = len(vertices), len(vertices) + 1 6054 vertices += (p5,p6) 6055 faces.append(Face3D(material=materials[currmaterial],vertices=(i1,i5,i6,i2))) 6056 faces.append(Face3D(material=materials[currmaterial],vertices=(i1,i3,i5))) 6057 faces.append(Face3D(material=materials[currmaterial],vertices=(i2,i6,i4))) 6058 p1,p2,p3,p4 = p4,p3,p6,p5 6059 i1,i2,i3,i4 = i4,i3,i6,i5 6060 for tt in range(t): 6061 p1,p2,p4,p3 = p2,p4,p3,p1 6062 i1,i2,i4,i3 = i2,i4,i3,i1 6063 posx,posy,posz = rubiksnake.move(posx,posy,posz,dir1) 6064 dir1,dir2,dir3 = rubiksnake.turn(dir1,dir2,dir3,t) 6065 currmaterial = 1 - currmaterial 6066 p5 = Coordinate(rubiksnake.move(p3.x,p3.y,p3.z,dir2)) 6067 p6 = Coordinate(rubiksnake.move(p4.x,p4.y,p4.z,dir2)) 6068 i5, i6 = len(vertices), len(vertices) + 1 6069 vertices += (p5,p6) 6070 faces.append(Face3D(material=materials[currmaterial],vertices=(i1,i5,i6,i2))) 6071 faces.append(Face3D(material=materials[currmaterial],vertices=(i1,i3,i5))) 6072 faces.append(Face3D(material=materials[currmaterial],vertices=(i2,i6,i4))) 6073 faces.append(Face3D(material=materials[currmaterial],vertices=(i3,i4,i6,i5))) 6074 for v in vertices: 6075 v.x *= r.size 6076 v.y *= r.size 6077 v.z *= r.size 6078 o = Object3D(vertices=vertices,faces=faces,material="rubiksnake_white",axis=r.axis) 6079 return o
6080
6081 -class Bolt3D(object):
6082 """ 6083 Spyder-generated class 6084 6085 module models3d 6086 6087 6088 file /home/sjoerd/data/Spyder-devel/models3d/bolt.spy 6089 6090 6091 6092 Description 6093 =========== 6094 6095 6096 6097 Sergio Moura's Bolt 6098 6099 6100 6101 Wiki 6102 ==== 6103 U{http://www.spyderware.nl/wiki/classes/Bolt3D} 6104 6105 Validate block 6106 ============== 6107 6108 >>> 6109 assert radius > 0 6110 assert ident >= 0 6111 assert ident < radius 6112 assert divisions >= 3 6113 assert loops >= 3 6114 #prevent normal flipping 6115 assert step > 0 6116 >>> 6117 6118 6119 Form block 6120 ========== 6121 6122 >>> 6123 BLENDER 6124 MATRIX axis 6125 DEFAULT radius 1 6126 MIN radius 0.01 6127 MAX radius 10 6128 DEFAULT divisions 8 6129 MIN divisions 4 6130 MAX divisions 100 6131 DEFAULT step .2 6132 MIN step 0.01 6133 MAX step 10 6134 DEFAULT loops 5 6135 MIN loops 3 6136 MAX loops 100 6137 DEFAULT ident 0.1 6138 MIN ident 0.01 6139 MAX ident 10 6140 >>> 6141 6142 6143 Converters 6144 ========== 6145 6146 Can be converted to: 6147 -------------------- 6148 6149 - L{Object3D} 6150 - L{view converter (#24) <spyderconverterfunction_24>} 6151 @ivar radius: 6152 @type radius: L{Float} 6153 @ivar divisions: 6154 @type divisions: L{Integer} 6155 @ivar step: 6156 @type step: L{Float} 6157 @ivar loops: 6158 @type loops: L{Integer} 6159 @ivar ident: 6160 @type ident: L{Float} 6161 @ivar crease_inside: 6162 @type crease_inside: L{Bool} 6163 @ivar crease_outside: 6164 @type crease_outside: L{Bool} 6165 @ivar crease_cap: 6166 @type crease_cap: L{Bool} 6167 @ivar axis: 6168 @type axis: L{AxisSystem} 6169 @ivar material: 6170 @type material: L{Material} 6171 @sort: radius,divisions,step,loops,ident,crease_inside,crease_outside,crease_cap,axis,material 6172 """ 6173 6174 @staticmethod
6175 - def three_dimensional(): return True
6176 crease_inside = False 6177 crease_outside = False 6178 crease_cap = False 6179 axis = AxisSystem() 6180 material = "defaultmaterial"
6181 -def spyderconverterfunction_24(b):
6182 radius, sub, step, loops, ident, increase, outcrease, capcrease = ( b.radius, 6183 b.divisions, 6184 b.step, 6185 b.loops, 6186 b.ident, 6187 b.crease_inside, 6188 b.crease_outside, 6189 b.crease_cap, 6190 ) 6191 verts = [] 6192 faces = [] 6193 # VERTS 6194 #cap 6195 unit = Coordinate(0,1,0) 6196 inradius = radius - ident 6197 zstep = float(step) / sub 6198 ang = 360.0 / sub 6199 rotmat = AxisSystem().rotateZ(ang) 6200 axis = AxisSystem().rotateZ(-ang) 6201 verts.append(inradius * unit * axis) 6202 for i in range(sub-1): 6203 axis *= rotmat #axis.rotateZ(ang) 6204 verts.append(radius*unit*axis) 6205 #1st loop 6206 axis1 = AxisSystem() * inradius 6207 axis2 = AxisSystem() * radius 6208 space = 0 6209 for i in range(sub): 6210 axis1.origin.z += 0.5*zstep 6211 verts.append(unit * axis1) 6212 axis1 *= rotmat #axis1.rotateZ(ang) 6213 axis2.origin.z += zstep 6214 verts.append(unit * axis2) 6215 axis2 *= rotmat #axis2.rotateZ(ang) 6216 #other loops 6217 for j in range(loops-1): 6218 #make sure that we have rotated exactly 360 degrees (eliminate accumulated rounding error) 6219 axis1 = AxisSystem(origin=(0,0,axis1.origin.z)) * inradius 6220 axis2 = AxisSystem(origin=(0,0,axis2.origin.z)) * radius 6221 for i in range(sub): 6222 if j < loops - 2: axis1.origin.z += zstep 6223 else: axis1.origin.z += 0.5 * zstep 6224 verts.append(unit * axis1) 6225 axis1 *= rotmat #axis1.rotateZ(ang) 6226 if j < loops - 2: axis2.origin.z += zstep 6227 verts.append(unit * axis2) 6228 axis2 *= rotmat #axis2.rotateZ(ang) 6229 #one pair of vertices too many 6230 verts = verts[:-2] 6231 #FACES 6232 #cap / 1st loop 6233 faces.append([1,0,sub]) 6234 faces.append([0,sub+1,sub]) 6235 for i in range(sub-1): 6236 ii = sub+2*i 6237 nexti = i + 2 6238 if (nexti) == sub: nexti = 0 6239 faces.append([nexti, i+1, ii, ii+2]) 6240 faces.append([ii+2,ii,ii+1, ii+3]) 6241 #2nd to n 6242 lastcorner = 0 6243 vcount = sub * 3 - 2 6244 for j in range(loops-1): 6245 for i in range(sub): 6246 nextcorner = sub + 2*(sub*j+i) + 1 6247 othercorner = vcount + 2*(sub*j+i) 6248 faces.append([nextcorner, lastcorner, othercorner, othercorner+2]) 6249 faces.append([othercorner+2, othercorner, othercorner+1, othercorner+3]) 6250 lastcorner = nextcorner 6251 #one pair of faces too many 6252 faces = faces[:-2] 6253 # last pair of faces 6254 eol = 2*sub*(loops-2) + vcount + 1 #stands for end of line 6255 faces.append([eol, nextcorner-2, othercorner]) 6256 faces.append([eol, othercorner, othercorner+1]) 6257 edges0 = set() 6258 #extract all edges from the faces 6259 for f in faces: 6260 lastv = f[-1] 6261 for v in f: 6262 v1 = min((lastv,v)) 6263 v2 = max((lastv,v)) 6264 edges0.add((v1,v2)) 6265 lastv = v 6266 #calculate edge creases 6267 def is_inner(e,eol,sub): 6268 for v in e: 6269 if v == 0 or v == eol: continue 6270 if v < sub: return False 6271 if (v - sub) % 2: return False 6272 return True
6273 def is_outer(e,eol,sub): 6274 for v in e: 6275 if v == 0 or v == eol: continue 6276 if v < sub: return False 6277 if (v - sub - 1) % 2: return False 6278 return True 6279 def is_cap(e,eol,sub): 6280 for v in e: 6281 if v < sub: continue 6282 if v < eol: return False 6283 if v > eol + 2 * sub: return False 6284 if (v - eol) % 2: return False 6285 return True 6286 edges = [] 6287 for e in edges0: 6288 crease = None 6289 if increase > 0 and is_inner(e,eol,sub): crease = 255 * increase 6290 if outcrease > 0 and is_outer(e,eol,sub): crease = 255 * outcrease 6291 if capcrease > 0 and is_cap(e,eol,sub): crease = 255 * capcrease 6292 if crease == None: edges.append(e) 6293 else: edges.append((e[0], e[1], crease)) 6294 return Object3D(vertices=verts, faces=faces, edges=edges, material = b.material,axis=b.axis) 6295
6296 -class Stairs3D(object):
6297 """ 6298 Spyder-generated class 6299 6300 module models3d 6301 6302 6303 file /home/sjoerd/data/Spyder-devel/models3d/stairs.spy 6304 6305 6306 6307 Description 6308 =========== 6309 6310 6311 6312 3D object for simple ascending clockwise winding stairs 6313 6314 6315 steprotation in degrees 6316 6317 6318 The stairs ascend in the Z direction 6319 6320 6321 6322 6323 6324 6325 Wiki 6326 ==== 6327 U{http://www.spyderware.nl/wiki/classes/Stairs3D} 6328 6329 Validate block 6330 ============== 6331 6332 >>> 6333 assert steps > 0 6334 assert innerradius > 0 6335 assert innerradius < outerradius 6336 assert stepheight > 0 6337 assert steprotation > 0 6338 assert stepoverlap >= 0 6339 >>> 6340 6341 6342 Form block 6343 ========== 6344 6345 >>> 6346 BLENDER 6347 DEFAULT steps 10 6348 RANGE steps 10 6349 DEFAULT innerradius 3 6350 RANGE innerradius 3 6351 DEFAULT outerradius 5 6352 RANGE outerradius 5 6353 DEFAULT stepheight 1 6354 RANGE stepheight 1 6355 DEFAULT steprotation 10 6356 RANGE steprotation 10 6357 DEFAULT stepoverlap 0 6358 MIN stepoverlap 0 6359 MAX stepoverlap 100 6360 >>> 6361 6362 6363 Converters 6364 ========== 6365 6366 Can be converted to: 6367 -------------------- 6368 6369 - L{ObjectGroup3D} 6370 - L{view converter (#25) <spyderconverterfunction_25>} 6371 @ivar steps: 6372 @type steps: L{Integer} 6373 @ivar steprotation: 6374 @type steprotation: L{Float} 6375 @ivar stepheight: 6376 @type stepheight: L{Float} 6377 @ivar innerradius: 6378 @type innerradius: L{Float} 6379 @ivar outerradius: 6380 @type outerradius: L{Float} 6381 @ivar stepoverlap: 6382 @type stepoverlap: L{Float} 6383 @ivar material: 6384 @type material: L{Material} 6385 @ivar axis: 6386 @type axis: L{AxisSystem} 6387 @sort: steps,steprotation,stepheight,innerradius,outerradius,stepoverlap,material,axis 6388 """ 6389 6390 @staticmethod
6391 - def three_dimensional(): return True
6392 material = "defaultmaterial" 6393 axis = AxisSystem()
6394 -def spyderconverterfunction_25(s):
6395 i = s.innerradius 6396 o = s.outerradius 6397 h = s.stepheight 6398 rot = s.steprotation 6399 #Just a shorter way to refer to these values 6400 vertices1=CoordinateArray((i,0,0),(o,0,0),(o,0,h), (i,0,h)) 6401 axis = AxisSystem() 6402 rotsize = rot + s.stepoverlap/100 * rot 6403 axis.rotateZ(rotsize) 6404 vertices2 = CoordinateArray() 6405 for v in vertices1: vertices2.append(v*axis) 6406 o = Chunk3D(vertices1, vertices2,material=s.material) 6407 a = AxisSystem() 6408 matrices = [] 6409 for n in range(s.steps): 6410 matrices.append(AxisSystem(a)) 6411 a.rotateZ(rot) 6412 a.origin.z += h 6413 mi = MultiInstance3D(instances=matrices,object=o) 6414 return ObjectGroup3D(mi,s.axis)
6415
6416 -class Tube3D(object):
6417 """ 6418 Spyder-generated class 6419 6420 module models3d 6421 6422 6423 file /home/sjoerd/data/Spyder-devel/models3d/tube.spy 6424 6425 6426 6427 Description 6428 =========== 6429 6430 6431 6432 3D object class for a hollow tube 6433 6434 6435 The tube is oriented along the X axis 6436 6437 6438 6439 6440 6441 6442 Wiki 6443 ==== 6444 U{http://www.spyderware.nl/wiki/classes/Tube3D} 6445 6446 Validate block 6447 ============== 6448 6449 >>> 6450 assert(innersize > 0) 6451 assert(innersize < outersize) 6452 assert radialsegments >= 3 6453 >>> 6454 6455 6456 Form block 6457 ========== 6458 6459 >>> 6460 BLENDER 6461 MATRIX axis 6462 MATRIXMODE mono 6463 DEFAULT innersize 0.5 6464 RANGE innersize 1 6465 DEFAULT outersize 1 6466 RANGE outersize 1 6467 TOOLTIP radialsegments The slices of the circle that forms the tube 6468 DEFAULT radialsegments 8 6469 MIN radialsegments 3 6470 MAX radialsegments 100 6471 TOOLTIP length The tube's length (X axis) 6472 DEFAULT length 5 6473 MIN length 0.01 6474 MAX length 100 6475 DEFAULT lengthsegments 1 6476 TOOLTIP lengthsegments The number of pieces the tube is cut into 6477 MIN lengthsegments 1 6478 MAX lengthsegments 100 6479 >>> 6480 6481 6482 Converters 6483 ========== 6484 6485 Can be converted to: 6486 -------------------- 6487 6488 - L{ObjectGroup3D} 6489 - L{view converter (#26) <spyderconverterfunction_26>} 6490 @ivar innersize: 6491 @type innersize: L{Float} 6492 @ivar outersize: 6493 @type outersize: L{Float} 6494 @ivar radialsegments: 6495 @type radialsegments: L{Integer} 6496 @ivar length: 6497 @type length: L{Float} 6498 @ivar lengthsegments: 6499 @type lengthsegments: L{Integer} 6500 @ivar material: 6501 @type material: L{Material} 6502 @ivar axis: 6503 @type axis: L{AxisSystem} 6504 @sort: innersize,outersize,radialsegments,length,lengthsegments,material,axis 6505 """ 6506 6507 @staticmethod
6508 - def three_dimensional(): return True
6509 lengthsegments = 1 6510 material = "defaultmaterial" 6511 axis = AxisSystem()
6512 -def spyderconverterfunction_26(s):
6513 ret = [] 6514 prevplane = [] 6515 l = float(s.length)/s.lengthsegments 6516 ori = -0.5*(s.lengthsegments-1)*l 6517 ang = float(1)/s.radialsegments * 2 * math.pi 6518 y = -math.sin(ang) 6519 z = math.cos(ang) 6520 points = [] 6521 points.append(Coordinate(0.5*l, 0,s.innersize)) 6522 points.append(Coordinate(0.5*l, 0,s.outersize)) 6523 points.append(Coordinate(-0.5*l, 0,s.innersize)) 6524 points.append(Coordinate(-0.5*l, 0,s.outersize)) 6525 points.append(Coordinate(0.5*l, y*s.innersize,z*s.innersize)) 6526 points.append(Coordinate(0.5*l, y*s.outersize,z*s.outersize)) 6527 points.append(Coordinate(-0.5*l, y*s.innersize,z*s.innersize)) 6528 points.append(Coordinate(-0.5*l, y*s.outersize,z*s.outersize)) 6529 faces = [Face3D(vertices=(0,1,3,2),normal=(0,0,-1)), 6530 Face3D(vertices=(5,4,6,7),normal=(0,z,-y)), 6531 Face3D(vertices=(1,0,4,5),normal=(1,0,0)), 6532 Face3D(vertices=(2,3,7,6),normal=(-1,0,0)), 6533 Face3D(vertices=(3,1,5,7),normal=(0,-y,-z)), 6534 Face3D(vertices=(0,2,6,4),normal=(0,y,z))] 6535 o = Object3D(material=s.material,faces=faces,vertices=points) 6536 ang = float(1)/s.radialsegments*360 6537 matrices = [AxisSystem()] 6538 if s.lengthsegments == 1: matrices[-1].origin.x = ori 6539 for n in range(1,s.radialsegments): 6540 a = AxisSystem(matrices[-1]) 6541 a.rotateX(ang) 6542 matrices.append(a) 6543 mi = MultiInstance3D(o,matrices) 6544 if s.lengthsegments == 1: 6545 ret = ObjectGroup3D(axis=s.axis,group=[mi]) 6546 else: 6547 matrices = [AxisSystem(origin=(ori,0,0))] 6548 for n in range(1,s.lengthsegments): 6549 a = AxisSystem(matrices[-1]) 6550 a.origin += l*a.x 6551 matrices.append(a) 6552 ret = ObjectGroup3D(axis=s.axis,group=[MultiInstance3D(mi,matrices)]) 6553 return ret
6554
6555 -class Pillar3D(Cylinder):
6556 """ 6557 Spyder-generated class 6558 6559 module models3d 6560 6561 6562 file /home/sjoerd/data/Spyder-devel/models3d/pillar.spy 6563 6564 6565 6566 Description 6567 =========== 6568 6569 6570 6571 3D object class for a simple pillar 6572 6573 6574 The pillar is oriented along the Z axis 6575 6576 6577 A Pillar is constructed in the same way as a Cylinder, 6578 6579 6580 but it is rendered as a cylinder capped at each side 6581 6582 6583 6584 6585 6586 6587 Wiki 6588 ==== 6589 U{http://www.spyderware.nl/wiki/classes/Pillar3D} 6590 6591 Converters 6592 ========== 6593 6594 Can be converted to: 6595 -------------------- 6596 6597 - L{Object3DArray<Object3D>} 6598 - L{view converter (#27) <spyderconverterfunction_27>} 6599 @sort: 6600 """ 6601 6602 @staticmethod
6603 - def three_dimensional(): return True
6604 -def spyderconverterfunction_27(p):
6605 footheight1 = 1 6606 footheight2 = 1.5 6607 pp = Pillar3D(p) 6608 pp.radius *= 0.5 6609 pp.height -= footheight1 + footheight2 6610 pp.axis = AxisSystem(p.axis.origin,p.axis.x,p.axis.y,p.axis.z) 6611 a = Cylinder(pp).convert(Object3D) 6612 pp.radius = p.radius*0.9 6613 pp.height = footheight2 6614 shift = 0.5*p.height-footheight1 -0.5*footheight2 6615 pp0 = Pillar3D(pp) 6616 pp.axis.origin += shift*pp.axis.z 6617 b = Cylinder(pp).convert(Object3D) 6618 pp = Pillar3D(pp0) 6619 pp.axis.origin -= shift*pp.axis.z 6620 c = Cylinder(pp).convert(Object3D) 6621 shift = 0.5*p.height-0.5*footheight1 6622 blockpos = Coordinate(p.axis.origin) 6623 blockpos -= shift*pp.axis.z 6624 d = Block3D((2*p.radius,2*p.radius,footheight1),axis=p.axis,material=p.material) 6625 d.axis.origin = blockpos 6626 d = d.convert(Object3D) 6627 blockpos = Coordinate(p.axis.origin) 6628 blockpos += shift*pp.axis.z 6629 e = Block3D((2*p.radius,2*p.radius,footheight1),axis=p.axis,material=p.material) 6630 e.axis.origin = blockpos 6631 e = e.convert(Object3D) 6632 a.lighting, b.lighting, c.lighting, d.lighting, e.lighting = "smooth", "smooth","smooth","flat","flat" 6633 return Object3DArray(a,b,c,d,e)
6634
6635 -class POrbital(object):
6636 """ 6637 Spyder-generated class 6638 6639 module models3d 6640 6641 6642 file /home/sjoerd/data/Spyder-devel/models3d/porbital.spy 6643 6644 6645 6646 Wiki 6647 ==== 6648 U{http://www.spyderware.nl/wiki/classes/POrbital} 6649 6650 Validate block 6651 ============== 6652 6653 >>> 6654 assert rx > 0 6655 assert ry > 0 6656 assert rrx >= 0 6657 assert rry >= 0 6658 assert planesegments >= 2 6659 assert rotationsegments >= 2 6660 >>> 6661 6662 6663 Form block 6664 ========== 6665 6666 >>> 6667 BLENDER 6668 MATRIX axis 6669 DEFAULT rx 1 6670 MIN rx 0.01 6671 MAX rx 5 6672 DEFAULT ry 1 6673 MIN ry 0.01 6674 MAX ry 5 6675 DEFAULT rrx 1 6676 MIN rrx 0 6677 MAX rrx 5 6678 DEFAULT rry 1 6679 MIN rry 0 6680 MAX rry 5 6681 DEFAULT planesegments 8 6682 MIN planesegments 2 6683 MAX planesegments 100 6684 DEFAULT rotationsegments 8 6685 MIN rotationsegments 2 6686 MAX rotationsegments 100 6687 >>> 6688 6689 6690 Converters 6691 ========== 6692 6693 Can be converted to: 6694 -------------------- 6695 6696 - L{Object3D} 6697 - L{view converter (#28) <spyderconverterfunction_28>} 6698 @ivar rx: 6699 @type rx: L{Float} 6700 @ivar ry: 6701 @type ry: L{Float} 6702 @ivar rrx: 6703 @type rrx: L{Float} 6704 @ivar rry: 6705 @type rry: L{Float} 6706 @ivar planesegments: 6707 @type planesegments: L{Integer} 6708 @ivar rotationsegments: 6709 @type rotationsegments: L{Integer} 6710 @ivar axis: 6711 @type axis: L{AxisSystem} 6712 @sort: rx,ry,rrx,rry,planesegments,rotationsegments,axis 6713 """ 6714 6715 @staticmethod
6716 - def three_dimensional(): return True
6717 axis = AxisSystem()
6718 -def spyderconverterfunction_28(p):
6719 pi = math.pi 6720 alpha = math.asin(p.rrx / (p.rx + p.rrx)) 6721 ypos = (p.ry + p.rry) * math.cos(alpha) 6722 angles1 = [0.5*pi] 6723 angles2 = [0] 6724 for n in range(p.planesegments-1): 6725 angles1.append((n+1)*(0.5*pi-alpha)/p.planesegments+0.5*pi) 6726 for n in range(p.planesegments-1): 6727 angles2.append((n+1)*(0.5*pi)/p.planesegments) 6728 vertices = [] 6729 data = ( 6730 (angles2,p.rx,p.ry,0,0), 6731 (angles1,p.rx,p.ry,0,0), 6732 (angles1,-p.rrx,-p.rry,-p.rrx,-ypos), 6733 (angles1,-p.rrx,p.rry,-p.rrx,-ypos), 6734 (angles1,p.rx,-p.ry,0,-2*ypos), 6735 (angles2,p.rx,-p.ry,0,-2*ypos), 6736 ) 6737 for angles,xrad,yrad,xp,yp in data: 6738 verts = [] 6739 for a in angles: 6740 x = xrad * -math.sin(a) + xp 6741 y = yrad * math.cos(a) + yp 6742 verts.append((x,y)) 6743 vertices.append(verts) 6744 vertices[2].reverse() 6745 vertices[4].reverse() 6746 vertices[5].reverse() 6747 allvertices = reduce(lambda a,b: a+b, vertices) 6748 allvertices2 = [] 6749 vlen = len(allvertices) 6750 for pnr in range(vlen-1): 6751 for n in (1,): 6752 if allvertices[pnr][0] != allvertices[pnr+1][0]: break 6753 if allvertices[pnr][1] != allvertices[pnr+1][1]: break 6754 else: 6755 continue 6756 allvertices2.append(allvertices[pnr]) 6757 allvertices = allvertices2 + allvertices[-1:] 6758 #s = '\n'.join([' '.join([str(vv) for vv in v]) for v in allvertices]) +'\n' 6759 #print Stream(s) | "xmgrace -pipe" 6760 vertices3d = [] 6761 for r in range(p.rotationsegments): 6762 angle = r*2*pi/p.rotationsegments 6763 sinang = math.sin(angle) 6764 cosang = math.cos(angle) 6765 for v in allvertices: 6766 vertices3d.append((v[0] * sinang,v[1], v[0]*cosang)) 6767 faces = [] 6768 vlen = len(allvertices) 6769 for pnr in range(vlen-1): 6770 for r in range(p.rotationsegments): 6771 nextr = r+1 6772 if nextr==p.rotationsegments: nextr = 0 6773 v1 = pnr + r * vlen 6774 v2 = pnr + r * vlen + 1 6775 v3 = pnr + nextr * vlen + 1 6776 v4 = pnr + nextr * vlen 6777 currface = [v1,v2] 6778 if allvertices[pnr+1][0] != 0: 6779 currface.append(v3) 6780 if allvertices[pnr][0] != 0: 6781 currface.append(v4) 6782 faces.append(currface) 6783 o1 = Object3D(faces=faces, vertices=vertices3d,axis=p.axis) 6784 return o1
6785
6786 -class FormulaGrid2D(object):
6787 """ 6788 Spyder-generated class 6789 6790 module models3d 6791 6792 6793 file /home/sjoerd/data/Spyder-devel/models3d/formulagrid.spy 6794 6795 6796 6797 Description 6798 =========== 6799 6800 6801 6802 Parametric object based on functions of U and V 6803 6804 6805 Inspired by the Parametric Object plugin by Ed Mackey, http://www.blinken.com/blender-plugins.php 6806 6807 6808 6809 6810 6811 6812 Wiki 6813 ==== 6814 U{http://www.spyderware.nl/wiki/classes/FormulaGrid2D} 6815 6816 Validate block 6817 ============== 6818 6819 >>> 6820 assert umin < umax 6821 assert usteps >= 2 6822 assert vmin < vmax 6823 assert vsteps >= 2 6824 f = formula.formula(xformula,["u","v"]) 6825 assert f != None 6826 assert f(0,0) != None 6827 f = formula.formula(yformula,["u","v"]) 6828 assert f != None 6829 assert f(0,0) != None 6830 f = formula.formula(zformula,["u","v"]) 6831 assert f != None 6832 assert f(0,0) != None 6833 >>> 6834 6835 6836 Form block 6837 ========== 6838 6839 >>> 6840 BLENDER 6841 DEFAULT xformula "sin(2*pi*u)*(2+(0.5*sin(2*pi*v)))" 6842 LENGTH xformula 100 6843 DEFAULT yformula "cos(2*pi*u)*(2+(0.5*sin(2*pi*v)))" 6844 LENGTH yformula 100 6845 DEFAULT zformula "cos(2*pi*v)*0.5" 6846 LENGTH zformula 100 6847 TYPE umin number 6848 DEFAULT umin 0 6849 MIN umin -1000 6850 MAX umin 1000 6851 TYPE umax number 6852 DEFAULT umax 1 6853 MIN umax -1000 6854 MAX umax 1000 6855 DEFAULT usteps 64 6856 MIN usteps 2 6857 MAX usteps 10000 6858 TYPE vmin number 6859 DEFAULT vmin 0 6860 MIN vmin -1000 6861 MAX vmin 1000 6862 TYPE vmax number 6863 DEFAULT vmax 1 6864 MIN vmax -1000 6865 MAX vmax 1000 6866 DEFAULT vsteps 32 6867 MIN vsteps 2 6868 MAX vsteps 10000 6869 >>> 6870 6871 6872 Converters 6873 ========== 6874 6875 Can be converted to: 6876 -------------------- 6877 6878 - L{CoordinateGrid2D} 6879 - L{view converter (#29) <spyderconverterfunction_29>} 6880 @ivar xformula: 6881 @type xformula: L{String} 6882 @ivar yformula: 6883 @type yformula: L{String} 6884 @ivar zformula: 6885 @type zformula: L{String} 6886 @ivar umin: 6887 @type umin: L{Float} 6888 @ivar umax: 6889 @type umax: L{Float} 6890 @ivar usteps: 6891 @type usteps: L{Integer} 6892 @ivar vmin: 6893 @type vmin: L{Float} 6894 @ivar vmax: 6895 @type vmax: L{Float} 6896 @ivar vsteps: 6897 @type vsteps: L{Integer} 6898 @ivar uwrap: 6899 @type uwrap: L{Bool} 6900 @ivar vwrap: 6901 @type vwrap: L{Bool} 6902 @sort: xformula,yformula,zformula,umin,umax,usteps,vmin,vmax,vsteps,uwrap,vwrap 6903 """ 6904 6905 @staticmethod
6906 - def three_dimensional(): return True
6907 uwrap = True 6908 vwrap = True
6909 -def spyderconverterfunction_29(p):
6910 vertices = [] 6911 func1 = formula.formula(p.xformula,["u","v"]) 6912 func2 = formula.formula(p.yformula,["u","v"]) 6913 func3 = formula.formula(p.zformula,["u","v"]) 6914 for u in range(p.usteps): 6915 curru = p.umin + float(u)/(p.usteps-1) * (p.umax - p.umin) 6916 for v in range(p.vsteps): 6917 currv = p.vmin + float(v)/(p.vsteps-1) * (p.vmax - p.vmin) 6918 currvertex = [func1(curru,currv),func2(curru,currv), func3(curru,currv)] 6919 vertices.append(currvertex) 6920 return CoordinateGrid2D(vertices=vertices,x=p.usteps,y=p.vsteps,xwrap=p.uwrap,ywrap=p.vwrap)
6921
6922 -class CoordinateGrid2D(object):
6923 """ 6924 Spyder-generated class 6925 6926 module models3d 6927 6928 6929 file /home/sjoerd/data/Spyder-devel/models3d/formulagrid.spy 6930 6931 6932 6933 Description 6934 =========== 6935 6936 6937 6938 A 2D grid of 3D coordinates 6939 6940 6941 6942 6943 6944 6945 Wiki 6946 ==== 6947 U{http://www.spyderware.nl/wiki/classes/CoordinateGrid2D} 6948 6949 Validate block 6950 ============== 6951 6952 >>> 6953 assert x >= 2 6954 assert y >= 2 6955 assert len(vertices) == x * y 6956 >>> 6957 6958 6959 Converters 6960 ========== 6961 6962 Can be converted to: 6963 -------------------- 6964 6965 - L{Object3D} 6966 - L{view converter (#30) <spyderconverterfunction_30>} 6967 6968 Can be converted from: 6969 ---------------------- 6970 6971 - L{FormulaGrid2D} 6972 - L{view converter (#29) <spyderconverterfunction_29>} 6973 @ivar vertices: 6974 @type vertices: L{CoordinateArray<Coordinate>} 6975 @ivar x: 6976 @type x: L{Integer} 6977 @ivar y: 6978 @type y: L{Integer} 6979 @ivar xwrap: 6980 @type xwrap: L{Bool} 6981 @ivar ywrap: 6982 @type ywrap: L{Bool} 6983 @ivar material: 6984 @type material: L{Material} 6985 @ivar axis: 6986 @type axis: L{AxisSystem} 6987 @sort: vertices,x,y,xwrap,ywrap,material,axis 6988 """ 6989 6990 xwrap = False 6991 ywrap = False 6992 material = "defaultmaterial" 6993 axis = AxisSystem()
6994 -def spyderconverterfunction_30(g):
6995 faces = [] 6996 for currx in range(g.x): 6997 nextx = currx + 1 6998 if nextx == g.x: 6999 if g.xwrap == False: continue 7000 nextx = 0 7001 for curry in range(g.y): 7002 nexty = curry + 1 7003 if nexty == g.y: 7004 if g.ywrap == False: continue 7005 nexty = 0 7006 v1 = g.y * currx + curry 7007 v2 = g.y * currx + nexty 7008 v3 = g.y * nextx + nexty 7009 v4 = g.y * nextx + curry 7010 currface = [v1,v2,v3,v4] 7011 faces.append(currface) 7012 return Object3D(vertices=g.vertices,faces=faces,axis=g.axis,material=g.material)
7013
7014 -class House3DDoor(object):
7015 """ 7016 Spyder-generated class 7017 7018 module models3d 7019 7020 7021 file /home/sjoerd/data/Spyder-devel/models3d/house.spy 7022 7023 7024 7025 Wiki 7026 ==== 7027 U{http://www.spyderware.nl/wiki/classes/House3DDoor} 7028 7029 Validate block 7030 ============== 7031 7032 >>> 7033 assert position >= 0 7034 assert width > 0 7035 assert height > 0 7036 >>> 7037 7038 7039 Form block 7040 ========== 7041 7042 >>> 7043 DEFAULT position 2 7044 MIN position 0 7045 MAX position 100 7046 DEFAULT width 2 7047 MIN width 0 7048 MAX width 100 7049 DEFAULT height 2 7050 MIN height 0 7051 MAX height 100 7052 >>> 7053 7054 @ivar position: 7055 @type position: L{Integer} 7056 @ivar width: 7057 @type width: L{Integer} 7058 @ivar height: 7059 @type height: L{Integer} 7060 @sort: position,width,height 7061 """
7062
7063 -class House3DWallWindow(House3DDoor):
7064 """ 7065 Spyder-generated class 7066 7067 module models3d 7068 7069 7070 file /home/sjoerd/data/Spyder-devel/models3d/house.spy 7071 7072 7073 7074 Wiki 7075 ==== 7076 U{http://www.spyderware.nl/wiki/classes/House3DWallWindow} 7077 7078 Validate block 7079 ============== 7080 7081 >>> 7082 assert verticalposition > 0 7083 >>> 7084 7085 7086 Form block 7087 ========== 7088 7089 >>> 7090 DEFAULT verticalposition 2 7091 MIN verticalposition 0 7092 MAX verticalposition 100 7093 >>> 7094 7095 @ivar verticalposition: 7096 @type verticalposition: L{Integer} 7097 @sort: verticalposition 7098 """
7099
7100 -class House3DWall(object):
7101 """ 7102 Spyder-generated class 7103 7104 module models3d 7105 7106 7107 file /home/sjoerd/data/Spyder-devel/models3d/house.spy 7108 7109 7110 7111 Wiki 7112 ==== 7113 U{http://www.spyderware.nl/wiki/classes/House3DWall} 7114 7115 Validate block 7116 ============== 7117 7118 >>> 7119 for w in windows: 7120 assert w.verticalposition + w.height <= height 7121 poswidth = list(windows) 7122 poswidth += list(doors) 7123 poswidth.sort(lambda a,b: cmp(a.position, b.position)) 7124 for n in range(len(poswidth)): 7125 if n < len(poswidth) - 1: nextpos = poswidth[n+1].position 7126 else: nextpos = width 7127 assert poswidth[n].position + poswidth[n].width <= nextpos 7128 >>> 7129 7130 7131 Form block 7132 ========== 7133 7134 >>> 7135 MATRIX axis 7136 DEFAULT width 10 7137 MIN width 0 7138 MAX width 100 7139 DEFAULT thickness 2 7140 MIN thickness 0 7141 MAX thickness 100 7142 DEFAULT height 5 7143 MIN height 0 7144 MAX height 100 7145 >>> 7146 7147 7148 Converters 7149 ========== 7150 7151 Can be converted to: 7152 -------------------- 7153 7154 - L{ObjectGroup3D} 7155 - L{view converter (#31) <spyderconverterfunction_31>} 7156 @ivar width: 7157 @type width: L{Integer} 7158 @ivar height: 7159 @type height: L{Integer} 7160 @ivar thickness: 7161 @type thickness: L{Integer} 7162 @ivar doors: 7163 @type doors: L{House3DDoorArray<House3DDoor>} 7164 @ivar windows: 7165 @type windows: L{House3DWallWindowArray<House3DWallWindow>} 7166 @ivar axis: 7167 @type axis: L{AxisSystem} 7168 @ivar material: 7169 @type material: L{Material} 7170 @sort: width,height,thickness,doors,windows,axis,material 7171 """ 7172 7173 @staticmethod
7174 - def three_dimensional(): return True
7175 doors = [] 7176 windows = [] 7177 axis = AxisSystem() 7178 material = "defaultmaterial"
7179 -def spyderconverterfunction_31(wall):
7180 poswidth = list(wall.windows) 7181 poswidth += list(wall.doors) 7182 poswidth.sort(lambda a,b: cmp(a.position, b.position)) 7183 blocks = Block3DArray() 7184 currwidth = 0 7185 for o in poswidth: 7186 y = o.position-currwidth 7187 if y > 0: blocks.append(Block3D((wall.thickness,o.position-currwidth,wall.height),axis=AxisSystem(origin=(0,currwidth,0)),pivot="corner",material=wall.material)) 7188 bottom = 0 7189 if o.typename() == "House3DWallWindow": 7190 bottom = o.verticalposition 7191 blocks.append(Block3D((wall.thickness,o.width,wall.height-(bottom+o.height)),axis=AxisSystem(origin=(0,o.position,bottom+o.height)),pivot="corner",material=wall.material)) 7192 if o.typename() == "House3DWallWindow": 7193 blocks.append(Block3D((wall.thickness,o.width,bottom),axis=AxisSystem(origin=(0,o.position,0)),pivot="corner",material=wall.material)) 7194 currwidth = o.position + o.width 7195 blocks.append(Block3D((wall.thickness,wall.width-currwidth,wall.height),axis=AxisSystem(origin=(0,currwidth,0)),pivot="corner",material=wall.material)) 7196 group = ObjectList3D(blocks) 7197 return ObjectGroup3D(group=group,axis=wall.axis)
7198
7199 -class House3DFloor(object):
7200 """ 7201 Spyder-generated class 7202 7203 module models3d 7204 7205 7206 file /home/sjoerd/data/Spyder-devel/models3d/house.spy 7207 7208 7209 7210 Wiki 7211 ==== 7212 U{http://www.spyderware.nl/wiki/classes/House3DFloor} 7213 @ivar northwindows: 7214 @type northwindows: L{House3DWallWindowArray<House3DWallWindow>} 7215 @ivar eastwindows: 7216 @type eastwindows: L{House3DWallWindowArray<House3DWallWindow>} 7217 @ivar southwindows: 7218 @type southwindows: L{House3DWallWindowArray<House3DWallWindow>} 7219 @ivar westwindows: 7220 @type westwindows: L{House3DWallWindowArray<House3DWallWindow>} 7221 @sort: northwindows,eastwindows,southwindows,westwindows 7222 """ 7223 7224 northwindows = [] 7225 eastwindows = [] 7226 southwindows = [] 7227 westwindows = []
7228 -class House3DGroundFloor(object):
7229 """ 7230 Spyder-generated class 7231 7232 module models3d 7233 7234 7235 file /home/sjoerd/data/Spyder-devel/models3d/house.spy 7236 7237 7238 7239 Wiki 7240 ==== 7241 U{http://www.spyderware.nl/wiki/classes/House3DGroundFloor} 7242 @ivar northdoors: 7243 @type northdoors: L{House3DDoorArray<House3DDoor>} 7244 @ivar northwindows: 7245 @type northwindows: L{House3DWallWindowArray<House3DWallWindow>} 7246 @ivar eastdoors: 7247 @type eastdoors: L{House3DDoorArray<House3DDoor>} 7248 @ivar eastwindows: 7249 @type eastwindows: L{House3DWallWindowArray<House3DWallWindow>} 7250 @ivar southdoors: 7251 @type southdoors: L{House3DDoorArray<House3DDoor>} 7252 @ivar southwindows: 7253 @type southwindows: L{House3DWallWindowArray<House3DWallWindow>} 7254 @ivar westdoors: 7255 @type westdoors: L{House3DDoorArray<House3DDoor>} 7256 @ivar westwindows: 7257 @type westwindows: L{House3DWallWindowArray<House3DWallWindow>} 7258 @sort: northdoors,northwindows,eastdoors,eastwindows,southdoors,southwindows,westdoors,westwindows 7259 """ 7260 7261 northdoors = [] 7262 northwindows = [] 7263 eastdoors = [] 7264 eastwindows = [] 7265 southdoors = [] 7266 southwindows = [] 7267 westdoors = [] 7268 westwindows = []
7269 -class House3D(object):
7270 """ 7271 Spyder-generated class 7272 7273 module models3d 7274 7275 7276 file /home/sjoerd/data/Spyder-devel/models3d/house.spy 7277 7278 7279 7280 Wiki 7281 ==== 7282 U{http://www.spyderware.nl/wiki/classes/House3D} 7283 7284 Validate block 7285 ============== 7286 7287 >>> 7288 assert width > 2 * thickness 7289 >>> 7290 7291 7292 Form block 7293 ========== 7294 7295 >>> 7296 BLENDER 7297 MATRIX axis 7298 DEFAULT width 10 7299 MIN width 0 7300 MAX width 100 7301 DEFAULT thickness 2 7302 MIN thickness 0 7303 MAX thickness 100 7304 DEFAULT height 5 7305 MIN height 0 7306 MAX height 100 7307 ELEDEFAULT floors House3DFloor() 7308 DEFAULT floorthickness 1 7309 MIN floorthickness 0 7310 MAX floorthickness 10 7311 DEFAULT roofheight 5 7312 MIN roofheight 0 7313 MAX roofheight 10 7314 DEFAULT roofmargin 1 7315 MIN roofmargin 0 7316 MAX roofmargin 5 7317 >>> 7318 7319 7320 Converters 7321 ========== 7322 7323 Can be converted to: 7324 -------------------- 7325 7326 - L{ObjectGroup3D} 7327 - L{view converter (#33) <spyderconverterfunction_33>} 7328 @ivar groundfloor: 7329 @type groundfloor: L{House3DGroundFloor} 7330 @ivar floors: 7331 @type floors: L{House3DFloorArray<House3DFloor>} 7332 @ivar width: 7333 @type width: L{Integer} 7334 @ivar height: 7335 @type height: L{Integer} 7336 @ivar thickness: 7337 @type thickness: L{Integer} 7338 @ivar axis: 7339 @type axis: L{AxisSystem} 7340 @ivar floorthickness: 7341 @type floorthickness: L{Integer} 7342 @ivar roofheight: 7343 @type roofheight: L{Integer} 7344 @ivar roofmargin: 7345 @type roofmargin: L{Integer} 7346 @ivar wallmaterial: 7347 @type wallmaterial: L{Material} 7348 @ivar floormaterial: 7349 @type floormaterial: L{Material} 7350 @ivar roofmaterial: 7351 @type roofmaterial: L{Material} 7352 @sort: groundfloor,floors,width,height,thickness,axis,floorthickness,roofheight,roofmargin,wallmaterial,floormaterial,roofmaterial 7353 """ 7354 7355 @staticmethod
7356 - def three_dimensional(): return True
7357 groundfloor = House3DGroundFloor() 7358 floors = [] 7359 axis = AxisSystem() 7360 floorthickness = 1 7361 roofheight = 5 7362 roofmargin = 1 7363 wallmaterial = "brick" 7364 floormaterial = "white marble" 7365 roofmaterial = "black limestone"
7366 -class Pyramid(object):
7367 """ 7368 Spyder-generated class 7369 7370 module models3d 7371 7372 7373 file /home/sjoerd/data/Spyder-devel/models3d/house.spy 7374 7375 7376 7377 Wiki 7378 ==== 7379 U{http://www.spyderware.nl/wiki/classes/Pyramid} 7380 7381 Converters 7382 ========== 7383 7384 Can be converted to: 7385 -------------------- 7386 7387 - L{Object3D} 7388 - L{view converter (#32) <spyderconverterfunction_32>} 7389 @ivar length: 7390 @type length: L{Float} 7391 @ivar width: 7392 @type width: L{Float} 7393 @ivar height: 7394 @type height: L{Float} 7395 @ivar axis: 7396 @type axis: L{AxisSystem} 7397 @ivar material: 7398 @type material: L{Material} 7399 @sort: length,width,height,axis,material 7400 """ 7401 7402 @staticmethod
7403 - def three_dimensional(): return True
7404 material = "defaultmaterial"
7405 -def spyderconverterfunction_32(p):
7406 x = -0.5*p.length 7407 y = -0.5*p.width 7408 vertices = ( 7409 (-x,-y, 0), 7410 (-x,y,0), 7411 (x,y,0), 7412 (x,-y,0), 7413 (0,0,p.height), 7414 ) 7415 faces = ((0,1,2,3),(1,0,4), (2,1,4), (3,2,4), (0,3,4)) 7416 return Object3D(faces=faces,vertices=vertices,axis=p.axis, material = p.material)
7417
7418 -def spyderconverterfunction_33(house):
7419 NewMaterial("brick", color=(205,90,90)).show() 7420 NewMaterial("white marble", color=(180,180,180)).show() 7421 NewMaterial("black limestone", color=(65,55,65)).show() 7422 mw = (house.width-house.thickness) 7423 walls = ObjectList3D() 7424 z = 0 7425 ground = True 7426 for floor in [house.groundfloor] + house.floors: 7427 w = House3DWall( 7428 house.width,house.height,house.thickness, 7429 windows = floor.northwindows, 7430 axis = AxisSystem(origin=(0.5*mw,0.5*mw,z),x=(0,1,0),y=(-1,0,0)), 7431 material=house.wallmaterial, 7432 ) 7433 if ground: w.doors = floor.northdoors 7434 walls.append(w) 7435 w = House3DWall( 7436 house.width,house.height,house.thickness, 7437 windows = floor.eastwindows, 7438 axis = AxisSystem(origin=(0.5*mw,-0.5*mw,z)), 7439 material=house.wallmaterial, 7440 ) 7441 if ground: w.doors = floor.eastdoors 7442 walls.append(w) 7443 w = House3DWall( 7444 house.width,house.height,house.thickness, 7445 windows = floor.southwindows, 7446 axis = AxisSystem(origin=(-0.5*mw,-0.5*mw,z),x=(0,-1,0),y=(1,0,0)), 7447 material=house.wallmaterial, 7448 ) 7449 if ground: w.doors = floor.southdoors 7450 walls.append(w) 7451 w = House3DWall( 7452 house.width,house.height,house.thickness, 7453 windows = floor.westwindows, 7454 axis = AxisSystem(origin=(-0.5*mw,0.5*mw,z),x=(-1,0,0),y=(0,-1,0)), 7455 material=house.wallmaterial, 7456 ) 7457 if ground: w.doors = floor.westdoors 7458 walls.append(w) 7459 ground = False 7460 z += house.height 7461 group = walls 7462 group.append(Block3D((house.width+house.thickness,house.width+house.thickness,house.floorthickness),axis=AxisSystem(origin=(0,0,-.5*house.floorthickness)),material=house.floormaterial)) 7463 z = 0 7464 for floor in house.floors: 7465 z += house.height 7466 group.append(Block3D((house.width,house.width,house.floorthickness),axis=AxisSystem(origin=(0,0,-.5*house.floorthickness+z)),material=house.floormaterial)) 7467 z += house.height 7468 x = house.width+house.roofmargin+house.thickness 7469 group.append(Pyramid(x,x,house.roofheight,axis=AxisSystem(origin=(0,0,z)),material=house.roofmaterial)) 7470 return ObjectGroup3D(group=group,axis=house.axis)
7471
7472 -class Sphere3D(object):
7473 """ 7474 Spyder-generated class 7475 7476 module models3d 7477 7478 7479 file /home/sjoerd/data/Spyder-devel/models3d/sphere.spy 7480 7481 7482 7483 Wiki 7484 ==== 7485 U{http://www.spyderware.nl/wiki/classes/Sphere3D} 7486 7487 Validate block 7488 ============== 7489 7490 >>> 7491 assert radius >= 0 7492 assert subdivisions >= 0 and subdivisions <= 10 7493 >>> 7494 7495 7496 Form block 7497 ========== 7498 7499 >>> 7500 BLENDER 7501 MATRIX axis 7502 MIN radius 0 7503 MAX radius 100 7504 DEFAULT radius 10 7505 MIN subdivisions 0 7506 MAX subdivisions 10 7507 DEFAULT subdivisions 0 7508 >>> 7509 7510 7511 Converters 7512 ========== 7513 7514 Can be converted to: 7515 -------------------- 7516 7517 - L{Object3D} 7518 - L{view converter (#34) <spyderconverterfunction_34>} 7519 @ivar radius: 7520 @type radius: L{Float} 7521 @ivar subdivisions: 7522 @type subdivisions: L{Integer} 7523 @ivar axis: 7524 @type axis: L{AxisSystem} 7525 @ivar material: 7526 @type material: L{Material} 7527 @sort: radius,subdivisions,axis,material 7528 """ 7529 7530 @staticmethod
7531 - def three_dimensional(): return True
7532 axis = AxisSystem() 7533 material = "defaultmaterial"
7534 -def spyderconverterfunction_34(s):
7535 a = 0.5 7536 points = [[-a,0,0],[a,0,0],[0,-a,0],[0,a,0],[0,0,-a],[0,0,a]] 7537 faces = [[0,5,3],[5,1,3],[1,4,3],[4,0,3],[2,5,0],[2,1,5],[2,4,1],[2,0,4]] 7538 points = CoordinateArray(points) 7539 edges = [] 7540 for f in faces: 7541 for n in f: 7542 for nn in f: 7543 if n != nn and (n,nn) not in edges and (nn,n) not in edges: edges.append((n,nn)) 7544 for i in range(s.subdivisions): 7545 newfaces = [] 7546 newedges = [] 7547 emap = {} 7548 for v1,v2 in edges: 7549 avg = (points[v1] + points[v2]) / 2 7550 lp = len(points) 7551 emap[v1,v2] = lp 7552 emap[v2,v1] = lp 7553 newedges.append((v1,lp)) 7554 newedges.append((v2,lp)) 7555 points.append(avg) 7556 for f in faces: 7557 e1 = emap[f[0],f[1]] 7558 e2 = emap[f[1],f[2]] 7559 e3 = emap[f[2],f[0]] 7560 newfaces.append([e3,f[0],e1]) 7561 newfaces.append([e1,f[1],e2]) 7562 newfaces.append([e2,f[2],e3]) 7563 newfaces.append([e1,e2,e3]) 7564 newedges.append([e1,e2]) 7565 newedges.append([e2,e3]) 7566 newedges.append([e3,e1]) 7567 faces = newfaces 7568 edges = newedges 7569 for pnr in range(len(points)): 7570 points[pnr] = points[pnr] * (s.radius/points[pnr].size()) 7571 return Object3D(vertices=points, faces=faces,axis=s.axis,material=s.material)
7572
7573 -class SphereCloud3D(object):
7574 """ 7575 Spyder-generated class 7576 7577 module models3d 7578 7579 7580 file /home/sjoerd/data/Spyder-devel/models3d/sphere.spy 7581 7582 7583 7584 Wiki 7585 ==== 7586 U{http://www.spyderware.nl/wiki/classes/SphereCloud3D} 7587 7588 Validate block 7589 ============== 7590 7591 >>> 7592 assert radius >= 0 7593 assert nrpoints >= 8 7594 >>> 7595 7596 7597 Form block 7598 ========== 7599 7600 >>> 7601 BLENDER 7602 MATRIX axis 7603 MIN radius 0 7604 MAX radius 100 7605 DEFAULT radius 10 7606 RANGE nrpoints 8 7607 DEFAULT nrpoints 16 7608 >>> 7609 7610 7611 Converters 7612 ========== 7613 7614 Can be converted to: 7615 -------------------- 7616 7617 - L{Block3DArray<Block3D>} 7618 - L{view converter (#35) <spyderconverterfunction_35>} 7619 @ivar radius: 7620 @type radius: L{Float} 7621 @ivar nrpoints: 7622 @type nrpoints: L{Integer} 7623 @ivar axis: 7624 @type axis: L{AxisSystem} 7625 @sort: radius,nrpoints,axis 7626 """ 7627 7628 @staticmethod
7629 - def three_dimensional(): return True
7630 axis = AxisSystem()
7631 -def spyderconverterfunction_35(sphere):
7632 points = spheresample(sphere.nrpoints) 7633 points = CoordinateArray(points) 7634 for pnr in range(len(points)): points[pnr] *= sphere.radius 7635 ret = Block3DArray() 7636 for p in points: 7637 b = Block3D((.3,.3,.3),axis=sphere.axis) 7638 b.axis.origin += p 7639 ret.append(b) 7640 return ret
7641
7642 -class Chunk3D(object):
7643 """ 7644 Spyder-generated class 7645 7646 module models3d 7647 7648 7649 file /home/sjoerd/data/Spyder-devel/models3d/chunk.spy 7650 7651 7652 7653 Description 7654 =========== 7655 7656 7657 7658 Quick way to construct a three-dimensional segment or chunk, 7659 7660 7661 consisting of two planes of an equal number of sides, 7662 7663 7664 with an edge between point 1 of plane 1 and point 1 of plane 2, etc. 7665 7666 7667 7668 7669 7670 7671 Wiki 7672 ==== 7673 U{http://www.spyderware.nl/wiki/classes/Chunk3D} 7674 7675 Validate block 7676 ============== 7677 7678 >>> 7679 assert len(plane1) > 2 7680 assert len(plane2) == len(plane1) 7681 >>> 7682 7683 7684 Converters 7685 ========== 7686 7687 Can be converted to: 7688 -------------------- 7689 7690 - L{Object3D} 7691 - L{view converter (#36) <spyderconverterfunction_36>} 7692 @ivar plane1: 7693 @type plane1: L{CoordinateArray<Coordinate>} 7694 @ivar plane2: 7695 @type plane2: L{CoordinateArray<Coordinate>} 7696 @ivar axis: 7697 @type axis: L{AxisSystem} 7698 @ivar material: 7699 @type material: L{Material} 7700 @sort: plane1,plane2,axis,material 7701 """ 7702 7703 @staticmethod
7704 - def three_dimensional(): return True
7705 axis = AxisSystem() 7706 material = "defaultmaterial"
7707 -def spyderconverterfunction_36(ch):
7708 planelen = len(ch.plane1) 7709 avg1 = reduce(lambda a,b: a+b, ch.plane1, Coordinate(0,0,0))/planelen 7710 avg2 = reduce(lambda a,b: a+b, ch.plane2, Coordinate(0,0,0))/planelen 7711 dif = avg2 - avg1 7712 normals = [] 7713 for plane, d in ((ch.plane1, dif), (ch.plane2,-dif)): 7714 v1 = plane[1] - plane[0] 7715 sum = Coordinate(0,0,0) 7716 nr2 = 1 7717 for n in range(planelen): 7718 nr3 = (n + 2) % (planelen) 7719 v2 = plane[nr3] - plane[nr2] 7720 cross = v1.crossproduct(v2) 7721 if cross * d > 0: cross *= -1 7722 sum += cross 7723 nr2 = nr3 7724 v1 = v2 7725 sum = sum.normalize() 7726 normals.append(sum) 7727 verts = [] 7728 for v in ch.plane1: 7729 vv = v - avg1 7730 v2 = (vv - vv * (vv * normals[0])).normalize() 7731 verts.append(v2) 7732 vertorder = [0] 7733 for n in range(1,planelen): 7734 currvert = verts[vertorder[-1]] 7735 recordnr = -1 7736 record = -999999 7737 for nn in range(planelen): 7738 if nn in vertorder: continue 7739 v = verts[nn] 7740 if currvert.crossproduct(v) * normals[0] < 0: continue 7741 dotp = v * currvert 7742 if dotp > record: 7743 record = dotp 7744 recordnr = nn 7745 vertorder.append(recordnr) 7746 edges = [(n,planelen+n) for n in range(planelen)] + \ 7747 [[n,n+1] for n in range(planelen-1)] + [(planelen-1,0)] + \ 7748 [[planelen+n,planelen+n+1] for n in range(planelen-1)] + [(2*planelen-1,planelen)] 7749 vertices = [ch.plane1[n] for n in vertorder] + [ch.plane2[n] for n in vertorder] 7750 faces = [range(planelen)] + [reversed(range(planelen,2*planelen))] + \ 7751 [[n+1,n,n+planelen,n+planelen+1] for n in range(planelen-1)] + \ 7752 [[0, planelen-1, 2*planelen-1, planelen]] 7753 return Object3D(vertices=vertices, 7754 faces=faces, 7755 edges=edges, 7756 material = ch.material, 7757 axis = ch.axis 7758 )
7759
7760 7761 -class HaddockValidationError(Spyder.atom.AtomValidationError):
7762 """Parent class: U{(Spyder.atom.AtomValidationError)<http://www.spyderware.nl/doc/Spyder.Spyder.atom.AtomValidationError-class.html>}""" 7763 pass 7764
7765 -class LigandData(object):
7766 """ 7767 Spyder-generated class 7768 7769 module haddock 7770 7771 7772 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 7773 7774 7775 7776 Wiki 7777 ==== 7778 U{http://www.spyderware.nl/wiki/classes/LigandData} 7779 @ivar name: 7780 @type name: L{String} 7781 @ivar residues: 7782 @type residues: L{StringArray<String>} 7783 @ivar defined_as_hetero: 7784 @type defined_as_hetero: L{Bool} 7785 @sort: name,residues,defined_as_hetero 7786 """ 7787 7788 defined_as_hetero = False
7789 -class HistidineState(object):
7790 """ 7791 Spyder-generated class 7792 7793 module haddock 7794 7795 7796 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 7797 7798 7799 7800 Description 7801 =========== 7802 7803 7804 7805 Describes the protonation state of histidine residue 7806 7807 7808 HISD: proton on the delta nitrogen (neutral charge) 7809 7810 7811 HISE: proton on the epsilon nitrogen (neutral charge) 7812 7813 7814 HIS+: proton on both nitrogens (positive charge) 7815 7816 7817 7818 7819 7820 7821 Wiki 7822 ==== 7823 U{http://www.spyderware.nl/wiki/classes/HistidineState} 7824 7825 Validate block 7826 ============== 7827 7828 >>> 7829 if state != None: assert state in ("HISD", "HISE", "HIS+") 7830 >>> 7831 7832 7833 Form block 7834 ========== 7835 7836 >>> 7837 OPTION state "HISD", "HISE", "HIS+" 7838 TYPE resid required 7839 resid Residue number 7840 state Protonation state 7841 >>> 7842 7843 @ivar resid: 7844 @type resid: L{*Integer<Integer>} 7845 @ivar state: 7846 @type state: L{String} 7847 @sort: resid,state 7848 """
7849
7850 -class LabeledRangePair(object):
7851 """ 7852 Spyder-generated class 7853 7854 module haddock 7855 7856 7857 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 7858 7859 7860 7861 Description 7862 =========== 7863 7864 7865 7866 Describes a pair of protein segments of equal length 7867 7868 7869 Used to define C2 symmetry in HADDOCK 7870 7871 7872 7873 7874 7875 7876 Wiki 7877 ==== 7878 U{http://www.spyderware.nl/wiki/classes/LabeledRangePair} 7879 7880 Validate block 7881 ============== 7882 7883 >>> 7884 assert r == None or len(r) == 2 7885 assert (r[1].end - r[1].start) == (r[0].end - r[0].start) 7886 for rr in r: assert rr.chain != "All" 7887 >>> 7888 7889 7890 Form block 7891 ========== 7892 7893 >>> 7894 LENGTH r 2 7895 r Segment 7896 >>> 7897 7898 @ivar r: 7899 @type r: L{LabeledRangeArray<LabeledRange>} 7900 @sort: r 7901 """
7902
7903 -class LabeledRangeTriple(object):
7904 """ 7905 Spyder-generated class 7906 7907 module haddock 7908 7909 7910 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 7911 7912 7913 7914 Description 7915 =========== 7916 7917 7918 7919 Describes a triple of protein segments of equal length 7920 7921 7922 Used to define C3 symmetry in HADDOCK 7923 7924 7925 7926 7927 7928 7929 Wiki 7930 ==== 7931 U{http://www.spyderware.nl/wiki/classes/LabeledRangeTriple} 7932 7933 Validate block 7934 ============== 7935 7936 >>> 7937 assert r == None or len(r) == 3 7938 assert (r[1].end - r[1].start) == (r[0].end - r[0].start) 7939 assert (r[2].end - r[2].start) == (r[0].end - r[0].start) 7940 for rr in r: assert rr.chain != "All" 7941 >>> 7942 7943 7944 Form block 7945 ========== 7946 7947 >>> 7948 LENGTH r 3 7949 r Segment 7950 >>> 7951 7952 @ivar r: 7953 @type r: L{LabeledRangeArray<LabeledRange>} 7954 @sort: r 7955 """
7956
7957 -class LabeledRangeQuadruple(object):
7958 """ 7959 Spyder-generated class 7960 7961 module haddock 7962 7963 7964 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 7965 7966 7967 7968 Description 7969 =========== 7970 7971 7972 7973 Describes a quadruple of protein segments of equal length 7974 7975 7976 Used to define C4 symmetry in HADDOCK 7977 7978 7979 7980 7981 7982 7983 Wiki 7984 ==== 7985 U{http://www.spyderware.nl/wiki/classes/LabeledRangeQuadruple} 7986 7987 Validate block 7988 ============== 7989 7990 >>> 7991 assert r == None or len(r) == 4 7992 assert (r[1].end - r[1].start) == (r[0].end - r[0].start) 7993 assert (r[2].end - r[2].start) == (r[0].end - r[0].start) 7994 assert (r[3].end - r[3].start) == (r[0].end - r[0].start) 7995 for rr in r: assert rr.chain != "All" 7996 >>> 7997 7998 7999 Form block 8000 ========== 8001 8002 >>> 8003 LENGTH r 4 8004 r Segment 8005 >>> 8006 8007 @ivar r: 8008 @type r: L{LabeledRangeArray<LabeledRange>} 8009 @sort: r 8010 """
8011
8012 -class LabeledRangeQuintuple(object):
8013 """ 8014 Spyder-generated class 8015 8016 module haddock 8017 8018 8019 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8020 8021 8022 8023 Description 8024 =========== 8025 8026 8027 8028 Describes a quintuple of protein segments of equal length 8029 8030 8031 Used to define C5 symmetry in HADDOCK 8032 8033 8034 8035 8036 8037 8038 Wiki 8039 ==== 8040 U{http://www.spyderware.nl/wiki/classes/LabeledRangeQuintuple} 8041 8042 Validate block 8043 ============== 8044 8045 >>> 8046 assert r == None or len(r) == 5 8047 assert (r[1].end - r[1].start) == (r[0].end - r[0].start) 8048 assert (r[2].end - r[2].start) == (r[0].end - r[0].start) 8049 assert (r[3].end - r[3].start) == (r[0].end - r[0].start) 8050 assert (r[4].end - r[4].start) == (r[0].end - r[0].start) 8051 for rr in r: assert rr.chain != "All" 8052 >>> 8053 8054 8055 Form block 8056 ========== 8057 8058 >>> 8059 LENGTH r 5 8060 r Segment 8061 >>> 8062 8063 @ivar r: 8064 @type r: L{LabeledRangeArray<LabeledRange>} 8065 @sort: r 8066 """
8067
8068 -class SegmentList(object):
8069 """ 8070 Spyder-generated class 8071 8072 module haddock 8073 8074 8075 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8076 8077 8078 8079 Description 8080 =========== 8081 8082 8083 8084 List of protein segments 8085 8086 8087 Used to define fully flexible segments in HADDOCK 8088 8089 8090 8091 8092 8093 8094 Wiki 8095 ==== 8096 U{http://www.spyderware.nl/wiki/classes/SegmentList} 8097 8098 Length block 8099 ============ 8100 8101 >>> 8102 return len(self.segments) 8103 >>> 8104 8105 8106 Form block 8107 ========== 8108 8109 >>> 8110 TYPE segments required 8111 segments Segment 8112 HEADER segments These segments will be allowed to move at all stages of it1 8113 >>> 8114 8115 @ivar segments: 8116 @type segments: L{RangeArray<Range>} 8117 @sort: segments 8118 """ 8119 8120 segments = []
8121 -class SemiflexSegmentList(object):
8122 """ 8123 Spyder-generated class 8124 8125 module haddock 8126 8127 8128 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8129 8130 8131 8132 Description 8133 =========== 8134 8135 8136 8137 List of protein segments 8138 8139 8140 Used to define semi-flexible segments in HADDOCK 8141 8142 8143 Can be defined as: 8144 8145 8146 - manual (segments must be provided) 8147 8148 8149 - automatic (no segments must be defined; 8150 8151 8152 segments are automatically defined by HADDOCK for each structure) 8153 8154 8155 - full (the whole protein is semi-flexible, no segments must be defined) 8156 8157 8158 8159 8160 8161 8162 Wiki 8163 ==== 8164 U{http://www.spyderware.nl/wiki/classes/SemiflexSegmentList} 8165 8166 Length block 8167 ============ 8168 8169 >>> 8170 return len(self.segments) 8171 >>> 8172 8173 8174 Validate block 8175 ============== 8176 8177 >>> 8178 if mode != None: assert mode in ("manual", "automatic", "full") 8179 l = len(segments) 8180 if mode == "manual" and l == 0: 8181 raise HaddockValidationError("You defined manual semi-flexible segment specification, but you did not define any segments.") 8182 if mode == "automatic" and l > 0: 8183 raise HaddockValidationError("You defined automatic semi-flexible segment specification, but you also manually defined segments.") 8184 if mode == "automatic" and l > 0: 8185 raise HaddockValidationError("You specified the whole protein to be semi-flexible, but you also manually defined semi-flexible segments.") 8186 >>> 8187 8188 8189 Form block 8190 ========== 8191 8192 >>> 8193 OPTION mode "manual", "automatic", "full" 8194 TYPE segments required 8195 segments Segment 8196 mode How are the flexible segments defined 8197 HEADER mode Side-chains and backbone of these residues will be allowed to move during semi-flexible refinement 8198 >>> 8199 8200 @ivar mode: 8201 @type mode: L{String} 8202 @ivar segments: 8203 @type segments: L{RangeArray<Range>} 8204 @sort: mode,segments 8205 """ 8206 8207 segments = []
8208 -class SymmetrySpecification(object):
8209 """ 8210 Spyder-generated class 8211 8212 module haddock 8213 8214 8215 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8216 8217 8218 8219 Description 8220 =========== 8221 8222 8223 8224 Using a symmetry type in HADDOCK 8225 8226 8227 8228 8229 8230 8231 Wiki 8232 ==== 8233 U{http://www.spyderware.nl/wiki/classes/SymmetrySpecification} 8234 @ivar on: 8235 @type on: L{Bool} 8236 @ivar constant: 8237 @type constant: L{Float} 8238 @sort: on,constant 8239 """
8240
8241 -class StageConstants(object):
8242 """ 8243 Spyder-generated class 8244 8245 module haddock 8246 8247 8248 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8249 8250 8251 8252 Description 8253 =========== 8254 8255 8256 8257 Energy constants for a refinement stage 8258 8259 8260 8261 8262 8263 8264 Wiki 8265 ==== 8266 U{http://www.spyderware.nl/wiki/classes/StageConstants} 8267 @ivar hot: 8268 @type hot: L{Float} 8269 @ivar cool1: 8270 @type cool1: L{Float} 8271 @ivar cool2: 8272 @type cool2: L{Float} 8273 @ivar cool3: 8274 @type cool3: L{Float} 8275 @sort: hot,cool1,cool2,cool3 8276 """
8277
8278 -class ExtStageConstants(object):
8279 """ 8280 Spyder-generated class 8281 8282 module haddock 8283 8284 8285 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8286 8287 8288 8289 Description 8290 =========== 8291 8292 8293 8294 Energy constants refinement stage, plus the first and last stage they are in effect 8295 8296 8297 8298 8299 8300 8301 Wiki 8302 ==== 8303 U{http://www.spyderware.nl/wiki/classes/ExtStageConstants} 8304 8305 Validate block 8306 ============== 8307 8308 >>> 8309 assert firstit <= lastit 8310 assert firstit >= 0 and lastit <= 2 8311 >>> 8312 8313 8314 Form block 8315 ========== 8316 8317 >>> 8318 HEADER firstit Iterations: 8319 HEADER firstit 0: Rigid body EM (it0) 8320 HEADER firstit 1: Semi-flexible SA (it1) 8321 HEADER firstit 2: Water refinement 8322 firstit First iteration (0-2) 8323 lastit Last iteration (0-2) 8324 stages Energy constants per stage 8325 >>> 8326 8327 @ivar firstit: 8328 @type firstit: L{Integer} 8329 @ivar lastit: 8330 @type lastit: L{Integer} 8331 @ivar stages: 8332 @type stages: L{StageConstants} 8333 @sort: firstit,lastit,stages 8334 """
8335
8336 -class KarplusConstants(object):
8337 """ 8338 Spyder-generated class 8339 8340 module haddock 8341 8342 8343 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8344 8345 8346 8347 Wiki 8348 ==== 8349 U{http://www.spyderware.nl/wiki/classes/KarplusConstants} 8350 8351 Validate block 8352 ============== 8353 8354 >>> 8355 assert (on == True) == (karplusfile != None) 8356 >>> 8357 8358 @ivar on: 8359 @type on: L{Bool} 8360 @ivar karplusa: 8361 @type karplusa: L{Float} 8362 @ivar karplusb: 8363 @type karplusb: L{Float} 8364 @ivar karplusc: 8365 @type karplusc: L{Float} 8366 @ivar karplusd: 8367 @type karplusd: L{Float} 8368 @ivar stages: 8369 @type stages: L{StageConstants} 8370 @ivar karplusfile: 8371 @type karplusfile: L{*String<String>} 8372 @sort: on,karplusa,karplusb,karplusc,karplusd,stages,karplusfile 8373 """
8374
8375 -class RDCConstants(object):
8376 """ 8377 Spyder-generated class 8378 8379 module haddock 8380 8381 8382 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8383 8384 8385 8386 Description 8387 =========== 8388 8389 8390 8391 Definition of Residual Dipolar Couplings constants 8392 8393 8394 8395 8396 8397 8398 Wiki 8399 ==== 8400 U{http://www.spyderware.nl/wiki/classes/RDCConstants} 8401 8402 Validate block 8403 ============== 8404 8405 >>> 8406 if choice != None: assert choice in ("NO", "SANI", "VANGLE") 8407 >>> 8408 8409 8410 Form block 8411 ========== 8412 8413 >>> 8414 OPTION choice "NO", "SANI", "VANGLE" 8415 choice RDC type 8416 OPTIONTITLE choice NO, SANI, VEAN 8417 r R 8418 d D 8419 constants SANI energy constants 8420 SUPERHEADER ini_bor VEAN energy constants 8421 SUPERHEADER fin_bor VEAN energy constants 8422 SUPERHEADER ini_cen VEAN energy constants 8423 SUPERHEADER fin_cen VEAN energy constants 8424 ini_bor ini_bor energy constants per stage 8425 fin_bor fin_bor energy constants per stage 8426 ini_cen ini_cen energy constants per stage 8427 fin_cen fin_cen energy constants per stage 8428 >>> 8429 8430 @ivar choice: 8431 @type choice: L{String} 8432 @ivar r: 8433 @type r: L{Float} 8434 @ivar d: 8435 @type d: L{Float} 8436 @ivar constants: 8437 @type constants: L{ExtStageConstants} 8438 @ivar ini_bor: 8439 @type ini_bor: L{StageConstants} 8440 @ivar fin_bor: 8441 @type fin_bor: L{StageConstants} 8442 @ivar ini_cen: 8443 @type ini_cen: L{StageConstants} 8444 @ivar fin_cen: 8445 @type fin_cen: L{StageConstants} 8446 @sort: choice,r,d,constants,ini_bor,fin_bor,ini_cen,fin_cen 8447 """ 8448 8449 ini_bor = [1, 10, 40, 40] 8450 fin_bor = [10, 10, 40, 40] 8451 ini_cen = [0.25, 2.5, 10, 10] 8452 fin_cen = [2.5, 10, 10, 10]
8453 -class RDCInterface(RDCConstants):
8454 """ 8455 Spyder-generated class 8456 8457 module haddock 8458 8459 8460 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8461 8462 8463 8464 Description 8465 =========== 8466 8467 8468 8469 Definition of Residual Dipolar Couplings in a web form 8470 8471 8472 8473 8474 8475 8476 Wiki 8477 ==== 8478 U{http://www.spyderware.nl/wiki/classes/RDCInterface} 8479 8480 Validate block 8481 ============== 8482 8483 >>> 8484 if rdcfile == None and choice != "NO": 8485 raise HaddockValidationError("You turned on RDC restraints but you did not supply an RDC file") 8486 if rdcfile != None and choice == "NO": 8487 raise HaddockValidationError("You supplied an RDC file but you did not turn on RDC restraints") 8488 >>> 8489 8490 @ivar rdcfile: 8491 @type rdcfile: L{*File<File>} 8492 @sort: rdcfile 8493 """
8494
8495 -class RDCParameters(RDCConstants):
8496 """ 8497 Spyder-generated class 8498 8499 module haddock 8500 8501 8502 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8503 8504 8505 8506 Description 8507 =========== 8508 8509 8510 8511 Definition of Residual Dipolar Couplings 8512 8513 8514 self-contained; used in HADDOCK parameter files 8515 8516 8517 8518 8519 8520 8521 Wiki 8522 ==== 8523 U{http://www.spyderware.nl/wiki/classes/RDCParameters} 8524 @ivar rdcdata: 8525 @type rdcdata: L{*String<String>} 8526 @sort: rdcdata 8527 """
8528
8529 -class RDCRunParameters(RDCConstants):
8530 """ 8531 Spyder-generated class 8532 8533 module haddock 8534 8535 8536 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8537 8538 8539 8540 Description 8541 =========== 8542 8543 8544 8545 Definition of Residual Dipolar Couplings 8546 8547 8548 links to external file that may not exist yet; 8549 8550 8551 used in HADDOCK run objects 8552 8553 8554 8555 8556 8557 8558 Wiki 8559 ==== 8560 U{http://www.spyderware.nl/wiki/classes/RDCRunParameters} 8561 @ivar rdcfilename: 8562 @type rdcfilename: L{*String<String>} 8563 @sort: rdcfilename 8564 """
8565
8566 -class DANIConstants(object):
8567 """ 8568 Spyder-generated class 8569 8570 module haddock 8571 8572 8573 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8574 8575 8576 8577 Description 8578 =========== 8579 8580 8581 8582 Definition of Relaxation Anisotropy constants 8583 8584 8585 8586 8587 8588 8589 Wiki 8590 ==== 8591 U{http://www.spyderware.nl/wiki/classes/DANIConstants} 8592 8593 Validate block 8594 ============== 8595 8596 >>> 8597 if choice != None: assert choice in ("NO", "DANI") 8598 >>> 8599 8600 8601 Form block 8602 ========== 8603 8604 >>> 8605 OPTION choice "NO", "DANI" 8606 tc Correlation time 8607 anis D 8608 r R 8609 wh H frequency 8610 wn N frequency 8611 choice Anisotropy type 8612 constants DANI energy constants 8613 >>> 8614 8615 @ivar choice: 8616 @type choice: L{String} 8617 @ivar constants: 8618 @type constants: L{ExtStageConstants} 8619 @ivar tc: 8620 @type tc: L{Float} 8621 @ivar anis: 8622 @type anis: L{Float} 8623 @ivar r: 8624 @type r: L{Float} 8625 @ivar wh: 8626 @type wh: L{Float} 8627 @ivar wn: 8628 @type wn: L{Float} 8629 @sort: choice,constants,tc,anis,r,wh,wn 8630 """
8631
8632 -class DANIInterface(DANIConstants):
8633 """ 8634 Spyder-generated class 8635 8636 module haddock 8637 8638 8639 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8640 8641 8642 8643 Description 8644 =========== 8645 8646 8647 8648 Definition of Relaxation Anisotropy restraints in a web form 8649 8650 8651 8652 8653 8654 8655 Wiki 8656 ==== 8657 U{http://www.spyderware.nl/wiki/classes/DANIInterface} 8658 8659 Validate block 8660 ============== 8661 8662 >>> 8663 if danifile == None and choice != "NO": 8664 raise HaddockValidationError("You turned on anisotropy restraints but you did not supply an anisotropy file") 8665 if danifile != None and choice == "NO": 8666 raise HaddockValidationError("You supplied an anisotropy file but you did not turn on anisotropy restraints") 8667 >>> 8668 8669 @ivar danifile: 8670 @type danifile: L{*File<File>} 8671 @sort: danifile 8672 """
8673
8674 -class DANIParameters(DANIConstants):
8675 """ 8676 Spyder-generated class 8677 8678 module haddock 8679 8680 8681 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8682 8683 8684 8685 Description 8686 =========== 8687 8688 8689 8690 Definition of Relaxation Anisotropy restraints 8691 8692 8693 self-contained; used in HADDOCK parameter files 8694 8695 8696 8697 8698 8699 8700 Wiki 8701 ==== 8702 U{http://www.spyderware.nl/wiki/classes/DANIParameters} 8703 @ivar danidata: 8704 @type danidata: L{*String<String>} 8705 @sort: danidata 8706 """
8707
8708 -class DANIRunParameters(DANIConstants):
8709 """ 8710 Spyder-generated class 8711 8712 module haddock 8713 8714 8715 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8716 8717 8718 8719 Description 8720 =========== 8721 8722 8723 8724 Definition of Relaxation Anisotropy restraints 8725 8726 8727 links to external file that may not exist yet; 8728 8729 8730 used in HADDOCK run objects 8731 8732 8733 8734 8735 8736 8737 Wiki 8738 ==== 8739 U{http://www.spyderware.nl/wiki/classes/DANIRunParameters} 8740 @ivar danifilename: 8741 @type danifilename: L{*String<String>} 8742 @sort: danifilename 8743 """
8744
8745 -class ScalingConstants(object):
8746 """ 8747 Spyder-generated class 8748 8749 module haddock 8750 8751 8752 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8753 8754 8755 8756 Description 8757 =========== 8758 8759 8760 8761 Force constants for different stages of HADDOCK 8762 8763 8764 rigid Rigid body dynamic 8765 8766 8767 cool2 SA with flexible side-chains (cool2) 8768 8769 8770 cool3 SA with flexible backbone and side-chains (cool3) 8771 8772 8773 8774 8775 8776 8777 Wiki 8778 ==== 8779 U{http://www.spyderware.nl/wiki/classes/ScalingConstants} 8780 8781 Form block 8782 ========== 8783 8784 >>> 8785 rigid Rigid body dynamic 8786 cool2 SA with flexible side-chains (cool2) 8787 cool3 SA with flexible backbone and side-chains (cool3) 8788 >>> 8789 8790 @ivar rigid: 8791 @type rigid: L{Float} 8792 @ivar cool2: 8793 @type cool2: L{Float} 8794 @ivar cool3: 8795 @type cool3: L{Float} 8796 @sort: rigid,cool2,cool3 8797 """
8798
8799 -class CNSQueue(object):
8800 """ 8801 Spyder-generated class 8802 8803 module haddock 8804 8805 8806 file /home/sjoerd/data/Spyder-devel/haddock/parameter.spy 8807 8808 8809 8810 Description 8811 =========== 8812 8813 8814 8815 Definition of a CNS queue command in HADDOCK 8816 8817 8818 cpunumber The number of computers 8819 8820 8821 command The queue command on the shell 8822 8823 8824 cnsexe The CNS executable 8825 8826 8827 8828 8829 8830 8831 Wiki 8832 ==== 8833 U{http://www.spyderware.nl/wiki/classes/CNSQueue} 8834 @ivar cpunumber: 8835 @type cpunumber: L{Integer} 8836 @ivar command: 8837 @type command: L{String} 8838 @ivar cnsexe: 8839 @type cnsexe: L{String} 8840 @sort: cpunumber,command,cnsexe 8841 """ 8842 8843 cpunumber = 0 8844 command = "" 8845 cnsexe = ""
8846 -class HaddockResidueList(IntegerArray):
8847 """Parent class: L{IntegerArray<Integer>}"""
8848 - def __arrayvalidate__(self):
8849 for v in range(len(self)): 8850 try: 8851 Integer(self[v]) 8852 except: 8853 raise HaddockValidationError("Invalid residue number '%s'. Please specify your residues as comma-separated numbers, e.g. 1,2,3." % self[v]) 8854 IntegerArray.__arrayvalidate__(self)
8855 - def __parse__(self, s):
8856 try: 8857 if s.startswith('"') and s.endswith('"'): s = s[1:-1] 8858 if s.startswith("'") and s.endswith("'"): s = s[1:-1] 8859 except: 8860 pass 8861 try: 8862 ret = IntegerArray.__parse__(self, s) 8863 except: 8864 ret = IntegerArray.__parse__(self, "[" + s + "]") 8865 return ret
8866 - def __repr__(self, *args, **kargs):
8867 return "'" + self.__str__(*args, **kargs) + "'"
8868 - def __str__(self, *args, **kargs):
8869 return ",".join([str(v) for v in self])
8870 - def __print__(self, *args, **kargs):
8871 return self.__repr__(*args,**kargs)
8872
8873 -class HaddockRestraintsSelectionPartnerList(HaddockResidueList):
8874 """Parent class: L{HaddockResidueList}"""
8875 - def __arrayvalidate__(self):
8876 for v in range(len(self)): 8877 try: 8878 Integer(self[v]) 8879 except: 8880 raise HaddockValidationError("Invalid selection number '%s'. Please specify the partner selections as comma-separated numbers, e.g. 1,2,3." % self[v]) 8881 HaddockResidueList.__arrayvalidate__(self)
8882
8883 -class RestraintsInterface(object):
8884 """ 8885 Spyder-generated class 8886 8887 module haddock 8888 8889 8890 file /home/sjoerd/data/Spyder-devel/haddock/partner.spy 8891 8892 8893 8894 Description 8895 =========== 8896 8897 8898 8899 Definition HADDOCK Ambiguous Interaction Restraints (AIRs) 8900 8901 8902 Lists of active and passive residues must be provided 8903 8904 8905 8906 8907 8908 8909 Wiki 8910 ==== 8911 U{http://www.spyderware.nl/wiki/classes/RestraintsInterface} 8912 8913 Validate block 8914 ============== 8915 8916 >>> 8917 if auto_passive and len(passivereslist): 8918 raise HaddockValidationError("You manually defined passive residues, but also that they should be determined automatically") 8919 >>> 8920 8921 @ivar activereslist: 8922 @type activereslist: L{HaddockResidueList} 8923 @ivar passivereslist: 8924 @type passivereslist: L{HaddockResidueList} 8925 @ivar auto_passive: 8926 @type auto_passive: L{Bool} 8927 @sort: activereslist,passivereslist,auto_passive 8928 """ 8929 8930 activereslist = [] 8931 passivereslist = [] 8932 auto_passive = False
8933 -class HaddockPartnerInterface(object):
8934 """ 8935 Spyder-generated class 8936 8937 module haddock 8938 8939 8940 file /home/sjoerd/data/Spyder-devel/haddock/partner.spy 8941 8942 8943 8944 Description 8945 =========== 8946 8947 8948 8949 Definition of a single HADDOCK molecule in docking 8950 8951 8952 Used in the HADDOCK Easy Interface 8953 8954 8955 8956 8957 8958 8959 Wiki 8960 ==== 8961 U{http://www.spyderware.nl/wiki/classes/HaddockPartnerInterface} 8962 8963 Validate block 8964 ============== 8965 8966 >>> 8967 assert segid == None or len(segid) == 1 8968 if moleculetype != None: assert moleculetype in ("Protein", "DNA", "RNA") 8969 >>> 8970 8971 8972 Form block 8973 ========== 8974 8975 >>> 8976 LENGTH segid 1 8977 OPTION moleculetype "Protein", "DNA", "RNA" 8978 >>> 8979 8980 8981 Converters 8982 ========== 8983 8984 Can be converted from: 8985 ---------------------- 8986 8987 - L{HaddockMultiPartnerInterface} 8988 - CAST 8989 @ivar pdb: 8990 @type pdb: L{PDBInterface} 8991 @ivar r: 8992 @type r: L{RestraintsInterface} 8993 @ivar segid: 8994 @type segid: L{*String<String>} 8995 @ivar moleculetype: 8996 @type moleculetype: L{String} 8997 @sort: pdb,r,segid,moleculetype 8998 """ 8999 9000 r = RestraintsInterface() 9001 moleculetype = "Protein"
9002 -class HaddockPartnerExpertInterface(HaddockPartnerInterface):
9003 """ 9004 Spyder-generated class 9005 9006 module haddock 9007 9008 9009 file /home/sjoerd/data/Spyder-devel/haddock/partner.spy 9010 9011 9012 9013 Description 9014 =========== 9015 9016 9017 9018 Definition of a single HADDOCK molecule in docking 9019 9020 9021 Used in the HADDOCK Expert/Guru Interface 9022 9023 9024 9025 9026 9027 9028 Wiki 9029 ==== 9030 U{http://www.spyderware.nl/wiki/classes/HaddockPartnerExpertInterface} 9031 9032 Form block 9033 ========== 9034 9035 >>> 9036 pdb Structure definition 9037 r Restraint definition 9038 TYPE r required 9039 TYPE segid required 9040 LENGTH segid 1 9041 OPTION moleculetype "Protein", "DNA", "RNA" 9042 segid Segment ID to use during the docking 9043 SUPERHEADER his Histidine protonation states 9044 his Histidine 9045 SUPERHEADER auto_his Histidine protonation states 9046 auto_his Automatically guess histidine protonation states using WHATIF 9047 semiflex Semi-flexible segments 9048 fullyflex Fully flexible segments 9049 moleculetype What kind of molecule are you docking? 9050 charged_nter The N-terminus of your protein is positively charged 9051 charged_cter The C-terminus of your protein is negatively charged 9052 >>> 9053 9054 @ivar (form): 9055 @type (form): Delete 9056 @ivar auto_his: 9057 @type auto_his: L{Bool} 9058 @ivar his: 9059 @type his: L{HistidineStateArray<HistidineState>} 9060 @ivar semiflex: 9061 @type semiflex: L{SemiflexSegmentList} 9062 @ivar fullyflex: 9063 @type fullyflex: L{SegmentList} 9064 @ivar charged_nter: 9065 @type charged_nter: L{Bool} 9066 @ivar charged_cter: 9067 @type charged_cter: L{Bool} 9068 @sort: form,auto_his,his,semiflex,fullyflex,charged_nter,charged_cter 9069 """ 9070 9071 auto_his = True 9072 his = [] 9073 semiflex = SemiflexSegmentList(mode="automatic", segments = []) 9074 fullyflex = [] 9075 charged_nter = True 9076 charged_cter = True
9077 -class HaddockPartnerParameters(HaddockPartnerExpertInterface):
9078 """ 9079 Spyder-generated class 9080 9081 module haddock 9082 9083 9084 file /home/sjoerd/data/Spyder-devel/haddock/partner.spy 9085 9086 9087 9088 Description 9089 =========== 9090 9091 9092 9093 Definition of a single HADDOCK molecule in docking 9094 9095 9096 self-contained; used in HADDOCK parameter files 9097 9098 9099 9100 9101 9102 9103 Wiki 9104 ==== 9105 U{http://www.spyderware.nl/wiki/classes/HaddockPartnerParameters} 9106 @ivar (pdb): 9107 @type (pdb): Delete 9108 @ivar pdb: 9109 @type pdb: L{PDBData} 9110 @sort: pdb,pdb 9111 """
9112
9113 -class HaddockMultiPartnerInterface(HaddockPartnerExpertInterface):
9114 """ 9115 Spyder-generated class 9116 9117 module haddock 9118 9119 9120 file /home/sjoerd/data/Spyder-devel/haddock/partner.spy 9121 9122 9123 9124 Wiki 9125 ==== 9126 U{http://www.spyderware.nl/wiki/classes/HaddockMultiPartnerInterface} 9127 9128 Converters 9129 ========== 9130 9131 Can be converted to: 9132 -------------------- 9133 9134 - L{HaddockPartnerInterface} 9135 - CAST 9136 @ivar (r): 9137 @type (r): Delete 9138 @sort: r 9139 """
9140
9141 -class Data_TBL(Data):
9142 """ 9143 Spyder-generated class 9144 9145 module haddock 9146 9147 9148 file /home/sjoerd/data/Spyder-devel/haddock/haddock.spy 9149 9150 9151 9152 Description 9153 =========== 9154 9155 9156 9157 Data in the HADDOCK/CNS TBL format 9158 9159 9160 statements must be "assign [(...)]x [...]y" where x and y are number of repetitions 9161 9162 9163 allowed combinations of x and y: 9164 9165 9166 x=2, y=3 9167 9168 9169 x=4, y=4, last y is integer rather than floar 9170 9171 9172 x=6, y=2 9173 9174 9175 9176 9177 9178 9179 Wiki 9180 ==== 9181 U{http://www.spyderware.nl/wiki/classes/Data_TBL} 9182 9183 Converters 9184 ========== 9185 9186 Can be converted from: 9187 ---------------------- 9188 9189 - L{MultiRestraintsInterface} 9190 - L{view converter (#11) <spyderconverterfunction_11>} 9191 @sort: 9192 """
9193
9194 -class HaddockEasyInterface(object):
9195 """ 9196 Spyder-generated class 9197 9198 module haddock 9199 9200 9201 file /home/sjoerd/data/Spyder-devel/haddock/haddock.spy 9202 9203 9204 9205 Description 9206 =========== 9207 9208 9209 9210 Web form for the HADDOCK server Easy Interface 9211 9212 9213 9214 9215 9216 9217 Wiki 9218 ==== 9219 U{http://www.spyderware.nl/wiki/classes/HaddockEasyInterface} 9220 9221 Validate block 9222 ============== 9223 9224 >>> 9225 has_r1 = (p1.r != None and (len(p1.r.activereslist) > 0 or len(p1.r.passivereslist) > 0)) 9226 has_r2 = (p2.r != None and (len(p2.r.activereslist) > 0 or len(p2.r.passivereslist) > 0)) 9227 if not has_r1: raise HaddockValidationError("You must supply active and/or passive residues for your first protein.") 9228 if not has_r2: raise HaddockValidationError("You must supply active and/or passive residues for your second protein.") 9229 if len(p1.r.activereslist) == 0 and len(p2.r.activereslist) == 0: 9230 raise HaddockValidationError("You have defined only passive residues. HADDOCK needs at least one active residue to drive the docking.") 9231 if len(p1.r.activereslist) == 0 and len(p2.r.passivereslist) > 0: 9232 raise HaddockValidationError("Protein 1 has no active residues defined. Therefore, it is meaningless to define passive residues on protein 2. Please remove the passive residues on protein 2.") 9233 if len(p2.r.activereslist) == 0 and len(p1.r.passivereslist) > 0: 9234 raise HaddockValidationError("Protein 2 has no active residues defined. Therefore, it is meaningless to define passive residues on protein 1. Please remove the passive residues on protein 1.") 9235 if runname != None: 9236 runname = runname.strip() 9237 self.runname = runname 9238 if not runname.replace("_","").replace("-","").isalnum(): 9239 raise HaddockValidationError("The name of your run may contain only letters, digits, _ and -") 9240 >>> 9241 9242 9243 Form block 9244 ========== 9245 9246 >>> 9247 HEADER runname You may supply a name for your docking run (one word) 9248 runname Name 9249 p1 First molecule 9250 p2 Second molecule 9251 HEADER username Username and password 9252 TYPE username required 9253 username Username 9254 TYPE password password 9255 password Password 9256 >>> 9257 9258 9259 Converters 9260 ========== 9261 9262 Can be converted to: 9263 -------------------- 9264 9265 - L{HaddockExpertInterface} 9266 - CAST 9267 9268 - L{HaddockGuruInterface} 9269 - CAST 9270 9271 Can be converted from: 9272 ---------------------- 9273 9274 - L{HaddockExpertInterface} 9275 - CAST 9276 9277 - L{HaddockGuruInterface} 9278 - CAST 9279 @ivar runname: 9280 @type runname: L{*String<String>} 9281 @ivar p1: 9282 @type p1: L{HaddockPartnerInterface} 9283 @ivar p2: 9284 @type p2: L{HaddockPartnerInterface} 9285 @ivar username: 9286 @type username: L{*String<String>} 9287 @ivar password: 9288 @type password: L{*String<String>} 9289 @sort: runname,p1,p2,username,password 9290 """
9291
9292 -class HaddockExpertInterface(HaddockEasyInterface):
9293 """ 9294 Spyder-generated class 9295 9296 module haddock 9297 9298 9299 file /home/sjoerd/data/Spyder-devel/haddock/haddock.spy 9300 9301 9302 9303 Description 9304 =========== 9305 9306 9307 9308 Web form for the HADDOCK server Expert Interface 9309 9310 9311 9312 9313 9314 9315 Wiki 9316 ==== 9317 U{http://www.spyderware.nl/wiki/classes/HaddockExpertInterface} 9318 9319 Validate block 9320 ============== 9321 9322 >>> 9323 if solvent != None: assert solvent in ("water", "dmso") 9324 has_r1 = (p1.r != None and (len(p1.r.activereslist) > 0 or len(p1.r.passivereslist) > 0)) 9325 has_r2 = (p2.r != None and (len(p2.r.activereslist) > 0 or len(p2.r.passivereslist) > 0)) 9326 if has_r1 != has_r2: raise HaddockValidationError("You must supply either active and passive residues for both proteins or for neither of them.") 9327 if has_r1 == (tblfile != None or unambigtblfile != None): 9328 if not has_r1: 9329 if ranair == False and cmrest == False and surfrest == False: 9330 raise HaddockValidationError("You can define active and passive residues for both proteins. Alternatively, in Expert/Guru mode, you can also define a restraints table, random restraints, or center-of-mass restraints.\\nHADDOCK cannot run without this. Please provide one of the two.") 9331 if has_r1 == (tblfile != None): 9332 if has_r1: 9333 raise HaddockValidationError("You can define active and passive residues for both proteins. Alternatively, in Expert/Guru mode, you can also define a restraints table, random restraints, or center-of-mass restraints. These options are mutually exclusive, but both have been defined here.\\nPlease remove either the restraints table or the active and passive residues.") 9334 if has_r1: 9335 if len(p1.r.activereslist) == 0 and len(p2.r.activereslist) == 0: 9336 raise HaddockValidationError("You have defined only passive residues. HADDOCK needs at least one active residue to drive the docking.") 9337 if len(p1.r.activereslist) == 0 and len(p2.r.passivereslist) > 0: 9338 raise HaddockValidationError("Protein 1 has no active residues defined. Therefore, it is meaningless to define passive residues on protein 2. Please remove the passive residues on protein 2.") 9339 if len(p2.r.activereslist) == 0 and len(p1.r.passivereslist) > 0: 9340 raise HaddockValidationError("Protein 2 has no active residues defined. Therefore, it is meaningless to define passive residues on protein 1. Please remove the passive residues on protein 1.") 9341 restcount = 0 9342 if ranair == True: restcount += 1 9343 if has_r1 or tblfile != None or unambigtblfile != None: restcount += 1 9344 if restcount > 1: 9345 raise HaddockValidationError("Manual restraints and random patches are mutually exclusive") 9346 if not (p1.segid == None or (p1.segid != p2.segid)): 9347 raise HaddockValidationError("You must supply segids for every PDB and they must be different") 9348 if not (structures_0 > 0): raise HaddockValidationError("At least one rigid body (it0) structure must be generated, increase the number of structures") 9349 if structures_1 > structures_0: 9350 raise HaddockValidationError("You cannot generate more structures in it1 than in it0") 9351 if waterrefine > structures_1: 9352 raise HaddockValidationError("You cannot generate more structures in the water refinement than in it1") 9353 if ncvpart <= 1: 9354 raise HaddockValidationError("The number of crossvalidation partitions may be fractional, but must be larger than 1") 9355 if ncvpart - int(ncvpart) > 0: 9356 if tblfile != None: 9357 raise HaddockValidationError("The number of crossvalidation partitions may be fractional, but not if a restraints table is supplied") 9358 if runname != None: 9359 runname = runname.strip() 9360 self.runname = runname 9361 if not runname.replace("_","").replace("-","").isalnum(): 9362 raise HaddockValidationError("The name of your run may contain only letters, digits, _ and -") 9363 >>> 9364 9365 9366 Form block 9367 ========== 9368 9369 >>> 9370 HEADER runname You may supply a name for your docking run (one word) 9371 runname Name 9372 p1 First molecule 9373 p2 Second molecule 9374 HEADER username Username and password 9375 TYPE username required 9376 username Username 9377 TYPE password password 9378 password Password 9379 OPTION solvent "water", "dmso" 9380 >>> 9381 9382 9383 Converters 9384 ========== 9385 9386 Can be converted to: 9387 -------------------- 9388 9389 - L{HaddockEasyInterface} 9390 - CAST 9391 9392 - L{HaddockGuruInterface} 9393 - CAST 9394 9395 Can be converted from: 9396 ---------------------- 9397 9398 - L{HaddockEasyInterface} 9399 - CAST 9400 9401 - L{HaddockGuruInterface} 9402 - CAST 9403 @ivar (form): 9404 @type (form): Delete 9405 @ivar (username): 9406 @type (username): Delete 9407 @ivar (password): 9408 @type (password): Delete 9409 @ivar (validate): 9410 @type (validate): Delete 9411 @ivar (p1): 9412 @type (p1): Delete 9413 @ivar (p2): 9414 @type (p2): Delete 9415 @ivar p1: 9416 @type p1: L{HaddockPartnerExpertInterface} 9417 @ivar p2: 9418 @type p2: L{HaddockPartnerExpertInterface} 9419 @ivar auto_passive_radius: 9420 @type auto_passive_radius: L{Float} 9421 @ivar tblfile: 9422 @type tblfile: L{*File<File>} 9423 @ivar unambigtblfile: 9424 @type unambigtblfile: L{*File<File>} 9425 @ivar create_narestraints: 9426 @type create_narestraints: L{Bool} 9427 @ivar delenph: 9428 @type delenph: L{Bool} 9429 @ivar ranair: 9430 @type ranair: L{Bool} 9431 @ivar cmrest: 9432 @type cmrest: L{Bool} 9433 @ivar kcont: 9434 @type kcont: L{Float} 9435 @ivar surfrest: 9436 @type surfrest: L{Bool} 9437 @ivar ksurf: 9438 @type ksurf: L{Float} 9439 @ivar noecv: 9440 @type noecv: L{Bool} 9441 @ivar ncvpart: 9442 @type ncvpart: L{Float} 9443 @ivar structures_0: 9444 @type structures_0: L{Integer} 9445 @ivar ntrials: 9446 @type ntrials: L{Integer} 9447 @ivar rotate180_0: 9448 @type rotate180_0: L{Bool} 9449 @ivar smoothing: 9450 @type smoothing: L{Bool} 9451 @ivar structures_1: 9452 @type structures_1: L{Integer} 9453 @ivar rotate180_1: 9454 @type rotate180_1: L{Bool} 9455 @ivar solvent: 9456 @type solvent: L{String} 9457 @ivar waterrefine: 9458 @type waterrefine: L{Integer} 9459 @ivar epsilon: 9460 @type epsilon: L{Float} 9461 @ivar waterdock: 9462 @type waterdock: L{Bool} 9463 @ivar clust_rmsd: 9464 @type clust_rmsd: L{Float} 9465 @ivar clust_size: 9466 @type clust_size: L{Integer} 9467 @ivar dihedralfile: 9468 @type dihedralfile: L{*File<File>} 9469 @ivar hbondfile: 9470 @type hbondfile: L{*File<File>} 9471 @ivar username: 9472 @type username: L{*String<String>} 9473 @ivar password: 9474 @type password: L{*String<String>} 9475 @sort: form,username,password,validate,p1,p2,p1,p2,auto_passive_radius,tblfile,unambigtblfile,create_narestraints,delenph,ranair,cmrest,kcont,surfrest,ksurf,noecv,ncvpart,structures_0,ntrials,rotate180_0,smoothing,structures_1,rotate180_1,solvent,waterrefine,epsilon,waterdock,clust_rmsd,clust_size,dihedralfile,hbondfile,username,password 9476 """ 9477 9478 auto_passive_radius = 6.5 9479 create_narestraints = True 9480 delenph = True 9481 ranair = False 9482 cmrest = False 9483 kcont = 1 9484 surfrest = False 9485 ksurf = 1 9486 noecv = True 9487 ncvpart = 2 9488 structures_0 = 1000 9489 ntrials = 5 9490 rotate180_0 = True 9491 smoothing = False 9492 structures_1 = 200 9493 rotate180_1 = False 9494 solvent = "water" 9495 waterrefine = 200 9496 epsilon = 10 9497 waterdock = False 9498 clust_rmsd = 7.5 9499 clust_size = 4
9500 -class HaddockGuruInterface(HaddockExpertInterface):
9501 """ 9502 Spyder-generated class 9503 9504 module haddock 9505 9506 9507 file /home/sjoerd/data/Spyder-devel/haddock/haddock.spy 9508 9509 9510 9511 Description 9512 =========== 9513 9514 9515 9516 Web form for the HADDOCK server Guru Interface 9517 9518 9519 9520 9521 9522 9523 Wiki 9524 ==== 9525 U{http://www.spyderware.nl/wiki/classes/HaddockGuruInterface} 9526 9527 Validate block 9528 ============== 9529 9530 >>> 9531 if par_nonbonded != None: assert par_nonbonded in ("PROLSQ", "PARMALLH6", "PARALLHDG", "OPLSX") 9532 if dielec != None: assert dielec in ("cdie", "rdie") 9533 assert w_vdw == None or len(w_vdw) == 3 9534 assert w_elec == None or len(w_elec) == 3 9535 assert w_dist == None or len(w_dist) == 3 9536 assert w_sani == None or len(w_sani) == 3 9537 assert w_dani == None or len(w_dani) == 3 9538 assert w_vean == None or len(w_vean) == 3 9539 assert w_cdih == None or len(w_cdih) == 3 9540 assert w_sym == None or len(w_sym) == 3 9541 assert w_bsa == None or len(w_bsa) == 3 9542 assert w_deint == None or len(w_deint) == 3 9543 assert w_desolv == None or len(w_desolv) == 3 9544 if firstwater != None: assert firstwater in ("yes", "no") 9545 if solvate_method != None: assert solvate_method in ("db", "restraints", "pnt") 9546 assert ncssegments == None or len(ncssegments) <= 5 9547 assert c2segments == None or len(c2segments) <= 10 9548 assert c3segments == None or len(c3segments) <= 5 9549 assert c4segments == None or len(c4segments) == 0 9550 assert c5segments == None or len(c5segments) <= 1 9551 assert auto_passive_radius >= 0 and auto_passive_radius <= 1000 9552 >>> 9553 9554 9555 Form block 9556 ========== 9557 9558 >>> 9559 OPTION par_nonbonded "PROLSQ", "PARMALLH6", "PARALLHDG", "OPLSX" 9560 OPTION dielec "cdie", "rdie" 9561 LENGTH w_vdw 3 9562 LENGTH w_elec 3 9563 LENGTH w_dist 3 9564 LENGTH w_sani 3 9565 LENGTH w_dani 3 9566 LENGTH w_vean 3 9567 LENGTH w_cdih 3 9568 LENGTH w_sym 3 9569 LENGTH w_bsa 3 9570 LENGTH w_deint 3 9571 LENGTH w_desolv 3 9572 OPTION firstwater "yes", "no" 9573 OPTION solvate_method "db", "restraints", "pnt" 9574 >>> 9575 9576 9577 Converters 9578 ========== 9579 9580 Can be converted to: 9581 -------------------- 9582 9583 - L{HaddockExpertInterface} 9584 - CAST 9585 9586 - L{HaddockEasyInterface} 9587 - CAST 9588 9589 - L{HaddockRunParameters} 9590 - L{view converter (#1) <spyderconverterfunction_1>} 9591 9592 - L{HaddockPredictionInterface} 9593 - CAST 9594 9595 Can be converted from: 9596 ---------------------- 9597 9598 - L{HaddockExpertInterface} 9599 - CAST 9600 9601 - L{HaddockEasyInterface} 9602 - CAST 9603 9604 - L{HaddockRunParameters} 9605 - L{view converter (#2) <spyderconverterfunction_2>} 9606 9607 - L{HaddockMultiInterface} 9608 - L{view converter (#3) <spyderconverterfunction_3>} 9609 9610 - L{HaddockRefinementInterface} 9611 - L{view converter (#9) <spyderconverterfunction_9>} 9612 9613 - L{HaddockPredictionInterface} 9614 - L{view converter (#10) <spyderconverterfunction_10>} 9615 @ivar (username): 9616 @type (username): Delete 9617 @ivar (password): 9618 @type (password): Delete 9619 @ivar xplortodiana: 9620 @type xplortodiana: L{Bool} 9621 @ivar ncs: 9622 @type ncs: L{SymmetrySpecification} 9623 @ivar ncssegments: 9624 @type ncssegments: L{*LabeledRangePairArray<LabeledRangePair>} 9625 @ivar symmetry: 9626 @type symmetry: L{SymmetrySpecification} 9627 @ivar c2segments: 9628 @type c2segments: L{*LabeledRangePairArray<LabeledRangePair>} 9629 @ivar c3segments: 9630 @type c3segments: L{*LabeledRangeTripleArray<LabeledRangeTriple>} 9631 @ivar c4segments: 9632 @type c4segments: L{*LabeledRangeQuadrupleArray<LabeledRangeQuadruple>} 9633 @ivar c5segments: 9634 @type c5segments: L{*LabeledRangeQuintupleArray<LabeledRangeQuintuple>} 9635 @ivar s3segments: 9636 @type s3segments: L{*LabeledRangeTripleArray<LabeledRangeTriple>} 9637 @ivar unamb: 9638 @type unamb: L{ExtStageConstants} 9639 @ivar amb: 9640 @type amb: L{ExtStageConstants} 9641 @ivar hbond: 9642 @type hbond: L{ExtStageConstants} 9643 @ivar dihedrals: 9644 @type dihedrals: L{StageConstants} 9645 @ivar air_scaling: 9646 @type air_scaling: L{Bool} 9647 @ivar tot_unamb: 9648 @type tot_unamb: L{Integer} 9649 @ivar tot_amb: 9650 @type tot_amb: L{Integer} 9651 @ivar mrswi: 9652 @type mrswi: L{StageConstants} 9653 @ivar rswi: 9654 @type rswi: L{StageConstants} 9655 @ivar masy: 9656 @type masy: L{StageConstants} 9657 @ivar asy: 9658 @type asy: L{StageConstants} 9659 @ivar c1: 9660 @type c1: L{KarplusConstants} 9661 @ivar c2: 9662 @type c2: L{KarplusConstants} 9663 @ivar c3: 9664 @type c3: L{KarplusConstants} 9665 @ivar c4: 9666 @type c4: L{KarplusConstants} 9667 @ivar c5: 9668 @type c5: L{KarplusConstants} 9669 @ivar rdc1: 9670 @type rdc1: L{RDCInterface} 9671 @ivar rdc2: 9672 @type rdc2: L{RDCInterface} 9673 @ivar rdc3: 9674 @type rdc3: L{RDCInterface} 9675 @ivar rdc4: 9676 @type rdc4: L{RDCInterface} 9677 @ivar rdc5: 9678 @type rdc5: L{RDCInterface} 9679 @ivar dan1: 9680 @type dan1: L{DANIInterface} 9681 @ivar dan2: 9682 @type dan2: L{DANIInterface} 9683 @ivar dan3: 9684 @type dan3: L{DANIInterface} 9685 @ivar dan4: 9686 @type dan4: L{DANIInterface} 9687 @ivar dan5: 9688 @type dan5: L{DANIInterface} 9689 @ivar par_nonbonded: 9690 @type par_nonbonded: L{String} 9691 @ivar dihedflag: 9692 @type dihedflag: L{Bool} 9693 @ivar elecflag_0: 9694 @type elecflag_0: L{Bool} 9695 @ivar elecflag_1: 9696 @type elecflag_1: L{Bool} 9697 @ivar dielec: 9698 @type dielec: L{String} 9699 @ivar inter_rigid: 9700 @type inter_rigid: L{Float} 9701 @ivar scaling_init: 9702 @type scaling_init: L{ScalingConstants} 9703 @ivar scaling_fin: 9704 @type scaling_fin: L{ScalingConstants} 9705 @ivar w_vdw: 9706 @type w_vdw: L{FloatArray<Float>} 9707 @ivar w_elec: 9708 @type w_elec: L{FloatArray<Float>} 9709 @ivar w_dist: 9710 @type w_dist: L{FloatArray<Float>} 9711 @ivar w_sani: 9712 @type w_sani: L{FloatArray<Float>} 9713 @ivar w_dani: 9714 @type w_dani: L{FloatArray<Float>} 9715 @ivar w_vean: 9716 @type w_vean: L{FloatArray<Float>} 9717 @ivar w_cdih: 9718 @type w_cdih: L{FloatArray<Float>} 9719 @ivar w_sym: 9720 @type w_sym: L{FloatArray<Float>} 9721 @ivar w_bsa: 9722 @type w_bsa: L{FloatArray<Float>} 9723 @ivar w_deint: 9724 @type w_deint: L{FloatArray<Float>} 9725 @ivar w_desolv: 9726 @type w_desolv: L{FloatArray<Float>} 9727 @ivar skip_struc: 9728 @type skip_struc: L{Integer} 9729 @ivar crossdock: 9730 @type crossdock: L{Bool} 9731 @ivar ensemble_multiply: 9732 @type ensemble_multiply: L{Bool} 9733 @ivar randorien: 9734 @type randorien: L{Bool} 9735 @ivar rigidmini: 9736 @type rigidmini: L{Bool} 9737 @ivar rigidtrans: 9738 @type rigidtrans: L{Bool} 9739 @ivar iniseed: 9740 @type iniseed: L{Integer} 9741 @ivar tadhigh_t: 9742 @type tadhigh_t: L{Integer} 9743 @ivar tadinit1_t: 9744 @type tadinit1_t: L{Integer} 9745 @ivar tadfinal1_t: 9746 @type tadfinal1_t: L{Integer} 9747 @ivar tadinit2_t: 9748 @type tadinit2_t: L{Integer} 9749 @ivar tadfinal2_t: 9750 @type tadfinal2_t: L{Integer} 9751 @ivar tadinit3_t: 9752 @type tadinit3_t: L{Integer} 9753 @ivar tadfinal3_t: 9754 @type tadfinal3_t: L{Integer} 9755 @ivar timestep: 9756 @type timestep: L{Float} 9757 @ivar tadfactor: 9758 @type tadfactor: L{Integer} 9759 @ivar initiosteps: 9760 @type initiosteps: L{Integer} 9761 @ivar cool1_steps: 9762 @type cool1_steps: L{Integer} 9763 @ivar cool2_steps: 9764 @type cool2_steps: L{Integer} 9765 @ivar cool3_steps: 9766 @type cool3_steps: L{Integer} 9767 @ivar firstwater: 9768 @type firstwater: L{String} 9769 @ivar waterheatsteps: 9770 @type waterheatsteps: L{Integer} 9771 @ivar watersteps: 9772 @type watersteps: L{Integer} 9773 @ivar watercoolsteps: 9774 @type watercoolsteps: L{Integer} 9775 @ivar calcdesolv: 9776 @type calcdesolv: L{Bool} 9777 @ivar solvate_method: 9778 @type solvate_method: L{String} 9779 @ivar water_restraint_initial: 9780 @type water_restraint_initial: L{Float} 9781 @ivar water_restraint_cutoff: 9782 @type water_restraint_cutoff: L{Float} 9783 @ivar water_restraint_scale: 9784 @type water_restraint_scale: L{Float} 9785 @ivar water_tokeep: 9786 @type water_tokeep: L{Float} 9787 @ivar water_randfrac: 9788 @type water_randfrac: L{Float} 9789 @ivar water_surfcutoff: 9790 @type water_surfcutoff: L{Float} 9791 @ivar water_analysis: 9792 @type water_analysis: L{Bool} 9793 @ivar transwater: 9794 @type transwater: L{Bool} 9795 @ivar waterensemble: 9796 @type waterensemble: L{Integer} 9797 @ivar anastruc_1: 9798 @type anastruc_1: L{Integer} 9799 @ivar dist_hb: 9800 @type dist_hb: L{Float} 9801 @ivar dist_nb: 9802 @type dist_nb: L{Float} 9803 @ivar keepwater: 9804 @type keepwater: L{Bool} 9805 @ivar username: 9806 @type username: L{*String<String>} 9807 @ivar password: 9808 @type password: L{*String<String>} 9809 @sort: username,password,xplortodiana,ncs,ncssegments,symmetry,c2segments,c3segments,c4segments,c5segments,s3segments,unamb,amb,hbond,dihedrals,air_scaling,tot_unamb,tot_amb,mrswi,rswi,masy,asy,c1,c2,c3,c4,c5,rdc1,rdc2,rdc3,rdc4,rdc5,dan1,dan2,dan3,dan4,dan5,par_nonbonded,dihedflag,elecflag_0,elecflag_1,dielec,inter_rigid,scaling_init,scaling_fin,w_vdw,w_elec,w_dist,w_sani,w_dani,w_vean,w_cdih,w_sym,w_bsa,w_deint,w_desolv,skip_struc,crossdock,ensemble_multiply,randorien,rigidmini,rigidtrans,iniseed,tadhigh_t,tadinit1_t,tadfinal1_t,tadinit2_t,tadfinal2_t,tadinit3_t,tadfinal3_t,timestep,tadfactor,initiosteps,cool1_steps,cool2_steps,cool3_steps,firstwater,waterheatsteps,watersteps,watercoolsteps,calcdesolv,solvate_method,water_restraint_initial,water_restraint_cutoff,water_restraint_scale,water_tokeep,water_randfrac,water_surfcutoff,water_analysis,transwater,waterensemble,anastruc_1,dist_hb,dist_nb,keepwater,username,password 9810 """ 9811 9812 xplortodiana = False 9813 ncs = dict(on=False, constant = 1) 9814 symmetry = dict(on=False, constant = 10) 9815 unamb = (0,2,(10,10,50,50)) 9816 amb = (0,2,(10,10,50,50)) 9817 hbond = (1,2,(10,10,50,50)) 9818 dihedrals = (5,5,50,200) 9819 air_scaling = False 9820 tot_unamb = 25 9821 tot_amb = 0 9822 mrswi = (0.5,0.5,0.5,0.5) 9823 rswi = (0.5,0.5,0.5,0.5) 9824 masy = (-1,-1,-0.1,-0.1) 9825 asy = (1,1,0.1,0.1) 9826 c1 = (False, 6.98,-1.38,1.72,-60,(0,0.2,1,1)) 9827 c2 = (False, 6.98,-1.38,1.72,-120,(0,0.2,1,1)) 9828 c3 = (False, 6.98,-1.38,1.72,-120,(0,0.2,1,1)) 9829 c4 = (False, 6.98,-1.38,1.72,-120,(0,0.2,1,1)) 9830 c5 = (False, 6.98,-1.38,1.72,-120,(0,0.2,1,1)) 9831 rdc1 = ("NO", 0.4, 8,(0,2,(0.1,1,1,1)), (1,10,40,40), (10,40,40,40), (0.25,2.5,10,10), (2.5,10,10,10)) 9832 rdc2 = ("NO", 0.4, 8,(0,2,(0.1,1,1,1)), (1,10,40,40), (10,40,40,40), (0.25,2.5,10,10), (2.5,10,10,10)) 9833 rdc3 = ("NO", 0.4, 8,(0,2,(0.1,1,1,1)), (1,10,40,40), (10,40,40,40), (0.25,2.5,10,10), (2.5,10,10,10)) 9834 rdc4 = ("NO", 0.4, 8,(0,2,(0.1,1,1,1)), (1,10,40,40), (10,40,40,40), (0.25,2.5,10,10), (2.5,10,10,10)) 9835 rdc5 = ("NO", 0.4, 8,(0,2,(0.1,1,1,1)), (1,10,40,40), (10,40,40,40), (0.25,2.5,10,10), (2.5,10,10,10)) 9836 dan1 = ("NO", (0,2,(1,5,10,10)), 9.771, 1.557, 0.455, 599.91, 60.82) 9837 dan2 = ("NO", (0,1,(1,5,10,10)), 9.84, -1.35, 0.308, 599.91, 60.82) 9838 dan3 = ("NO", (1,1,(1,5,10,10)), 9.84, -1.35, 0.308, 599.91, 60.82) 9839 dan4 = ("NO", (0,2,(1,5,10,10)), 9.84, -1.35, 0.308, 599.91, 60.82) 9840 dan5 = ("NO", (0,2,(1,5,10,10)), 9.84, -1.35, 0.308, 599.91, 60.82) 9841 par_nonbonded = "OPLSX" 9842 dihedflag = True 9843 elecflag_0 = True 9844 elecflag_1 = True 9845 dielec = "cdie" 9846 inter_rigid = 1 9847 scaling_init = (0.001,0.001,0.05) 9848 scaling_fin = (0.001,1,1) 9849 w_vdw= (0.01,1,1) 9850 w_elec= (1,1,0.2) 9851 w_dist= (0.01,0.1,0.1) 9852 w_sani= (0.1,0.1,0.1) 9853 w_dani= (0.01,0.1,0.1) 9854 w_vean= (0.1,0.1,0.1) 9855 w_cdih= (0,0,0) 9856 w_sym= (0.1,0.1,0.1) 9857 w_bsa= (-0.01,-0.01,0) 9858 w_deint= (0,0,0) 9859 w_desolv= (1,1,1) 9860 skip_struc = 0 9861 crossdock = True 9862 ensemble_multiply = False 9863 randorien = True 9864 rigidmini = True 9865 rigidtrans = True 9866 iniseed = 917 9867 tadhigh_t = 2000 9868 tadinit1_t = 2000 9869 tadfinal1_t = 500 9870 tadinit2_t = 1000 9871 tadfinal2_t = 50 9872 tadinit3_t = 500 9873 tadfinal3_t = 50 9874 timestep = 0.002 9875 tadfactor = 8 9876 initiosteps = 500 9877 cool1_steps = 500 9878 cool2_steps = 1000 9879 cool3_steps = 1000 9880 firstwater = "yes" 9881 waterheatsteps = 100 9882 watersteps = 1250 9883 watercoolsteps = 500 9884 calcdesolv = False 9885 solvate_method = "db" 9886 water_restraint_initial = 5 9887 water_restraint_cutoff = 5 9888 water_restraint_scale = 25 9889 water_tokeep = 0.25 9890 water_randfrac = 0 9891 water_surfcutoff = 8 9892 water_analysis = False 9893 transwater = True 9894 waterensemble = 1 9895 anastruc_1 = 200 9896 dist_hb = 2.5 9897 dist_nb = 3.9 9898 keepwater = False
9899 -class HaddockRunParameters(HaddockGuruInterface):
9900 """ 9901 Spyder-generated class 9902 9903 module haddock 9904 9905 9906 file /home/sjoerd/data/Spyder-devel/haddock/haddock.spy 9907 9908 9909 9910 Description 9911 =========== 9912 9913 9914 9915 Data model for HADDOCK parameter files 9916 9917 9918 9919 9920 9921 9922 Wiki 9923 ==== 9924 U{http://www.spyderware.nl/wiki/classes/HaddockRunParameters} 9925 9926 Converters 9927 ========== 9928 9929 Can be converted to: 9930 -------------------- 9931 9932 - L{HaddockGuruInterface} 9933 - L{view converter (#2) <spyderconverterfunction_2>} 9934 9935 - L{HaddockMultiRunParameters} 9936 - L{view converter (#7) <spyderconverterfunction_7>} 9937 9938 Can be converted from: 9939 ---------------------- 9940 9941 - L{HaddockGuruInterface} 9942 - L{view converter (#1) <spyderconverterfunction_1>} 9943 9944 - L{HaddockMultiRunParameters} 9945 - L{view converter (#6) <spyderconverterfunction_6>} 9946 @ivar (p1): 9947 @type (p1): Delete 9948 @ivar (p2): 9949 @type (p2): Delete 9950 @ivar p1: 9951 @type p1: L{HaddockPartnerParameters} 9952 @ivar p2: 9953 @type p2: L{HaddockPartnerParameters} 9954 @ivar (tblfile): 9955 @type (tblfile): Delete 9956 @ivar tbldata: 9957 @type tbldata: L{*String<String>} 9958 @ivar (unambigtblfile): 9959 @type (unambigtblfile): Delete 9960 @ivar unambigtbldata: 9961 @type unambigtbldata: L{*String<String>} 9962 @ivar (dihedralfile): 9963 @type (dihedralfile): Delete 9964 @ivar dihedraldata: 9965 @type dihedraldata: L{*String<String>} 9966 @ivar (hbondfile): 9967 @type (hbondfile): Delete 9968 @ivar hbonddata: 9969 @type hbonddata: L{*String<String>} 9970 @ivar (rdc1): 9971 @type (rdc1): Delete 9972 @ivar (rdc2): 9973 @type (rdc2): Delete 9974 @ivar (rdc3): 9975 @type (rdc3): Delete 9976 @ivar (rdc4): 9977 @type (rdc4): Delete 9978 @ivar (rdc5): 9979 @type (rdc5): Delete 9980 @ivar rdc1: 9981 @type rdc1: L{RDCParameters} 9982 @ivar rdc2: 9983 @type rdc2: L{RDCParameters} 9984 @ivar rdc3: 9985 @type rdc3: L{RDCParameters} 9986 @ivar rdc4: 9987 @type rdc4: L{RDCParameters} 9988 @ivar rdc5: 9989 @type rdc5: L{RDCParameters} 9990 @ivar (dan1): 9991 @type (dan1): Delete 9992 @ivar (dan2): 9993 @type (dan2): Delete 9994 @ivar (dan3): 9995 @type (dan3): Delete 9996 @ivar (dan4): 9997 @type (dan4): Delete 9998 @ivar (dan5): 9999 @type (dan5): Delete 10000 @ivar dan1: 10001 @type dan1: L{DANIParameters} 10002 @ivar dan2: 10003 @type dan2: L{DANIParameters} 10004 @ivar dan3: 10005 @type dan3: L{DANIParameters} 10006 @ivar dan4: 10007 @type dan4: L{DANIParameters} 10008 @ivar dan5: 10009 @type dan5: L{DANIParameters} 10010 @ivar (validate): 10011 @type (validate): Delete 10012 @sort: p1,p2,p1,p2,tblfile,tbldata,unambigtblfile,unambigtbldata,dihedralfile,dihedraldata,hbondfile,hbonddata,rdc1,rdc2,rdc3,rdc4,rdc5,rdc1,rdc2,rdc3,rdc4,rdc5,dan1,dan2,dan3,dan4,dan5,dan1,dan2,dan3,dan4,dan5,validate 10013 """
10014
10015 -def spyderconverterfunction_1(i):
10016 ii = i.dict() 10017 if "pdbfile" in ii["p1"]["pdb"]: 10018 ii["p1"]["pdb"]["pdbdata"] = File(**ii["p1"]["pdb"]["pdbfile"]).data().textdata() 10019 ii["p1"]["pdb"] = PDBData(ii["p1"]["pdb"]) 10020 if "pdbfile" in ii["p2"]["pdb"]: 10021 ii["p2"]["pdb"]["pdbdata"] = File(**ii["p2"]["pdb"]["pdbfile"]).data().textdata() 10022 ii["p2"]["pdb"] = PDBData(ii["p2"]["pdb"]) 10023 r = "tblfile" 10024 if r in ii: 10025 ii["tbldata"] = File(**ii[r]).data().textdata() 10026 r = "unambigtblfile" 10027 if r in ii: 10028 ii["unambigtbldata"] = File(**ii[r]).data().textdata() 10029 dihedraldata = None 10030 r = "dihedralfile" 10031 if r in ii: 10032 fil = File(**ii[r]) 10033 dihedraldata = fil.data().textdata() 10034 ii["dihedraldata"] = dihedraldata 10035 hbonddata = None 10036 r = "hbondfile" 10037 if r in ii: 10038 fil = File(**ii[r]) 10039 hbonddata = fil.data().textdata() 10040 ii["hbonddata"] = hbonddata 10041 for v in ("rdc1", "rdc2", "rdc3", "rdc4", "rdc5"): 10042 vv = ii[v] 10043 rdcdata = None 10044 r = "rdcfile" 10045 if r in vv: 10046 fil = File(**vv[r]) 10047 rdcdata = fil.data().textdata() 10048 vv["rdcdata"] = rdcdata 10049 for v in ("dan1", "dan2", "dan3", "dan4", "dan5"): 10050 vv = ii[v] 10051 danidata = None 10052 r = "danifile" 10053 if r in vv: 10054 fil = File(**vv[r]) 10055 danidata = fil.data().textdata() 10056 vv["danidata"] = danidata 10057 return HaddockRunParameters(ii)
10058
10059 -def spyderconverterfunction_2(i):
10060 ii = i.dict() 10061 if "pdbdata" in ii["p1"]["pdb"]: 10062 v = Data_PDB(ii["p1"]["pdb"]["pdbdata"]) 10063 ii["p1"]["pdb"]["pdbfile"] = v.totempfile() 10064 ii["p1"]["pdb"] = PDBInterface.fromdict(ii["p1"]["pdb"]) 10065 if "pdbdata" in ii["p2"]["pdb"]: 10066 v = Data_PDB(ii["p2"]["pdb"]["pdbdata"]) 10067 ii["p2"]["pdb"]["mode"] = "submit" 10068 ii["p2"]["pdb"]["pdbfile"] = v.totempfile() 10069 ii["p2"]["pdb"] = PDBInterface.fromdict(ii["p2"]["pdb"]) 10070 r = "tbldata" 10071 if r in ii: 10072 ii["tblfile"] = ii[r].totempfile() 10073 r = "unambigtbldata" 10074 if r in ii: 10075 ii["unambigtblfile"] = ii[r].totempfile() 10076 dihedralfile = None 10077 r = "dihedraldata" 10078 if r in ii: 10079 dihedralfile = ii[r].totempfile() 10080 ii["dihedralfile"] = dihedralfile 10081 hbondfile = None 10082 r = "hbonddata" 10083 if r in ii: 10084 hbondfile = ii[r].totempfile() 10085 ii["hbondfile"] = hbondfile 10086 for v in ("rdc1", "rdc2", "rdc3", "rdc4", "rdc5"): 10087 vv = ii[v] 10088 rdcfile = None 10089 r = "rdcdata" 10090 if r in vv: 10091 rdcfile = vv[r].totempfile() 10092 vv["rdcfile"] = rdcfile 10093 for v in ("dan1", "dan2", "dan3", "dan4", "dan5"): 10094 vv = ii[v] 10095 danifile = None 10096 r = "danidata" 10097 if r in vv: 10098 danifile = vv[r].totempfile() 10099 vv["danifile"] = danifile 10100 return HaddockGuruInterface(ii)
10101
10102 -class HaddockRunParameterInterface(object):
10103 """ 10104 Spyder-generated class 10105 10106 module haddock 10107 10108 10109 file /home/sjoerd/data/Spyder-devel/haddock/haddock.spy 10110 10111 10112 10113 Description 10114 =========== 10115 10116 10117 10118 Web form for the HADDOCK server File Upload Interface 10119 10120 10121 10122 10123 10124 10125 Wiki 10126 ==== 10127 U{http://www.spyderware.nl/wiki/classes/HaddockRunParameterInterface} 10128 10129 Validate block 10130 ============== 10131 10132 >>> 10133 if runname != None: 10134 runname = runname.strip() 10135 self.runname = runname 10136 if not runname.replace("_","").replace("-","").isalnum(): 10137 raise HaddockValidationError("The name of your run may contain only letters, digits, _ and -") 10138 ok = False 10139 for filetype in HaddockMultiRunParameters, HaddockRunParameters: 10140 try: 10141 Spyder.core.fastparsestring(params.data().data(), filetype) 10142 ok = True 10143 break 10144 except: 10145 pass 10146 if not ok: raise HaddockValidationError( 10147 "The file that you uploaded is of an unknown format. Please upload a HADDOCK server parameter file" 10148 ) 10149 >>> 10150 10151 10152 Form block 10153 ========== 10154 10155 >>> 10156 HEADER runname You may supply a name for your docking run (one word) 10157 runname Name 10158 HEADER params Please upload a parameter file for your docking run 10159 params Parameter file 10160 HEADER username Username and password 10161 TYPE username required 10162 username Username 10163 TYPE password password 10164 password Password 10165 >>> 10166 10167 10168 Converters 10169 ========== 10170 10171 Can be converted to: 10172 -------------------- 10173 10174 - L{HaddockMultiRunParameters} 10175 - L{view converter (#8) <spyderconverterfunction_8>} 10176 @ivar runname: 10177 @type runname: L{*String<String>} 10178 @ivar params: 10179 @type params: L{File} 10180 @ivar username: 10181 @type username: L{*String<String>} 10182 @ivar password: 10183 @type password: L{*String<String>} 10184 @sort: runname,params,username,password 10185 """
10186
10187 -class HaddockMultiInterface(object):
10188 """ 10189 Spyder-generated class 10190 10191 module haddock 10192 10193 10194 file /home/sjoerd/data/Spyder-devel/haddock/haddock.spy 10195 10196 10197 10198 Wiki 10199 ==== 10200 U{http://www.spyderware.nl/wiki/classes/HaddockMultiInterface} 10201 10202 Converters 10203 ========== 10204 10205 Can be converted to: 10206 -------------------- 10207 10208 - L{HaddockGuruInterface} 10209 - L{view converter (#3) <spyderconverterfunction_3>} 10210 10211 - L{HaddockMultiRunParameters} 10212 - L{view converter (#4) <spyderconverterfunction_4>} 10213 10214 Can be converted from: 10215 ---------------------- 10216 10217 - L{HaddockMultiRunParameters} 10218 - L{view converter (#5) <spyderconverterfunction_5>} 10219 @ivar runname: 10220 @type runname: L{*String<String>} 10221 @ivar p: 10222 @type p: L{*HaddockMultiPartnerInterfaceArray<HaddockMultiPartnerInterface>} 10223 @sort: runname,p 10224 """
10225
10226 -def spyderconverterfunction_3(i):
10227 if i.p == None or len(i.p) < 2: return None 10228 d = i.dict() 10229 d["p1"] = i.p[0].dict() 10230 d["p2"] = i.p[1].dict() 10231 ret = HaddockGuruInterface(d) 10232 return ret
10233
10234 -class HaddockMultiRunParameters(HaddockRunParameters):
10235 """ 10236 Spyder-generated class 10237 10238 module haddock 10239 10240 10241 file /home/sjoerd/data/Spyder-devel/haddock/haddock.spy 10242 10243 10244 10245 Wiki 10246 ==== 10247 U{http://www.spyderware.nl/wiki/classes/HaddockMultiRunParameters} 10248 10249 Validate block 10250 ============== 10251 10252 >>> 10253 if p == None or len(p) == 0: raise HaddockValidationError("Please specify at least one partner molecule") 10254 >>> 10255 10256 10257 Converters 10258 ========== 10259 10260 Can be converted to: 10261 -------------------- 10262 10263 - L{HaddockMultiInterface} 10264 - L{view converter (#5) <spyderconverterfunction_5>} 10265 10266 - L{HaddockRunParameters} 10267 - L{view converter (#6) <spyderconverterfunction_6>} 10268 10269 Can be converted from: 10270 ---------------------- 10271 10272 - L{HaddockMultiInterface} 10273 - L{view converter (#4) <spyderconverterfunction_4>} 10274 10275 - L{HaddockRunParameters} 10276 - L{view converter (#7) <spyderconverterfunction_7>} 10277 10278 - L{HaddockRunParameterInterface} 10279 - L{view converter (#8) <spyderconverterfunction_8>} 10280 @ivar (p1): 10281 @type (p1): Delete 10282 @ivar (p2): 10283 @type (p2): Delete 10284 @ivar p: 10285 @type p: L{*HaddockPartnerParametersArray<HaddockPartnerParameters>} 10286 @sort: p1,p2,p 10287 """
10288
10289 -def spyderconverterfunction_4(i):
10290 ii = i.dict() 10291 if i.p != None: 10292 for n in range(len(i.p)): 10293 cur = ii["p"][n] 10294 if "pdbfile" in cur["pdb"]: 10295 cur["pdb"]["pdbdata"] = File(**cur["pdb"]["pdbfile"]).data().textdata() 10296 cur["pdb"] = PDBData(cur["pdb"]) 10297 HaddockPartnerParameters(cur) 10298 r = "tblfile" 10299 if r in ii: 10300 ii["tbldata"] = File(**ii[r]).data().textdata() 10301 r = "unambigtblfile" 10302 if r in ii: 10303 ii["unambigtbldata"] = File(**ii[r]).data().textdata() 10304 dihedraldata = None 10305 r = "dihedralfile" 10306 if r in ii: 10307 fil = File(**ii[r]) 10308 dihedraldata = fil.data().textdata() 10309 ii["dihedraldata"] = dihedraldata 10310 hbonddata = None 10311 r = "hbondfile" 10312 if r in ii: 10313 fil = File(**ii[r]) 10314 hbonddata = fil.data().textdata() 10315 ii["hbonddata"] = hbonddata 10316 for v in ("rdc1", "rdc2", "rdc3", "rdc4", "rdc5"): 10317 vv = ii[v] 10318 rdcdata = None 10319 r = "rdcfile" 10320 if r in vv: 10321 fil = File(**vv[r]) 10322 rdcdata = fil.data().textdata() 10323 vv["rdcdata"] = rdcdata 10324 for v in ("dan1", "dan2", "dan3", "dan4", "dan5"): 10325 vv = ii[v] 10326 danidata = None 10327 r = "danifile" 10328 if r in vv: 10329 fil = File(**vv[r]) 10330 danidata = fil.data().textdata() 10331 vv["danidata"] = danidata 10332 return HaddockMultiRunParameters(ii)
10333
10334 -def spyderconverterfunction_5(i):
10335 ii = i.dict() 10336 if ii["p"] != None: 10337 for n in range(len(ii["p"])): 10338 cur = ii["p"][n] 10339 if "pdbdata" in cur["pdb"]: 10340 v = Data_PDB(cur["pdb"]["pdbdata"]) 10341 cur["pdb"]["pdbfile"] = v.totempfile() 10342 cur["pdb"] = PDBInterface.fromdict(cur["pdb"]) 10343 r = "tbldata" 10344 if r in ii: 10345 ii["tblfile"] = ii[r].totempfile() 10346 r = "unambigtbldata" 10347 if r in ii: 10348 ii["unambigtblfile"] = ii[r].totempfile() 10349 dihedralfile = None 10350 r = "dihedraldata" 10351 if r in ii: 10352 dihedralfile = ii[r].totempfile() 10353 ii["dihedralfile"] = dihedralfile 10354 hbondfile = None 10355 r = "hbonddata" 10356 if r in ii: 10357 hbondfile = ii[r].totempfile() 10358 ii["hbondfile"] = hbondfile 10359 for v in ("rdc1", "rdc2", "rdc3", "rdc4", "rdc5"): 10360 vv = ii[v] 10361 rdcfile = None 10362 r = "rdcdata" 10363 if r in vv: 10364 rdcfile = vv[r].totempfile() 10365 vv["rdcfile"] = rdcfile 10366 for v in ("dan1", "dan2", "dan3", "dan4", "dan5"): 10367 vv = ii[v] 10368 danifile = None 10369 r = "danidata" 10370 if r in vv: 10371 danifile = vv[r].totempfile() 10372 vv["danifile"] = danifile 10373 return HaddockMultiInterface(ii)
10374
10375 -def spyderconverterfunction_6(i):
10376 if i.p == None or len(i.p) < 2: return None 10377 d = i.dict() 10378 d["p1"] = i.p[0].dict() 10379 d["p2"] = i.p[1].dict() 10380 ret = HaddockRunParameters(d) 10381 return ret
10382
10383 -def spyderconverterfunction_7(i):
10384 d = i.dict() 10385 d["p"] = [d["p1"], d["p2"]] 10386 ret = HaddockMultiRunParameters(d) 10387 return ret
10388
10389 -def spyderconverterfunction_8(i):
10390 ret = Spyder.core.fastparsestring(i.params.data().data()) 10391 ret = ret.convert(HaddockMultiRunParameters) 10392 if i.runname != None: ret.runname = i.runname 10393 if i.username != None: ret.username = i.username 10394 if i.password != None: ret.password = i.password 10395 ret.validate() 10396 return ret
10397
10398 -class HaddockRefinementPartnerInterface(object):
10399 """ 10400 Spyder-generated class 10401 10402 module haddock 10403 10404 10405 file /home/sjoerd/data/Spyder-devel/haddock/refinement.spy 10406 10407 10408 10409 Description 10410 =========== 10411 10412 10413 10414 Definition of a single HADDOCK molecule in docking 10415 10416 10417 Used in the HADDOCK refinement Interface 10418 10419 10420 10421 10422 10423 10424 Wiki 10425 ==== 10426 U{http://www.spyderware.nl/wiki/classes/HaddockRefinementPartnerInterface} 10427 10428 Validate block 10429 ============== 10430 10431 >>> 10432 if moleculetype != None: assert moleculetype in ("Protein", "DNA", "RNA") 10433 >>> 10434 10435 10436 Form block 10437 ========== 10438 10439 >>> 10440 OPTION moleculetype "Protein", "DNA", "RNA" 10441 >>> 10442 10443 @ivar pdb: 10444 @type pdb: L{PDBInterface} 10445 @ivar moleculetype: 10446 @type moleculetype: L{String} 10447 @sort: pdb,moleculetype 10448 """ 10449 10450 moleculetype = "Protein"
10451 -class HaddockRefinementInterface(object):
10452 """ 10453 Spyder-generated class 10454 10455 module haddock 10456 10457 10458 file /home/sjoerd/data/Spyder-devel/haddock/refinement.spy 10459 10460 10461 10462 Wiki 10463 ==== 10464 U{http://www.spyderware.nl/wiki/classes/HaddockRefinementInterface} 10465 10466 Form block 10467 ========== 10468 10469 >>> 10470 HEADER runname You may supply a name for your docking run (one word) 10471 runname Name 10472 p1 First molecule 10473 p2 Second molecule 10474 HEADER username Username and password 10475 TYPE username required 10476 username Username 10477 TYPE password password 10478 password Password 10479 >>> 10480 10481 10482 Converters 10483 ========== 10484 10485 Can be converted to: 10486 -------------------- 10487 10488 - L{HaddockGuruInterface} 10489 - L{view converter (#9) <spyderconverterfunction_9>} 10490 @ivar runname: 10491 @type runname: L{*String<String>} 10492 @ivar p1: 10493 @type p1: L{HaddockRefinementPartnerInterface} 10494 @ivar p2: 10495 @type p2: L{HaddockRefinementPartnerInterface} 10496 @ivar w_vdw: 10497 @type w_vdw: L{Float} 10498 @ivar w_elec: 10499 @type w_elec: L{Float} 10500 @ivar w_bsa: 10501 @type w_bsa: L{Float} 10502 @ivar w_deint: 10503 @type w_deint: L{Float} 10504 @ivar w_desolv: 10505 @type w_desolv: L{Float} 10506 @ivar username: 10507 @type username: L{*String<String>} 10508 @ivar password: 10509 @type password: L{*String<String>} 10510 @sort: runname,p1,p2,w_vdw,w_elec,w_bsa,w_deint,w_desolv,username,password 10511 """ 10512 10513 w_vdw = 1 10514 w_elec = 0.2 10515 w_bsa = 0 10516 w_deint = 0 10517 w_desolv = 1
10518 -def spyderconverterfunction_9(i):
10519 d = i.dict() 10520 d["randorien"] = False 10521 d["rigidmini"] = False 10522 d["initiosteps"] = 0 10523 d["cool1_steps"] = 0 10524 d["cool2_steps"] = 0 10525 d["cool3_steps"] = 0 10526 d["rotate180_0"] = False 10527 d["structures_0"] = 20 10528 d["structures_1"] = 20 10529 d["waterrefine"] = 20 10530 d["rigidtrans"] = False 10531 d["cmrest"] = True 10532 d["surfrest"] = True 10533 d["crossdock"] = False 10534 del d["w_vdw"] 10535 del d["w_elec"] 10536 del d["w_bsa"] 10537 del d["w_deint"] 10538 del d["w_desolv"] 10539 g = HaddockGuruInterface(d) 10540 g.w_vdw[2] = i.w_vdw 10541 g.w_elec[2] = i.w_elec 10542 g.w_bsa[2] = i.w_bsa 10543 g.w_deint[2] = i.w_deint 10544 g.w_desolv[2] = i.w_desolv 10545 g.ensemble_multiply = True 10546 return g
10547
10548 -class HaddockPredictionInterface(HaddockEasyInterface):
10549 """ 10550 Spyder-generated class 10551 10552 module haddock 10553 10554 10555 file /home/sjoerd/data/Spyder-devel/haddock/prediction.spy 10556 10557 10558 10559 Wiki 10560 ==== 10561 U{http://www.spyderware.nl/wiki/classes/HaddockPredictionInterface} 10562 10563 Converters 10564 ========== 10565 10566 Can be converted to: 10567 -------------------- 10568 10569 - L{HaddockGuruInterface} 10570 - L{view converter (#10) <spyderconverterfunction_10>} 10571 10572 Can be converted from: 10573 ---------------------- 10574 10575 - L{HaddockGuruInterface} 10576 - CAST 10577 @sort: 10578 """
10579
10580 -def spyderconverterfunction_10(i):
10581 ret = HaddockGuruInterface(i) 10582 ret.structures_0 = 10000 10583 ret.structures_1 = 400 10584 ret.waterrefine = 400 10585 ret.anastruc_1 = 400 10586 ret.ntrials = 1 10587 ret.ncvpart = 8.0/7 10588 return ret
10589
10590 -class MultiRestraintsInterfaceSubunit(object):
10591 """ 10592 Spyder-generated class 10593 10594 module haddock 10595 10596 10597 file /home/sjoerd/data/Spyder-devel/haddock/MultiRestraintsInterface.spy 10598 10599 10600 10601 Wiki 10602 ==== 10603 U{http://www.spyderware.nl/wiki/classes/MultiRestraintsInterfaceSubunit} 10604 10605 Validate block 10606 ============== 10607 10608 >>> 10609 assert segid == None or len(segid) == 1 10610 >>> 10611 10612 10613 Form block 10614 ========== 10615 10616 >>> 10617 LENGTH segid 1 10618 HEADER activereslist Active and passive residues 10619 HEADER activereslist Please supply residues as comma-separated lists of residue numbers 10620 activereslist Active residues (directly involved in the interaction) 10621 passivereslist Passive residues (surrounding surface residues) 10622 TYPE activereslist text 10623 TYPE passivereslist text 10624 TYPE partners text 10625 segid Segment ID to use during the docking 10626 HEADER partners Please enter the partner selections that can satisfy the active residues as a comma-separated list of numbers 10627 partners Partner selections 10628 >>> 10629 10630 @ivar activereslist: 10631 @type activereslist: L{HaddockResidueList} 10632 @ivar passivereslist: 10633 @type passivereslist: L{HaddockResidueList} 10634 @ivar segid: 10635 @type segid: L{String} 10636 @ivar partners: 10637 @type partners: L{HaddockRestraintsSelectionPartnerList} 10638 @sort: activereslist,passivereslist,segid,partners 10639 """ 10640 10641 activereslist = "" 10642 passivereslist = "" 10643 segid= "" 10644 partners = ""
10645 -class MultiRestraintsInterface(object):
10646 """ 10647 Spyder-generated class 10648 10649 module haddock 10650 10651 10652 file /home/sjoerd/data/Spyder-devel/haddock/MultiRestraintsInterface.spy 10653 10654 10655 10656 Wiki 10657 ==== 10658 U{http://www.spyderware.nl/wiki/classes/MultiRestraintsInterface} 10659 10660 Validate block 10661 ============== 10662 10663 >>> 10664 for r in restraints: 10665 for p in r.partners: 10666 assert p > 0 and p <= len(restraints) 10667 >>> 10668 10669 10670 Form block 10671 ========== 10672 10673 >>> 10674 SUPERHEADER restraints Residue selections 10675 restraints Selection 10676 LENGTH restraints 20 10677 >>> 10678 10679 10680 Converters 10681 ========== 10682 10683 Can be converted to: 10684 -------------------- 10685 10686 - L{Data_TBL} 10687 - L{view converter (#11) <spyderconverterfunction_11>} 10688 @ivar restraints: 10689 @type restraints: L{MultiRestraintsInterfaceSubunitArray<MultiRestraintsInterfaceSubunit>} 10690 @sort: restraints 10691 """ 10692 10693 restraints = (("","", "A", "2,3,4,5,6"), ("","", "B", "1,3,4,5,6"),("","", "C", "1,2,4,5,6"),("","", "D", "1,2,3,5,6"),("","", "E", "1,2,3,4,6"),("","", "F", "1,2,3,4,5"))
10694 -def spyderconverterfunction_11(mri):
10695 ret = "HADDOCK AIR restraints\n" 10696 numerals = ["st", "nd", "rd"] 10697 for n in range(4,21): numerals.append("th") 10698 numerals = [str(n)+num for n,num in zip(range(1,21), numerals)] 10699 for num, r in zip(numerals, mri.restraints): 10700 act1 = r.activereslist 10701 actpass2 = [] 10702 ret += "! HADDOCK AIR restraints for %s selection\n" % (num) 10703 ret += "!\n" 10704 for p in r.partners: 10705 rr = mri.restraints[p-1] 10706 actpass2 += [(r2, rr.segid) for r2 in rr.activereslist + rr.passivereslist] 10707 if len(actpass2) > 0: 10708 for r1 in act1: 10709 ret += "assign ( resid %d and segid %s)\n" % (r1, r.segid) 10710 ret += " (\n" 10711 first = True 10712 for r2,segid2 in actpass2: 10713 if (first == False): 10714 ret += " or\n" 10715 else: first = False 10716 ret += " ( resid %d and segid %s)\n" % (r2, segid2) 10717 ret += " ) 2.0 2.0 0.0\n\n" 10718 ret += "\n" 10719 return Data_TBL(ret)
10720
10721 -def validate_tbl(restraints):
10722 ret = "" 10723 parenthmatch = re.compile('[\(\)]') 10724 mode = "global" 10725 lines = restraints.replace('\r','').split("\n") 10726 lnr = 0 10727 for l in lines: 10728 lnr +=1 10729 if l.find("!") > -1: l = l[:l.find("!")] 10730 l = l.strip() 10731 if not len(l): continue 10732 if l.count('"') % 2 > 0: 10733 raise Exception('Unclosed ": %s' % l) 10734 if mode == "global": 10735 if l.lower().startswith("assi"): 10736 mode = "assign" 10737 selections = [] 10738 if l.find("(") == -1: continue 10739 matched = True 10740 while matched: 10741 matched = False 10742 if mode == "assign": 10743 pos = l.find("(") 10744 if pos != -1: 10745 matched = True 10746 l = l[pos+1:] 10747 mode = "sel" 10748 lastassign = lnr 10749 s = "" 10750 level = 1 10751 if mode == "sel": 10752 for match in parenthmatch.finditer(l): 10753 if match.group() == "(": 10754 level += 1 10755 else: 10756 level -= 1 10757 if level == 0: 10758 mode = "assign" 10759 matched = True 10760 s += l[:match.start()] 10761 selections.append(s) 10762 s = None 10763 l = l[match.end():] 10764 break 10765 if level > 0: s += l + "\n" 10766 if len(l) == 0: continue 10767 if mode == "sel": continue 10768 if mode == "assign": 10769 mode = "numbers" 10770 if len(selections) == 2: types = (" %.3f", " %.3f", " %.3f") 10771 elif len(selections) == 4: types = (" %.3f", " %.3f", " %.3f", " %d") 10772 elif len(selections) == 6: types = (" %.3f", " %.3f") 10773 else: raise Exception("Invalid TBL file: wrong number of selections (must be 2,4 or 6)") 10774 numbers = [] 10775 if mode == "numbers": 10776 ll = l.split() 10777 for num in ll: 10778 if len(numbers) == len(types): break 10779 numbers.append(float(num)) 10780 if len(numbers) == len(types): 10781 ret += "assign " 10782 for s in selections: ret += "(%s)\n" % s 10783 ret = ret[:-len("\n")] 10784 for n,t in zip(numbers,types): ret += t % n 10785 ret += "\n" 10786 mode = "global" 10787 10788 if mode != "global": 10789 raise Exception("Invalid TBL file: Malformed ASSIGN statement (line %d)" % lastassign) 10790 if not len(ret.strip()): 10791 raise Exception("Invalid or empty TBL file") 10792 return ret
10793
10794 -def generate_tbl(act_1, pass_1, act_2, pass_2, segid1, segid2):
10795 ret = "" 10796 ret += "! HADDOCK AIR restraints for 1st partner\n" 10797 actpass2 = act_2 + pass_2 10798 if len(actpass2) > 0: 10799 for r1 in act_1: 10800 ret += "!\n" 10801 ret += "assign ( resid %d and segid %s)\n" % (r1, segid1) 10802 ret += " (\n" 10803 first = 1 10804 for r2 in actpass2: 10805 if (first == 0): 10806 ret += " or\n" 10807 else: first = 0 10808 ret += " ( resid %d and segid %s)\n" % (r2, segid2) 10809 ret += " ) 2.0 2.0 0.0\n" 10810 10811 ret += "!\n" 10812 ret += "! HADDOCK AIR restraints for 2nd partner\n" 10813 actpass1 = act_1 + pass_1 10814 if len(actpass1) > 0: 10815 for r1 in act_2: 10816 ret += "!\n" 10817 ret += "assign ( resid %d and segid %s)\n" % (r1, segid2) 10818 ret += " (\n" 10819 first = 1 10820 for r2 in actpass1: 10821 if (first == 0): 10822 ret += " or\n" 10823 else: first = 0 10824 ret += " ( resid %d and segid %s)\n" % (r2, segid1) 10825 ret += " ) 2.0 2.0 0.0\n" 10826 return ret 10827
10828 -def validate_pdb(data,chain, dataname="PDB file"):
10829 aa = ["ACE", "CTN", "ALA","CYS", "CYM", "CYF", "CSP", "ASP","GLU","PHE","GLY","HIS","NEP","ILE","LYS","ALY", "MLY", "MLZ", "M3L", "LEU","MET","ASN","PRO","GLN","ARG","SER","SEP", "THR","THP", "TOP", "VAL","TRP","TYR","TYP","TYS", "TIP", "HYP"] 10830 bases = ["ADE", "CYT", "GUA", "URI", "THY", " DG", " DC", " DT", " DA", "DG ", "DC ", "DT ", "DA "," A", " G", " C", " T", " U"] 10831 aa += bases 10832 weirdbases = [" A ", " G ", " C ", " T ", " U "] #unusual one-letter bases 10833 aa += weirdbases 10834 ions = ["LI","F","NA","MG","AL","CL","K","AR","CA","V","CR","MN","FE","NI","CO","CU","ZN","AS","BR","KR","SR","MO","AG","CD","I","XE","CS","HO","YB","OS","IR","PT","AU","HG","PB","W"] 10835 ligands = {} 10836 newdd = [] 10837 dd = data.split('\n') 10838 resnrs = {} 10839 specified_atoms = {} 10840 is_hetero = False 10841 for d in dd: 10842 d = d.rstrip('\n') 10843 if d.startswith("HETATM"): 10844 is_hetero = True 10845 d = "ATOM " + d[6:] 10846 if d.startswith("TER") or d.rstrip() == "TER": 10847 newdd.append("TER") 10848 continue 10849 if not d.startswith("ATOM "): continue 10850 nospaces = (11,26,38,46,54,60,66) 10851 ok = True 10852 for p in nospaces: 10853 if len(d) < p or d[p-1] == " ": 10854 ok = False 10855 break 10856 dots = (35,43,51,58,64) 10857 for p in dots: 10858 if len(d) < p or d[p-1] != ".": 10859 ok = False 10860 break 10861 if ok == False: 10862 raise HaddockValidationError("%s is incorrectly formatted. Please align the columns of your PDB properly." % dataname) 10863 if chain != "All" and d[21] != chain: continue 10864 reslabel = d[16] 10865 if reslabel != " ": 10866 raise HaddockValidationError("%s contains multiple forms of the same residue. This is not supported in the current form. If you would like to supply multiple conformations, please create an ensemble\n%s" % (dataname,d)) 10867 resname = d[17:20] 10868 if resname == "HOH": continue 10869 if resname == "MSE": 10870 resname = "MET" 10871 d = d[:17] + "MET" + d[20:] 10872 resnr = d[22:26] 10873 try: 10874 int(resnr) 10875 except: 10876 raise HaddockValidationError("%s contains a residue number that is not a number: %s" % (dataname, resnr)) 10877 if resnr not in resnrs: 10878 resnrs[resnr] = (d[21],resname) 10879 specified_atoms[(d[21],resname)] = set() 10880 elif resnrs[resnr] != (d[21],resname): 10881 firstchain = resnrs[resnr][0] 10882 currchain = d[21] 10883 if firstchain == currchain: 10884 raise HaddockValidationError("%s contains multiple residues with number %s in chain %s" % (dataname,resnr.strip(), currchain)) 10885 else: #overlapping numbering in chains 10886 raise HaddockValidationError("%s contains multiple chains with overlapping numbering: %s%s - %s%s" % (dataname,firstchain, resnr.strip(), currchain, resnr.strip())) 10887 elif d[11:16] in specified_atoms[(d[21],resname)]: 10888 currchain = d[21] 10889 raise HaddockValidationError("%s contains multiple residues with number %s in chain %s" % (dataname,resnr.strip(), currchain)) 10890 else: specified_atoms[(d[21],resname)].add(d[11:16]) 10891 10892 if resname not in aa: 10893 if not is_hetero: 10894 raise HaddockValidationError("%s contains an unknown amino acid %s " % (dataname,resname)) 10895 ionname = None 10896 for ionlen in (2,1): 10897 if resname[-1].isdigit() or len(resname.strip()) == ionlen: 10898 ionname = resname.strip()[:ionlen] 10899 if ionname in ions: 10900 if len(resname.strip()) < 1 + ionlen: 10901 raise HaddockValidationError("%s contains an elemental ion %s without specified charge" % (dataname,ionname)) 10902 else: 10903 charge = resname[-1] 10904 atomname = d[12:14+ionlen] 10905 if atomname != (ionname + "+" + charge) and atomname != (ionname + "-" + charge): 10906 raise HaddockValidationError("%s contains an elemental ion %s with inconsistent charge" % (dataname,ionname)) 10907 break 10908 else: 10909 if resname not in ligands: 10910 ligands[resname] = {} 10911 resnr = d[22:26] 10912 if resnr not in ligands[resname]: 10913 ligands[resname][resnr] = "" 10914 ligands[resname][resnr] += d + '\n' 10915 elif resname in weirdbases: 10916 d = d[:17] + " " + resname[1] + d[20:] 10917 d = d[:20] + " " + d[21:] 10918 newdd.append(d[:72] + " " + d[76:]) 10919 newdd.append("END") 10920 newdd = '\n'.join(newdd) + '\n' 10921 ligs = [] 10922 for l in ligands: 10923 lig = LigandData(l, StringArray(ligands[l].values()), defined_as_hetero = True) 10924 ligs.append(lig) 10925 10926 return newdd,ligs
10927