SoniaSandbox

From OpenWetWare
Jump to navigationJump to search

temp notes for lecture 14?

Scanned notes: insert here

Python

Everything is an object in python (even numbers) What's the difference between a class and a different compound data structure

everything in a class shares common properties and these properties define the class when you create an object of a certain class, that's called an instance each instance has its own internal data, but shares common methods for accessing that data

class Vector

Most advanced class you're going to deal with: the vector class every class needs a certain function, called init beginning and trailing underscores means that you, the user, is never going to call this function explicitly.

Some functions in the Vector module, to define the class

def __init__(self, x=None, y=None, z=None): #see note 1,2 below

if (x==None): # probably
self.array = [0,0,0]
else:
self.array = [

def x(self):

return self.array[0]

Now the user can use this module:

x = Vector(1,1,2) # x is an instance of the class Vector
y = Vector(2,2,1)
x.x() #returns the value 1 (the x-coordinate of the vector named x)
y.x() #returns the value 2

Notes:

  1. Name a parameter and give it a default value (in case the user doesn't pass anything in)
  2. We're only passing in 3 params, but it looks like the function wants 4.

self is the hidden parameter that ties it to the

Where we're going

  1. Start with a protein backbone
  2. Pick initial AA's (romaters)
  3. Build structure
  4. Calculate energy of that structure "E"
  5. Try a new set of AA's (rotamers)
  6. Calculate their energy
  7. Repeat 5-6 until ? (some stopping point to be defined)
  8. Report best AA's (rotamers)

non-trivial steps from above

3. we spent several classes trying to figure this out 4. we'll talk about it next time 5. how do we pick a good set of AA's ?