Difference between revisions of "Tutorial:Selecting subsets of atoms"

From MSL-Libraries
Jump to navigationJump to search
(Selection By Name:)
Line 17: Line 17:
 
       
 
       
 
You can create selection flags for atoms by:
 
You can create selection flags for atoms by:
* Using  '''[[MSL Objects:Atom|Atom]]''' object:                     a.setSelectionFlag("foobar")
+
* Using  '''[[MSL Objects:Atom|Atom]]''' object:        
* Using  '''[[MSL Objects:AtomSelection|AtomSelection]]''' object:    as.select("foobar, chain A")
+
    a.setSelectionFlag("foobar")
+
* Using  '''[[MSL Objects:AtomSelection|AtomSelection]]''' object:     
               
+
    as.select("foobar, chain A")
 +
 
 
====Selection By Property====
 
====Selection By Property====
 
Using '''[[MSL Objects:AtomSelection|AtomSelection]]''' Object, to select all atoms of chain A:    as.select("chain A")
 
Using '''[[MSL Objects:AtomSelection|AtomSelection]]''' Object, to select all atoms of chain A:    as.select("chain A")

Revision as of 20:52, 23 March 2010

NOTE: TUTORIAL WRITING IN PROGRESS DO NOT FOLLOW THIS


This is an example on how to select atoms and residues with MSL, following the example program example_selecting_atoms_and_residues.cpp in the examples/ subdirectory.

Complete source of example_selecting_atoms_and_residues


Background

MSL objects can be selected if they inherit the Selectable object. So far, Atoms and Residues are Selectable. The requirement for being selectable is to implement the virtual "addSelectableFunctions", which define what properties of the object can be selected upon.


Selection By Name:

Can select based on selection flags that are inside each Atom. By default every atom has an "all" selection flag set.

You can create selection flags for atoms by:

   a.setSelectionFlag("foobar")
   as.select("foobar, chain A")

Selection By Property

Using AtomSelection Object, to select all atoms of chain A: as.select("chain A")

To compile

% make bin/example_selecting_atoms_and_residues

To run the program

Go to the main directory and run the command (note, the location of the exampleFiles subdirectory needs to be provided as an argument)

% bin/example_selecting_atoms_and_residues exampleFiles

Program description

  • Read a PDB file.
60	System container;
61	if (!container.readPdb(file)) {
		// reading failed, error handling code here
68	}

Back to the tutorial page