org.strbio.mol
Class Residue

java.lang.Object
  extended by org.strbio.mol.Monomer
      extended by org.strbio.mol.Residue
All Implemented Interfaces:
DLinkedList.Node
Direct Known Subclasses:
ProfRes

public class Residue
extends Monomer

Class to represent a single residue in a protein. See ProfRes as an example of how to extend this.

 Version 1.3, 12/15/04 - added molecularWeight
 Version 1.21, 11/22/00 - added translateEA
 Version 1.2, 1/14/00 - added makeVirtualCB
 Version 1.18, 1/7/00 - made isGap return more gap types
 Version 1.17, 9/28/99 - saves more env stuff in YAPF files
 Version 1.16, 11/2/98 - added isValidType function
 Version 1.15, 8/20/98 - changed readVar2 and readConv to correctly read
   coil secondary structure as a -, not a ?
 Version 1.14, 8/7/98 - changed PrintfStream to Printf
 Version 1.13, 7/20/98 - changed coding for VAR files' env code...
   values range from -2 to -5.  -1 = unknown.
 Version 1.12, 7/17/98 - added readVar
 Version 1.11, 6/10/98 - added writeCASP
 Version 1.1, 4/17/98 - based on Monomer, JMC-specific stuff moved
   to org.strbio.jmc.JMCResidue
 Version 1.0, 4/3/98 - original version
 

Version:
1.21, 11/22/00
Author:
JMC
See Also:
Atom, AtomNode, Protein, ProfRes

Field Summary
static double[] aaMolecularWeight
          molecular weight of each residue above
 double cAlpha
          Pre-calculated alpha angle at this residue.
 double cPhi
          Pre-calculated phi angle at this residue.
 double cPsi
          Pre-calculated psi angle at this residue.
 double cTau
          Pre-calculated tau angle at this residue.
 int env
          Environment code.
 double exposedArea
          Area of the residue (in square angstroms) exposed to solvent, as calculated from Scott Presnell's access program.
static java.lang.String oneLetter
          one letter code, in alphabetical order by 3-letter code.
static java.lang.String oneLetterBLAST
          one letter code used by BLAST.
static java.lang.String oneLetterDefay
          one letter code, in alphabetical order by 1-letter code.
 double pctExposed
          Percentage of surface-exposed area, from 0 - 100.0.
 double predE
          Predicted strand probability.
 double predH
          Predicted helix probability.
 char predStructure
          Predicted secondary structure.
 char structure
          the structure, as defined by DSSP.
static java.lang.String threeLetter
          three letter code, in alphabetical order.
 
Fields inherited from class org.strbio.mol.Monomer
atoms, n, type
 
Constructor Summary
Residue()
          Constructor makes structure and predStructure '?'.
Residue(char t)
          Make a new residue of a given type.
Residue(Residue q)
          copy another residue, including the atoms.
Residue(java.lang.String t)
          Make a new residue of a given type (3-letter code).
 
Method Summary
 double alpha()
          Alpha is the bond angle between CA(n-1), CA(n), CA(n+1).
 void copyDataFrom(Monomer q)
          copy another residue, including the atoms.
 DLinkedList.Node copyNode()
          copy contents of a residue
static boolean is3Res(java.lang.String x)
          Is your string a valid 3-letter code?
 boolean isGap()
          is the character used to represent a gap?
static boolean isGap(char x)
          Is a character a gap code?
static boolean isRes(char x)
          Is your character a valid 1-letter code?
 boolean isValidType()
          is the character in 'type' valid for this residue?
 void makeVirtualCB()
          Construct a virtual CB atom.
 double molecularWeight()
          molecular weight for residue of a residue, minus 18 for the water missing in the peptide bond
static char num2Res(int x)
          Convert a number to amino acid one letter code (0-20), in the order shown in Residue.oneLetter.
static char num2ResDefay(int x)
          Convert a number to amino acid one letter code (0-20), in the order shown in Residue.oneLetterDefay.
static java.lang.String one2Three(char x)
          Convert your 1-letter code into 3-letter code.
 double phi()
          Phi is the bond angle between C(n-1), N(n), CA(n), C(n).
 double psi()
          Psi is the bond angle between N(n), CA(n), C(n), N(n+1).
 boolean readAccess(java.io.BufferedReader infile)
          Read this residue out of an Access format file (Scott Presnell's format).
 void readAccessRecord(java.lang.String buffer)
          Read Access record out of YAPF file.
 void readAngleRecord(java.lang.String buffer)
          Read pre-calc angles out of YAPF file.
 boolean readConv(java.io.BufferedReader infile)
          Read this residue out of a Conv format file (Tom Defay's format).
 boolean readDSSP(java.io.BufferedReader infile)
          Read this residue out of a DSSP (Dictionary of Secondary Structure for Proteins) format file (Kabsch & Sander's format).
 void readDSSPRecord(java.lang.String buffer)
          Read DSSP record out of YAPF file.
 boolean readEA(java.io.BufferedReader infile)
          Read this residue out of a EA (Estimated Accuracy) format file (JMC's format).
 void readJMCSTR(java.lang.String buffer)
          Get info for this residue out of a JMCSTR line in a PDB or YAPF file.
 void readPredSSRecord(java.lang.String buffer)
          Read predicted SS info out of YAPF file.
 boolean readProf(java.io.BufferedReader infile)
          Read this residue out of a Prof (sequence profile) format file (JMC's format).
 boolean readVar(java.io.BufferedReader infile)
          Read this residue out of a Var format file (Tom Defay's format).
 boolean readVar2(java.io.BufferedReader infile)
          Read this residue out of a Var2 format file (Tom Defay's format).
 void readVarTomRecord(java.lang.String buffer)
          Read VarTom record out of YAPF file.
static int res2Num(char x)
          Convert an amino acid one letter code to a number (0-20), in the order shown in Residue.oneLetter.
static int res2NumDefay(char x)
          Convert an amino acid one letter code to a number (0-20), in the order shown in Residue.oneLetterDefay.
 void stripAllButCA()
          Strip away all atoms except alpha carbons (atoms named "CA").
 double tau()
          Tau is the dihedral angle between CA(n-1), CA(n), CA(n+1), CA(n+2).
static char three2One(java.lang.String x)
          Convert your 3-letter code into 1-letter code.
 void translateEA()
          Translates predH and predE into predStructure (directly).
 java.lang.String typeName()
          Return a long name for this monomer, based on the type.
 void writeAccessRecord(Printf outfile)
          Write ACCESS record to YAPF file.
 void writeAngleRecord(Printf outfile)
          Write ANGLE record to YAPF file.
 void writeCASP(Printf outfile)
          Writes out this residue in CASP format.
 void writeConv(Printf outfile)
          Writes out this residue in Conv format.
 void writeDSSPRecord(Printf outfile)
          Write DSSP record to YAPF file.
 void writeEA(Printf outfile)
          Writes out this residue in EA format.
 void writePDBStr(Printf outfile)
          Writes out PDB JMCSTR records for this residue.
 void writePredSSRecord(Printf outfile)
          Write PREDSS record to YAPF file.
 void writeVar2(Printf outfile)
          Writes out this residue in Var2 format.
 void writeVarTomRecord(Printf outfile)
          Write VarTom record to YAPF file.
 
Methods inherited from class org.strbio.mol.Monomer
atomSearch, centerOfMass, centerOfMass, copyAtoms, isValidNonGap, nAtoms, nAtomsWithCoord, next, prev, readAtomRecord, readFasta, readSeqRecord, rotate, setNext, setPrev, stripAllAtoms, stripAllBut, stripAllButFirstAtom, stripAtomsByName, transform, translate, writePDBAtom, writePts, writeSeqRecord, writeYAPFAtom
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oneLetter

public static final java.lang.String oneLetter
one letter code, in alphabetical order by 3-letter code. Note 0 = NUL. This is the order used by my letter/number conversion functions.

See Also:
res2Num(char), num2Res(int), isRes(char), Constant Field Values

oneLetterDefay

public static final java.lang.String oneLetterDefay
one letter code, in alphabetical order by 1-letter code. Note 0 = NUL. This is the order used by the letter/number conversion functions which were written to read/write Tom Defay's file formats.

See Also:
res2NumDefay(char), num2ResDefay(int), Constant Field Values

threeLetter

public static final java.lang.String threeLetter
three letter code, in alphabetical order. Note 0 = NUL. This is the order used by my letter/number conversion functions. I haven't written any to convert directly; you have to convert to three <--> one <--> number.

See Also:
three2One(java.lang.String), one2Three(char), is3Res(java.lang.String), Constant Field Values

aaMolecularWeight

public static final double[] aaMolecularWeight
molecular weight of each residue above


oneLetterBLAST

public static final java.lang.String oneLetterBLAST
one letter code used by BLAST. Note that not all of these are actual residues.

See Also:
Constant Field Values

structure

public char structure
the structure, as defined by DSSP. Examples include H for helix, E for extended beta strand, T for turn. Everything not H or E is considered coil. Default is '?'.


predStructure

public char predStructure
Predicted secondary structure. Default is '?'.


predH

public double predH
Predicted helix probability. Range is 0.0 to 1.0. Coil probability is 1.0 - predH - predE. Default is 0.0.


predE

public double predE
Predicted strand probability. Range is 0.0 to 1.0. Coil probability is 1.0 - predH - predE. Default is 0.0.


cPhi

public double cPhi
Pre-calculated phi angle at this residue. This is here because some file formats like to keep track of the dihedral angles, but throw away the actual atoms they were calculated from. Default is NaN.

See Also:
phi()

cPsi

public double cPsi
Pre-calculated psi angle at this residue. This is here because some file formats like to keep track of the dihedral angles, but throw away the actual atoms they were calculated from. Default is NaN.

See Also:
psi()

cAlpha

public double cAlpha
Pre-calculated alpha angle at this residue. This is here because some file formats like to keep track of the dihedral angles, but throw away the actual atoms they were calculated from. Default is NaN.

See Also:
alpha()

cTau

public double cTau
Pre-calculated tau angle at this residue. This is here because some file formats like to keep track of the dihedral angles, but throw away the actual atoms they were calculated from. Default is NaN.

See Also:
tau()

exposedArea

public double exposedArea
Area of the residue (in square angstroms) exposed to solvent, as calculated from Scott Presnell's access program. Default is NaN.


pctExposed

public double pctExposed
Percentage of surface-exposed area, from 0 - 100.0. The default is NaN, indicating unknown environment.


env

public int env
Environment code. From Access, -1 (default) is unknown. 0=buried, 1=intermediate, 2=exposed. The boundaries used by Defay between categories are at 7.2% exposed, and 28.9% exposed. From var-tom, codes range from -5 to -2 and have to do with how much variation there is in the hydrophillic and hydrophobic residues in a profile at this position.

Constructor Detail

Residue

public Residue()
Constructor makes structure and predStructure '?'.


Residue

public Residue(char t)
Make a new residue of a given type.


Residue

public Residue(java.lang.String t)
Make a new residue of a given type (3-letter code).


Residue

public Residue(Residue q)
copy another residue, including the atoms. This makes another copy of the data.

Method Detail

isRes

public static final boolean isRes(char x)
Is your character a valid 1-letter code?


isGap

public static final boolean isGap(char x)
Is a character a gap code?


is3Res

public static final boolean is3Res(java.lang.String x)
Is your string a valid 3-letter code? Note that it has to be capitalized. There is a bug in this code; strings like "ALA ARG" or even "A A" will return true, but it works fine for all 3-letter strings without spaces.


three2One

public static final char three2One(java.lang.String x)
                            throws java.lang.IllegalArgumentException
Convert your 3-letter code into 1-letter code. Note that it has to be capitalized. There is a bug in this code; strings like "ALA ARG" or even "A A" will return values, but it works fine for all 3-letter strings without spaces. If you want to know if something can be converted, use is3Res.

Throws:
java.lang.IllegalArgumentException - if your String is not a valid AA.
See Also:
is3Res(java.lang.String)

copyDataFrom

public void copyDataFrom(Monomer q)
copy another residue, including the atoms.

Overrides:
copyDataFrom in class Monomer

copyNode

public DLinkedList.Node copyNode()
copy contents of a residue

Specified by:
copyNode in interface DLinkedList.Node
Overrides:
copyNode in class Monomer

res2Num

public static final int res2Num(char x)
                         throws java.lang.IllegalArgumentException
Convert an amino acid one letter code to a number (0-20), in the order shown in Residue.oneLetter. Also, maps B->N and Z->E. (B indicates somebody didn't know if it was a N or D, and Z indicates either E or Q). If you want to know if something can be converted, use isRes.

Throws:
java.lang.IllegalArgumentException - if your code isn't an AA.
See Also:
oneLetter, isRes(char)

res2NumDefay

public static final int res2NumDefay(char x)
                              throws java.lang.IllegalArgumentException
Convert an amino acid one letter code to a number (0-20), in the order shown in Residue.oneLetterDefay. Also, maps B->N and Z->E. (B indicates somebody didn't know if it was a N or D, and Z indicates either E or Q). If you want to know if something can be converted, use isRes.

Throws:
java.lang.IllegalArgumentException - if your code isn't an AA.
See Also:
oneLetterDefay, isRes(char)

num2Res

public static final char num2Res(int x)
                          throws java.lang.IllegalArgumentException
Convert a number to amino acid one letter code (0-20), in the order shown in Residue.oneLetter.

Throws:
java.lang.IllegalArgumentException - if your number is not 0-20.
See Also:
oneLetter

num2ResDefay

public static final char num2ResDefay(int x)
                               throws java.lang.IllegalArgumentException
Convert a number to amino acid one letter code (0-20), in the order shown in Residue.oneLetterDefay.

Throws:
java.lang.IllegalArgumentException - if your number is not 0-20.
See Also:
oneLetterDefay

one2Three

public static final java.lang.String one2Three(char x)
                                        throws java.lang.IllegalArgumentException
Convert your 1-letter code into 3-letter code. Note that it has to be capitalized. Also, maps B->ASN and Z->GLN. (B indicates somebody didn't know if it was a ASN or ASP, and Z indicates either GLU or GLN). If you want to know if something can be converted, use isRes.

Throws:
java.lang.IllegalArgumentException - if your character is not a valid AA.
See Also:
isRes(char)

typeName

public java.lang.String typeName()
Return a long name for this monomer, based on the type. The default is to just return a string of whatever's in 'type', but that should be overridden for Residues, Bases, etc. (i.e. 'C' -> "CYS" for Residues).

Overrides:
typeName in class Monomer

stripAllButCA

public final void stripAllButCA()
Strip away all atoms except alpha carbons (atoms named "CA").


readVar2

public final boolean readVar2(java.io.BufferedReader infile)
Read this residue out of a Var2 format file (Tom Defay's format). If the next line of input in the file is not in the right format, it resets the file back to before the line, and returns false. If the residue is successfully read in, the line is consumed, and the function returns true.

See Also:
Protein.readVar2(java.io.BufferedReader, org.strbio.io.Printf)

readVar

public final boolean readVar(java.io.BufferedReader infile)
Read this residue out of a Var format file (Tom Defay's format). If the next line of input in the file is not in the right format, it resets the file back to before the line, and returns false. If the residue is successfully read in, the line is consumed, and the function returns true.

See Also:
Protein.readVar(java.io.BufferedReader, org.strbio.io.Printf)

readAccess

public final boolean readAccess(java.io.BufferedReader infile)
Read this residue out of an Access format file (Scott Presnell's format). This searches for "ATOM 0 T " records, and translates the accessibility found for the residue into an environmental class using Tom Defay's scale. If a residue is successfully read in, the function returns true. If an 'END' is found first, or the end of the file, it returns false.

See Also:
Protein.readAccess(java.io.BufferedReader, org.strbio.io.Printf)

readEA

public final boolean readEA(java.io.BufferedReader infile)
Read this residue out of a EA (Estimated Accuracy) format file (JMC's format). If the next line of input in the file is not in the right format, it resets the file back to before the line, and returns false. If the residue is successfully read in, the line is consumed, and the function returns true.

See Also:
Protein.readEA(java.io.BufferedReader, org.strbio.io.Printf)

readConv

public final boolean readConv(java.io.BufferedReader infile)
Read this residue out of a Conv format file (Tom Defay's format). If the next line of input in the file is not in the right format, it resets the file back to before the line, and returns false. If the residue is successfully read in, the line is consumed, and the function returns true.

See Also:
Protein.readConv(java.io.BufferedReader, org.strbio.io.Printf)

readJMCSTR

public void readJMCSTR(java.lang.String buffer)
                throws java.io.IOException
Get info for this residue out of a JMCSTR line in a PDB or YAPF file.

Throws:
java.io.IOException

readPredSSRecord

public void readPredSSRecord(java.lang.String buffer)
                      throws java.io.IOException
Read predicted SS info out of YAPF file.

Throws:
java.io.IOException

writePredSSRecord

public void writePredSSRecord(Printf outfile)
                       throws java.io.IOException
Write PREDSS record to YAPF file.

Throws:
java.io.IOException

readDSSPRecord

public void readDSSPRecord(java.lang.String buffer)
                    throws java.io.IOException
Read DSSP record out of YAPF file.

Throws:
java.io.IOException

writeDSSPRecord

public void writeDSSPRecord(Printf outfile)
                     throws java.io.IOException
Write DSSP record to YAPF file.

Throws:
java.io.IOException

readAccessRecord

public void readAccessRecord(java.lang.String buffer)
                      throws java.io.IOException
Read Access record out of YAPF file.

Throws:
java.io.IOException

writeAccessRecord

public void writeAccessRecord(Printf outfile)
                       throws java.io.IOException
Write ACCESS record to YAPF file.

Throws:
java.io.IOException

readVarTomRecord

public void readVarTomRecord(java.lang.String buffer)
                      throws java.io.IOException
Read VarTom record out of YAPF file.

Throws:
java.io.IOException

writeVarTomRecord

public void writeVarTomRecord(Printf outfile)
                       throws java.io.IOException
Write VarTom record to YAPF file.

Throws:
java.io.IOException

readAngleRecord

public void readAngleRecord(java.lang.String buffer)
                     throws java.io.IOException
Read pre-calc angles out of YAPF file.

Throws:
java.io.IOException

writeAngleRecord

public void writeAngleRecord(Printf outfile)
                      throws java.io.IOException
Write ANGLE record to YAPF file.

Throws:
java.io.IOException

readProf

public boolean readProf(java.io.BufferedReader infile)
Read this residue out of a Prof (sequence profile) format file (JMC's format). If the next line of input in the file is not in the right format, it resets the file back to before the line, and returns false. If the residue is successfully read in, the line is consumed, and the function returns true. All profile information is thrown away, since there's no field to store it in.


readDSSP

public final boolean readDSSP(java.io.BufferedReader infile)
                       throws java.io.IOException
Read this residue out of a DSSP (Dictionary of Secondary Structure for Proteins) format file (Kabsch & Sander's format). If the next line of input in the file is not in the right format, it resets the file back to before the line, and returns false. If the residue is successfully read in, the line is consumed, and the function returns true. Only the number, type, structure, and chainID information are paid attention to. chainID is returned in the predStructure field, and should be processed by Protein.readDSSP.

Throws:
java.io.IOException
See Also:
Protein.readDSSP(java.io.BufferedReader, org.strbio.io.Printf)

writeEA

public final void writeEA(Printf outfile)
                   throws java.io.IOException
Writes out this residue in EA format.

Throws:
java.io.IOException
See Also:
Protein.writeEA(org.strbio.io.Printf)

translateEA

public final void translateEA()
Translates predH and predE into predStructure (directly).


writeCASP

public final void writeCASP(Printf outfile)
                     throws java.io.IOException
Writes out this residue in CASP format.

Throws:
java.io.IOException
See Also:
Protein.writeCASP(org.strbio.io.Printf)

writeConv

public final void writeConv(Printf outfile)
                     throws java.io.IOException
Writes out this residue in Conv format. If any pre-calculated angles (i.e. c_phi) are undefined (Float.NaN) then it prints 1000.000000 to the file in their place.

Throws:
java.io.IOException
See Also:
Protein.writeConv(org.strbio.io.Printf)

writeVar2

public final void writeVar2(Printf outfile)
                     throws java.io.IOException
Writes out this residue in Var2 format.

Throws:
java.io.IOException
See Also:
Protein.writeVar2(org.strbio.io.Printf)

writePDBStr

public final void writePDBStr(Printf outfile)
                       throws java.io.IOException
Writes out PDB JMCSTR records for this residue. These records have same info as in EA files, plus pre-calculated dihedral angles. If any of the latter are Double.NaN, it indicates this by printing 1000.000000. This function is really slow and gets called a lot, so has been optimized. Original code is left in comments.

Throws:
java.io.IOException
See Also:
Protein.writePDB(org.strbio.io.Printf, boolean)

alpha

public final double alpha()
Alpha is the bond angle between CA(n-1), CA(n), CA(n+1). Returns Double.NaN if any info is missing. This info has been precalculated for some file formats.


tau

public final double tau()
Tau is the dihedral angle between CA(n-1), CA(n), CA(n+1), CA(n+2). Returns Double.NaN if any info is missing. This info has been precalculated for some file formats.


phi

public final double phi()
Phi is the bond angle between C(n-1), N(n), CA(n), C(n). Returns Double.NaN if any info is missing. This info has been precalculated for some file formats.


psi

public final double psi()
Psi is the bond angle between N(n), CA(n), C(n), N(n+1). Returns Double.NaN if any info is missing. This info has been precalculated for some file formats.


isValidType

public boolean isValidType()
is the character in 'type' valid for this residue?

Overrides:
isValidType in class Monomer

isGap

public boolean isGap()
is the character used to represent a gap?

Overrides:
isGap in class Monomer

makeVirtualCB

public void makeVirtualCB()
Construct a virtual CB atom. N, C, and CA atoms are needed.


molecularWeight

public double molecularWeight()
molecular weight for residue of a residue, minus 18 for the water missing in the peptide bond

Overrides:
molecularWeight in class Monomer