Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
Bio.Crystal.Chain Class Reference

List of all members.

Public Member Functions

def __init__
def validate
def validate_element
def __str__
def __eq__
def __ne__
def __len__
def __getitem__
def __setitem__
def __delitem__
def __contains__
def append
def insert
def remove
def count
def index
def __add__
def __radd__
def __iadd__

Public Attributes

 data

Detailed Description

Definition at line 66 of file __init__.py.


Constructor & Destructor Documentation

def Bio.Crystal.Chain.__init__ (   self,
  residues = '' 
)

Definition at line 67 of file __init__.py.

00067 
00068     def __init__(self, residues = ''):
00069         self.data = []
00070         if type(residues) == type(''):
00071             residues = residues.replace('*', ' ')
00072             residues = residues.strip()
00073             elements = residues.split()
00074             self.data = map(Hetero, elements)
00075         elif type(residues) == type([]):
00076             for element in residues:
00077                 if not isinstance(element, Hetero):
00078                     raise CrystalError('Text must be a string')
00079             for residue in residues:
00080                 self.data.append(residue)
00081         elif isinstance(residues, Chain):
00082             for residue in residues:
00083                 self.data.append(residue)
00084         self.validate()

Here is the caller graph for this function:


Member Function Documentation

def Bio.Crystal.Chain.__add__ (   self,
  other 
)

Definition at line 185 of file __init__.py.

00185 
00186     def __add__(self, other):
00187         if isinstance(other, Chain):
00188             return self.__class__(self.data + other.data)
00189         elif type(other) == type(''):
00190             return self.__class__(self.data + Chain(other).data)
00191         else:
00192             raise TypeError

def Bio.Crystal.Chain.__contains__ (   self,
  item 
)

Definition at line 146 of file __init__.py.

00146 
00147     def __contains__(self, item):
00148         try:
00149             self.validate_element(item)
00150         except TypeError:
00151             item = Hetero(item.lower())
00152         return item in self.data

Here is the call graph for this function:

Here is the caller graph for this function:

def Bio.Crystal.Chain.__delitem__ (   self,
  index 
)

Definition at line 143 of file __init__.py.

00143 
00144     def __delitem__(self, index):
00145         del self.data[index]

def Bio.Crystal.Chain.__eq__ (   self,
  other 
)

Definition at line 104 of file __init__.py.

00104 
00105     def __eq__(self, other):
00106         if len(self.data) != len(other.data):
00107             return 0
00108         ok = reduce(lambda x, y: x and y, map(lambda x, y: x == y, self.data, other.data))
00109         return ok

Here is the caller graph for this function:

def Bio.Crystal.Chain.__getitem__ (   self,
  index 
)

Definition at line 116 of file __init__.py.

00116 
00117     def __getitem__(self, index):
00118         if isinstance(index, int):
00119             return self.data[index]
00120         elif isinstance(index, slice):
00121             return self.__class__(self.data[index])
00122         else:
00123             raise TypeError
            

Here is the caller graph for this function:

def Bio.Crystal.Chain.__iadd__ (   self,
  other 
)

Definition at line 201 of file __init__.py.

00201 
00202     def __iadd__(self, other):
00203         if isinstance(other, Chain):
00204             self.data += other.data
00205         elif type(other) == type(''):
00206             self.data += Chain(other).data
00207         else:
00208             raise TypeError
00209         return self

def Bio.Crystal.Chain.__len__ (   self)

Definition at line 114 of file __init__.py.

00114 
00115     def __len__(self): return len(self.data)

def Bio.Crystal.Chain.__ne__ (   self,
  other 
)
Returns true iff self is not equal to other.

Definition at line 110 of file __init__.py.

00110 
00111     def __ne__(self, other):
00112         """Returns true iff self is not equal to other."""
00113         return not self.__eq__(other)

Here is the call graph for this function:

def Bio.Crystal.Chain.__radd__ (   self,
  other 
)

Definition at line 193 of file __init__.py.

00193 
00194     def __radd__(self, other):
00195         if isinstance(other, Chain):
00196             return self.__class__(other.data + self.data)
00197         elif type(other) == type(''):
00198             return self.__class__(Chain(other).data + self.data)
00199         else:
00200             raise TypeError

def Bio.Crystal.Chain.__setitem__ (   self,
  index,
  value 
)

Definition at line 124 of file __init__.py.

00124 
00125     def __setitem__(self, index, value):
00126         if isinstance(index, int):
00127             try:
00128                 self.validate_element(value)
00129             except TypeError:
00130                 value = Hetero(value.lower())
00131             self.data[index] = value
00132         elif isinstance(index, slice):
00133             if isinstance(value, Chain):
00134                 self.data[index] = value.data
00135             elif isinstance(value, type(self.data)):
00136                 self.data[index] = value
00137             elif isinstance(value, basestring):
00138                 self.data[index] = Chain(value).data
00139             else:
00140                 raise TypeError
00141         else:
00142             raise TypeError
    

Here is the call graph for this function:

def Bio.Crystal.Chain.__str__ (   self)

Definition at line 94 of file __init__.py.

00094 
00095     def __str__(self):
00096         output = ''
00097         i = 0
00098         for element in self.data:
00099             output = output + '%s ' % element
00100         output = output.strip()
00101         output = wrap_line(output)
00102         return output
00103 

Here is the call graph for this function:

Here is the caller graph for this function:

def Bio.Crystal.Chain.append (   self,
  item 
)

Definition at line 153 of file __init__.py.

00153 
00154     def append(self, item):
00155         try:
00156             self.validate_element(item)
00157         except TypeError:
00158             item = Hetero(item.lower())
00159         self.data.append(item)

Here is the call graph for this function:

def Bio.Crystal.Chain.count (   self,
  item 
)

Definition at line 171 of file __init__.py.

00171 
00172     def count(self, item):
00173         try:
00174             self.validate_element(item)
00175         except TypeError:
00176             item = Hetero(item.lower())
00177         return self.data.count(item)

Here is the call graph for this function:

def Bio.Crystal.Chain.index (   self,
  item 
)

Definition at line 178 of file __init__.py.

00178 
00179     def index(self, item):
00180         try:
00181             self.validate_element(item)
00182         except TypeError:
00183             item = Hetero(item.lower())
00184         return self.data.index(item)

Here is the call graph for this function:

def Bio.Crystal.Chain.insert (   self,
  i,
  item 
)

Definition at line 160 of file __init__.py.

00160 
00161     def insert(self, i, item):
00162         try:
00163             self.validate_element(item)
00164         except TypeError:
00165             item = Hetero(item.lower())
00166         self.data.insert(i, item)

Here is the call graph for this function:

def Bio.Crystal.Chain.remove (   self,
  item 
)

Definition at line 167 of file __init__.py.

00167 
00168     def remove(self, item):
00169         item = Hetero(item.lower())
00170         self.data.remove(item)

Definition at line 85 of file __init__.py.

00085 
00086     def validate(self):
00087         data = self.data
00088         for element in data:
00089             self.validate_element(element)

Here is the call graph for this function:

def Bio.Crystal.Chain.validate_element (   self,
  element 
)

Definition at line 90 of file __init__.py.

00090 
00091     def validate_element(self, element):
00092         if not isinstance(element, Hetero):
00093             raise TypeError

Here is the caller graph for this function:


Member Data Documentation

Definition at line 68 of file __init__.py.


The documentation for this class was generated from the following file: