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

From MSL-Libraries
Jump to navigationJump to search
Line 9: Line 9:
 
=== Background ===
 
=== Background ===
 
 
MSL objects can be selected if they inherit the "Selectable" object.  
+
MSL objects can be selected if they inherit the '''[[MSL Objects:Selectable|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:
+
====Selection By Name:====
        Can select based on selection flags that are inside each Atom.  
+
Can select based on selection flags that are inside each Atom.   By default every atom has an "all" selection flag set.
      By default every atom has an "all" selection flag set.
 
 
       
 
       
        You can create selection flags for atoms by:
+
You can create selection flags for atoms by:
          1. Using Atom object:             a.setSelectionFlag("foobar")
+
* Using '''[[MSL Objects:Atom|Atom]]''' object:                     a.setSelectionFlag("foobar")
          2. Using AtomSelection object:    as.select("foobar, chain A")
+
* Using '''[[MSL Objects:AtomSelection|AtomSelection]]''' object:    as.select("foobar, chain A")
 
 
 
 
 
                 
 
                 
    Selection By Property:        
+
====Selection By Property====
          Chain A:    as.select("chain A")
+
Using '''[[MSL Objects:AtomSelection|AtomSelection]]''' Object, to select all atoms of chain A:    as.select("chain A")
 +
 
 
=== To compile ===
 
=== To compile ===
 
<source lang="text">
 
<source lang="text">

Revision as of 20:51, 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:

  • Using Atom object: a.setSelectionFlag("foobar")
  • Using AtomSelection object: 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