Endonuclease PvuII (1PVI) DNA - GATTACAGATTACA
CAP - Catabolite gene Activating Protein (1BER)
DNA - GATTACAGATTACAGATTACA Endonuclease PvuII bound to palindromic DNA recognition site CAGCTG (1PVI) DNA - GATTACAGATTACAGATTACA TBP - TATA box Binding Protein (1C9B)
CAP - Catabolite gene Activating Protein (1BER)
GCN4 - leucine zipper transcription factor bound to palindromic DNA recognition site ATGAC(G)TCAT (1YSA)
GCN4 - leucine zipper transcription factor bound to palindromic DNA recognition site ATGAC(G)TCAT (1YSA)
GCN4 - leucine zipper transcription factor bound to palindromic DNA recognition site ATGAC(G)TCAT (1YSA)
GCN4 - leucine zipper transcription factor bound to palindromic DNA recognition site ATGAC(G)TCAT (1YSA)
GCN4 - leucine zipper transcription factor bound to palindromic DNA recognition site ATGAC(G)TCAT (1YSA)
TBP - TATA box Binding Protein (1C9B)
 

° 

Lists are emulated with explicit evaluators

Having a list of something (strings, numbers) can be very handy.


for i = 1 to 5
  MyList(i) = i*10
for i = 5 to 1
  Print (MyList(i))

50
40
30
20
10

Note that lists are not a special datatype but 'faked' using explicit evaluators. The first for loop creates five variables named 'MyList1' to 'MyList5', and the second for loop simply prints them out in reversed order.

If you assign more than one value to a variable, it is assumed to be a list, and the 'fake' variables Name1,Name2...NameN are created automatically. You can document the fact that MyList is a list by appending two parentheses.


MyList() = 4,7,8,9,5
for i in MyList
  Print (i)
for i = 1 to 5
  Print 'Element (i): (MyList(i))'
Print 'Accessing list elements:'
MyList(3) = MyList(3)+1
Print (MyList(3))
MyList3 = MyList3+1
Print (MyList3)

4
7
8
9
5
Element 1: 4
Element 2: 7
Element 3: 8
Element 4: 9
Element 5: 5
Accessing list elements:
9
10

To delete a list, use:

MyList()=0

This expression will set MyList1 to 0 and delete all other variables with the same root name 'MyList'.

° 

Matrices are two dimensional lists

The same concept holds for multidimensional lists, but care must be taken that the list indices do not interfere, best by separating them with an underscore '_':


for i=1 to 12
  for j=1 to 12
    wrongmatrix(i)(j)=i*j
    rightmatrix(i)_(j)=i*j

Why is the first matrix wrong? Simply because the matrix elements 1,12 and 11,2 (like several others) map to the same variable name: wrongmatrix112. The underscore makes sure that the indices stay separated: rightmatrix1_12 and rightmatrix11_2 are indeed different names.

If you know the number of columns and rows in advance, you can use leading zeroes to avoid the underscore:


for i=01 to 12
  for j=01 to 12
    rightmatrix(i)(j)=i*j

In the above case, rightmatrix0112 and rightmatrix1102 correctly map to different variable names.

° 

The 'count' function determines the length of lists

As lists are just variables with the same root name and a sequential number at the end, the length of a list can be determined by counting the number of names that match a certain pattern. This is done by the 'count' function:


MyList() = 4,8,5,2
for i = 1 to count MyList
  Print 'Element (i): (MyList(i))'

Element 1: 4
Element 2: 8
Element 3: 5
Element 4: 2

If no variable name matches, 'count' returns 0 to indicate that the list is empty / does not exist.

° 

The 'min', 'max', 'sum', 'mean', 'stddev' and 'join' functions return the smallest, largest, sum, mean, standard deviation and concatenation of all list elements

These five functions scan all variable names that match the given root name and return the smallest, largest, summed up and average value, respectively. The datatype of the result is either an integer or float, depending on the list elements. The standard deviation is calculated using the formula:

StdDev^2 = Sum((ElementX-Mean)^2) / Elements

Example for a simple list:

MyList() = 1,4,-5,10,8,2
Print (count MyList)
Print (min MyList)
Print (max MyList)
Print (sum MyList)
Print (mean MyList)
Print (stddev MyList)
Print (join MyList)

6
-5
10
20
3.33333333333333e+00
4.88762609953839e+00
1 4 -5 10 8 2

° 

Lists can be sorted

The Yanaconda language does not contain a single function to sort a list, since most of the time one wants to sort something else based on the numbers stored in a list.

The following example assumes that the simulation cell contains one protein multiple times in different, non-overlapping conformations . This macro sorts these conformations based on their energy (the cell is assumed to be the last object):


energylist() = EnergyObj all
do
  sorted=1
  for i=1 to Objects-2
    if energylist(i)>energylist(i+1)
      SwapObj (i),(i+1)
      swap=energylist(i)
      energylist(i)=energylist(i+1)
      energylist(i+1)=swap
      sorted=0
while not sorted