Skip to content
Snippets Groups Projects
Commit ce702d0f authored by marco's avatar marco
Browse files

updates to website

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2472 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 6507b5cf
Branches
Tags
No related merge requests found
......@@ -35,37 +35,37 @@ To store a float value with the key 'myfloatprop' in all atoms of an entity:
import math
for atom in entity.GetAtomList():
val=5*math.sin(0.4*atom.GetPos().GetX())
atom.SetGenericFloatProperty("myfloatprop", val)
atom.SetFloatProp("myfloatprop", val)
If a GenericProperty at a given level (i.e. atom, bond, residue, chain or entity) already exists, it will be overwritten. To check if it exists, use:
::::python
exists=atom.HasGenericProperty("myfloatprop")
exists=atom.HasProp("myfloatprop")
print exists
To access the value of a GenericProperty, we first check if the property exists and then access it, using the method suitable for the data type of the property. For the previously set property "myfloatprop" of the data type Real, at the atom level:
::::python
for atom in entity.GetAtomList():
if atom.HasGenericProperty("myfloatprop"):
print atom.GetGenericFloatProperty("myfloatprop")
if atom.HasProp("myfloatprop"):
print atom.GetFloatProp("myfloatprop")
When trying to access a property that has not been set, or one that has been set, but at a different level, an error is thrown. The same is true when trying to access a property of a different data type, e.g.:
::::python
# all of the following lines will throw errors
# error because the property does not exist
print atom.GetGenericFloatProperty("unknownprop")
print atom.GetFloatProp("unknownprop")
# error because the property was set at another level
print entity.GetGenericFloatProperty("myfloatprop")
print entity.GetFloatProp("myfloatprop")
# error because the data type of the property is different
print atom.GetGenericStringProperty("myfloatprop")
print atom.GetStringProp("myfloatprop")
For more details see dox[ost::GenericPropertyContainer|GenericPropertyContainer].
## Use of GenericProperties in Queries
The [query language](docs/tut/query.html) can also be used for numeric generic properties (i.e. GenericFloatProperty and GenericIntProperty), but the syntax is slightly different. To access any generic properties, it needs to be specified that they are generic and at which level they are defined. Therefore, all generic properties start with a 'g', followed by an 'a', 'r' or 'c' for atom, residue or chain level respectively. For more details [see documentation](dox/html/query.html#gen_prop).
The [query language](docs/tut/query.html) can also be used for numeric generic properties (i.e. FloatProp and IntProp), but the syntax is slightly different. To access any generic properties, it needs to be specified that they are generic and at which level they are defined. Therefore, all generic properties start with a 'g', followed by an 'a', 'r' or 'c' for atom, residue or chain level respectively. For more details [see documentation](dox/html/query.html#gen_prop).
......@@ -84,7 +84,7 @@ Of course, we can also get a list of atoms grouped by residues:
And, for completeness, we will first group them by chain, then by residues.
::::python
for chain in fragments.chains:
for chain in fragment.chains:
print 'chain', chain.name, 'has', chain.residue_count, 'residue(s)'
for residue in chain.residues:
print ' ', residue, 'has', residue.atom_count, 'atom(s).'
......@@ -198,29 +198,29 @@ Before using the load functionality for an image, you have to import the io modu
To load a density map, type
::::python
map=io.LoadImage('OST_INSTALLATION_PATH/share/openstructure/examples/map/1ppt.map')
the_map=io.LoadImage('/path/to/examples/map/1ppt.map')
This will load the fragment density map from the specified file 'fragment.map' and store the result in fragment_map.
This will load the fragment density map from the specified file '1ppt.map' and store the result in the_map.
Now let's inspect what we just loaded:
::::python
print map.GetPixelSampling()
print the_map.GetPixelSampling()
We can see that the sampling is set to 1.0 Angstroems in all three dimensions.
## Manipulating images and density maps
The algorithms used for manipulation of an image are found in the img module. Therefore before using an algorithm we first have to import the img module.
The algorithms used for manipulation of an image are found in the img.alg module. Therefore before using an algorithm we first have to import the img.alg module.
::::python
from ost import img
from ost.img import alg
The img module provides a wide range of algorithm to manipulate image data. Here for the example we use a LowPassFilter to restrict the resolution of the density map.
The img.alg module provides a wide range of algorithm to manipulate image data. Here for the example we use a LowPassFilter to restrict the resolution of the density map.
::::python
map_filtered=map.Apply(img.alg.LowPassFilter(3.0))
map_filtered=the_map.Apply(alg.LowPassFilter(3.0))
The filtered map is stored in a new variable called fragment\_map\_filtered.
......@@ -240,7 +240,7 @@ the user to move through the slices. In OpenStructure this is achieved using a D
filtered map is created using the following command:
::::python
gui.CreateDataViewer(map_filtered)
gui.CreateDataViewer(map_filtered)
This command displays a panel showing one slice of the density map lying on a particular (x,y) plane in the coordinate reference system.
The 'z' and 'x' keys can be used to move to slices lying at a lower or higher coordinate along the 'z' axis, allowing the examination of
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment