Example: Atom Directory

The following hierarchy contains 16 Atoms (blue circles) organized into 10 Groups (pink squares). Two of the Groups are empty. Atom and Group names are shown between quotation marks. For Atoms, the number below the name is the atom number or index. For Groups there is a pair of numbers below the name. The first number is the atom index of the first atom (if any) contained in that group. The second number is the atom index of the first atom in the next Group or Atom. Both Atom and Group are AtomGroup objects.

The following code (yellow, top left panel) shows one way of producing this hierarchy. Once created, the hierarchy can be viewed by typing: print Top or just Top (blue, top right panel). The string representation of this hierarchy can be viewed by typing (for example): print `Top` (green, bottom panel, note the backquotes).

from Yup.Taro import AtomMap
from Yup.Tools.misc import datasource
Top = AtomMap.AtomMap( datasource( 'TestTube' ) )
Aa1 = Top.atom( "a1" )
Gb1 = Top.group( "b1" )
Aa2 = Gb1.atom( "a2" )
Gb2 = Gb1.group( "b2" )
Ga3 = Gb2.group( "a3" )
Aa4 = Ga3.atom( "a4" )
Ab4 = Ga3.atom( "b4" )
Ab3 = Gb2.atom( "b3" )
Ac3 = Gb2.atom( "c3" )
Gd3 = Gb2.group( "d3" )
Ac4 = Gd3.atom( "c4" )
Gd4 = Gd3.group( "d4" )
Ae4 = Gd3.atom( "e4" )
Af4 = Gd3.atom( "f4" )
Ag4 = Gd3.atom( "g4" )
Ac2 = Gb1.atom( "c2" )
Ac1 = Top.atom( "c1" )
Gd1 = Top.group( "d1" )
Ad2 = Gd1.atom( "d2" )
Ae2 = Gd1.atom( "e2" )
Ge1 = Top.group( "e1" )
Gf2 = Ge1.group( "f2" )
Ae3 = Gf2.atom( "e3" )
Af3 = Gf2.atom( "f3" )
Gg2 = Ge1.group( "g2" )
:       /0:16\
+a1 0:0 1:0 -1:-1 0
+b1: /1:11\
-+a2 1:1 1:0 -1:-1 0
-+b2: /2:10\
--+a3: /2:4\
---+a4 2:2 1:0 -1:-1 0
---+b4 3:3 1:0 -1:-1 0
--+b3 4:4 1:0 -1:-1 0
--+c3 5:5 1:0 -1:-1 0
--+d3: /6:10\
---+c4 6:6 1:0 -1:-1 0
---+d4: /7:7\
---+e4 7:7 1:0 -1:-1 0
---+f4 8:8 1:0 -1:-1 0
---+g4 9:9 1:0 -1:-1 0
-+c2 10:10 1:0 -1:-1 0
+c1 11:11 1:0 -1:-1 0
+d1: /12:14\
-+d2 12:12 1:0 -1:-1 0
-+e2 13:13 1:0 -1:-1 0
+e1: /14:16\
-+f2: /14:16\
--+e3 14:14 1:0 -1:-1 0
--+f3 15:15 1:0 -1:-1 0
-+g2: /0:0\
/5:a1:b1/3:a2:b2/4:a3/2:a4:b4\b3:c3:d3/5:c4:d4/0\e4:f4:g4\\c2\c1:d1/2:d2:e2\e1/2:f2/2:e3:f3\g2/0\\\