This is a collection of m-files to read PDB-files from the Brookhaven
protein databank[1] to GNU Octave[2] and display them with Openrasmol[3]. 
They're not well tested, so use them at your own risk.

Copying:
--------
You can distribute these files under the terms of the GNU GPL[4].

Installation:
-------------

You have to edit the variable RASMOL in file plotpdb.m to point to rasmol.sh.
If rasmol is not in your path, you also need to edit rasmol.sh to contain the
path to the rasmol binary.

Usage:
------

read_pdb.m reads a structure from a pdb-file to an Octave structure. See the
function file for more details

creadpdb.oct is the underlying c++ implementation of read_pdb.m. Use this if
you do not need the conversion of element names to atomic numbers.

write_pdb.m tries to write as complete pdb-file as possible given an Octave
pdb-structure as an argument

write_pdb_quick.m writes a pdb-file containing only the atomic coordinates
(the ATOM and HETATM lines) suitable for viewing with Rasmol.

plotpdb.m displays a protein structrure with Rasmol. The input can be either
a pdb-file or an Octave pdb-structure.

strtoz.m converts strings of chemical stoichiometries of the type "H2O" to
the atomic numbers of the elements, and their amounts in the compound. You
can generate a test dataset for this function with the script appended below.

References:
[1] http://www.rcsb.org/pdb/
[2] http://www.octave.org/
[3] http://www.openrasmol.org/
[4] http://www.gnu.org/copyleft/gpl.html

mktestset.m:

function testset = mktestset(N, M)
#function testset = mktestset(N, M)  
# 
# Return a N rows long array of stoichiometries, each M elements long.
# For testing strtoz.m

# Teemu Ikonen 22.4.2004

  tabfile = file_in_loadpath("elements.mat");
  load("-force", tabfile);
  
  testset = char(toascii(" ").*ones(N, 4.*M));
  
  for i = 1:N,
    s = ""; 
    for j = 1:M, 
      s = strcat(s, deblank(elements((floor(length(elements)*rand())+1),:)), \
                 sprintf("%d", 99.9.*rand()));
    endfor;
    testset(i,1:length(s)) = s;
  endfor
  
endfunction
