org.strbio.mol
Class Polymer

java.lang.Object
  extended by org.strbio.mol.Molecule
      extended by org.strbio.mol.Polymer
Direct Known Subclasses:
Protein

public class Polymer
extends Molecule

Class to represent a linear, unbranched polymer.

 Version 1.43, 11/27/06 - added readSequence
 Version 1.42, 12/15/05 - added molecularWeight
 Version 1.42, 3/29/04 - added check for null monomers in writeFasta
 Version 1.41, 1/8/03 - made copyAtoms copy property of having atoms
 Version 1.4, 2/12/02 - added stripCommonGaps
 Version 1.31, 4/18/00 - fixed unnecessary ioexception warnings in read()
 Version 1.3, 1/11/00 - added stripAllBut
 Version 1.28, 1/7/00 - changed stripType('.') to stripGaps
 Version 1.27, 12/13/99 - added stripAtomsByName
 Version 1.26, 12/10/99 - added Marcin's makeMonDistanceAllAtomMin()
 Version 1.25, 12/6/99 - added reverse
 Version 1.24, 7/22/99 - added support for Data
 Version 1.23, 6/25/99 - added possible AlignmentParameters option to
   globalAlign, globalCompare.  Old API also works.
 Version 1.22, 6/23/99 - made globalAlign return the alignment score
 Version 1.21, 3/30/99 - made printfs consistent, limited names to 4096 chars
   (Molecule.MAX_NAME_LENGTH)
 Version 1.2, 2/10/99 - added YAPF format
 Version 1.16, 11/17/98 - added constructor from String, sequence() functions
 Version 1.15, 11/2/98 - added stripGaps()
 Version 1.14, 8/17/98 - changed all JMC.fatal() calls to exceptions,
   since they aren't always fatal.
 Version 1.13, 8/7/98 - changed PrintfStream to Printf
 Version 1.12, 5/6/98 - changed newPolymer to splitCopy, made protected
 Version 1.11, 5/5/98 - added writeFasta
 Version 1.1, 4/27/98 - improved speed of autoSplit
 Version 1.0, 4/17/98 - original version
 

Version:
1.43, 11/27/06
Author:
JMC
See Also:
Atom, AtomNode, Monomer, Protein

Field Summary
 char chainID
          Chain ID, or space if none.
protected static java.io.BufferedReader includeFile
           
protected static boolean includingFile
           
 DHalfMatrix monDistance
          Distance between every pair of different monomers.
 DLinkedList monomers
          Polymers are made out of a set of monomers.
protected  int properties
          Integer that stores properties of the polymer.
 
Fields inherited from class org.strbio.mol.Molecule
atoms, data, MAX_NAME_LENGTH, name
 
Constructor Summary
Polymer()
          Create a new polymer with no information known about it.
Polymer(Polymer q)
          Copy another Polymer, making copies of all data fields.
Polymer(java.lang.String sequence)
          Make a new polymer from a string representing the monomer sequence.
 
Method Summary
 void alignToArray(int[] f)
          Adjust gaps in polymer to form one half of a given alignment.
 void alignToInverseArray(int[] f)
          Adjust gaps in polymer to match an array representation.
protected  Polymer[] autoSplit()
          splits a polymer into several, if it has a break in the chain.
 DVector centerOfMass()
          Return a new DVector(3) containing the center of mass for the polymer.
 void centerOfMass(DVector cm)
          Finds the center of mass for the monomer and puts in in the DVector(3) that you pass it.
 void clear()
          Forget everything you know about this Polymer.
 void clearProperties()
          clears all the properties.
 void clearProperty(int prop)
          clears (un-sets) one property.
 Polymer copy()
          Return a copy of yourself.
 void copyAtoms(Polymer q)
          copy the atoms from another polymer.
 void correctAlignFold(int[] correct)
          Deprecated. use alignToInverseArray.
 void correctAlignSeq(int[] correct)
          Deprecated. Use alignToArray instead.
 void deleteMonDistance()
          get rid of the inter-monomer distance matrix and free up the memory it was using.
 Monomer firstMon()
          Return first monomer if there is one, else null.
 Alignment getGlobalAlignment(Polymer y, AlignmentParameters ap, Alignment nail)
          This does the above, but without actually storing the alignment as gaps in the polymers.
 Monomer[] getMonomers()
          get an array of the monomers.
 Monomer[] getNonGapMonomers()
          get an array of the valid non-gap monomers.
 boolean getProperty(int prop)
          looks up one property.
 Monomer[] getValidNonGapMonomers()
          get an array of the valid non-gap monomers.
 double globalAlign(Polymer y, AlignmentParameters ap, Alignment nail)
          a mostly generic global alignment function.
 double globalAlign(Polymer y, GapModel gm, ScoreList sl, int[] nail)
          Deprecated. use AlignmentParameters
 double globalCompare(Polymer y, AlignmentParameters ap)
          a mostly generic global comparison function.
 double globalCompare(Polymer y, GapModel gm, ScoreList sl)
          Deprecated. use AlignmentParameters
 void keepMonomers(int n1, int n2)
          Keep the monomers not between n1 and n2 (inclusive); strip away the rest.
 void kludgeChainID()
          Kludge chain ID from the name, assuming the name is PDB-style 1abcD (D=chain id), or ASTRAL-style d1abcD_/e1abc.1D _ gives no chain id.
 Monomer lastMon()
          Return last monomer if there is one, else null.
 int length()
          Length is synonym for nMonomers.
 void makeMonDistance()
          calculate inter-monomer distance matrix for use in threading functions.
 void makeMonDistanceAllAtomMin()
          calculate inter-monomer distance matrix for use in threading functions.
static void minareaSuperimpose(Polymer a, Polymer b)
          Superimpose two polymers using minarea.
 double molecularWeight()
          Calculate molecular weight
 Monomer monomer(int n)
          returns the N'th monomer in the sequence.
 Monomer newMonomer()
          This should return a new monomer of whatever type this polymer is made of (i.e.
 Monomer newMonomer(char t)
          This should return a new monomer of whatever type this polymer is made of (i.e.
 Monomer newMonomer(java.lang.String s)
          This should return a new monomer of whatever type this polymer is made of (i.e.
 int nMonomers()
          How many monomers do we have?
 int nMonomers(char c)
          How many monomers do we have of type c?
 int nonGapMonomers()
          How many non-gap monomers do we have?
 void pad(int length)
          pads a sequence out (at the end) to a specified number of nmon using '.' as a filler residue
 void printSequence(Printf outfile)
          print out the sequence in a nice 1-letter code format
 void processYAPF(java.lang.String buffer)
          Process a line from a YAPF file... this should ignore the line if it doesn't know what it is.
 void quickAlign(Polymer y)
          standard needleman-wunch alignment algorithm, with identity matrix, and constant gap penalty of 1.
 void quickAlign(Polymer y, double gapI, double gapE)
          standard needleman-wunch alignment algorithm, with identity matrix and given gap penalties
 int quickCompare(Polymer y)
          standard needleman-wunch comparison algorithm, with identity matrix and a constant gap penalty of 1.
 double quickCompare(Polymer y, double gapI, double gapE)
          standard needleman-wunch comparison algorithm, with identity matrix and given gap penalties.
 void read(java.io.BufferedReader infile)
          Find the first thing in a file that looks like a polymer, and read it.
 void read(java.io.BufferedReader infile, Printf outfile)
          Find the first thing in a file that looks like a polymer, and read it.
protected  void read(java.io.BufferedReader infile, Printf outfile, boolean inc)
          This does the work in reading a protein, but should not be called directly.
 void readFasta(java.io.BufferedReader infile, Printf outfile)
          read a polymer out of a Fasta file.
 void readList(java.io.BufferedReader infile, Printf outfile)
          read a polymer out of a 'list' file.
 void readSequence(java.io.BufferedReader infile, Printf outfile)
          Read a polymer from a file containing just the sequence (all non-whitespace chars)
 void readYAPF(java.io.BufferedReader infile, Printf outfile)
          read a polymer out of a YAPF file.
protected  boolean recognizeAndRead(java.lang.String buffer, java.io.BufferedReader infile, Printf outfile)
          This routine checks to see if the current buffer looks like the beginning of a polymer in a known file format.
 void renumberMonomers(int n)
          Renumbers the monomers starting with a given integer.
 void renumberValidNonGapMonomers(int n)
          Like renumberMonomers, but only does the valid, non-gap monomers.
 void reverse()
          Reverse yourself.
 Polymer reverseCopy()
          Return a reversed copy of yourself.
 void rotate(DMatrix rot)
          rotate all monomers by multiplying by a 3x3 rotation matrix.
 java.lang.String sequence()
          Return the sequence as a string.
 java.lang.String sequenceNonGap()
          Return the sequence (only non-gap monomers) as a string.
 java.lang.String sequenceValidNonGap()
          Return the sequence (only valid non-gap monomers) as a string.
 void setProperty(int prop)
          sets one property.
protected  Polymer splitCopy()
          This should return a copy of all data which should be copied during AutoSplit (not including monomers, monDistance, name).
 void stripAllAtoms()
          Strip out all atoms from all monomers.
 void stripAllBut(java.lang.String[] names)
          Strip away all atoms except ones named in an array.
 void stripAllButFirstAtom()
          Strip all but first atom from all monomers.
 void stripAtomsByName(java.lang.String atomName)
          Strip away a named atom or atoms.
 void stripCommonGaps(Polymer q)
          strip out all gaps in 2 polymers which occur at the same location.
 void stripGaps()
          strip out all gaps.
 void stripInvalidAndGaps()
          strip out all invalid monomers and gaps.
 void stripNoAtoms()
          strip out all monomers with no atoms.
 void stripType(char x)
          strip out all monomers with a certain type.
 void transform(DMatrix trans)
          transform the position of all monomers.
 void translate(DVector trans)
          translate all monomers by adding a DVector(3) to their coordinates.
 void trimEnds(char x)
          strip out all monomers with a certain type from both ends of the sequence.
 int validNonGapMonomers()
          How many valid non-gap monomers do we have?
 void writeFasta(Printf outfile)
          Write in Fasta format.
 void writePDB(Printf outfile)
          Write in PDB format, which includes SEQRES and ATOM records.
 void writePDBAtom(Printf outfile)
          Write PDB ATOM records for this polymer.
 void writePDBSeqres(Printf outfile)
          Write PDB SEQRES records for this polymer.
 void writePTS(Printf outfile)
          Write in PTS format.
 void writeYAPF(Printf outfile)
          A portable way of writing a polymer, which is expandable to include protein/profile info also.
 void writeYAPFAtom(Printf outfile)
          Write YAPF ATOM records for this polymer.
protected  void writeYAPFInfo(Printf outfile)
          Write applicable sections of YAPF info.
protected  Monomer YAPFGetNextMonomer(int n)
          Return the next non-gap residue with number 'n', or null if there is none.
 
Methods inherited from class org.strbio.mol.Molecule
atomSearch, copyAtoms
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

properties

protected int properties
Integer that stores properties of the polymer. See PolymerProperties for possible settings (which are OR'ed together)


monomers

public DLinkedList monomers
Polymers are made out of a set of monomers.


chainID

public char chainID
Chain ID, or space if none. Note that the name of a PDB file and the Chain ID's in it are internally converted to lower case.


monDistance

public DHalfMatrix monDistance
Distance between every pair of different monomers. This is not really meant to be public, but necessary so functions in org.strbio.mol.lib work. Be careful!


includingFile

protected static boolean includingFile

includeFile

protected static java.io.BufferedReader includeFile
Constructor Detail

Polymer

public Polymer()
Create a new polymer with no information known about it.


Polymer

public Polymer(Polymer q)
Copy another Polymer, making copies of all data fields.


Polymer

public Polymer(java.lang.String sequence)
Make a new polymer from a string representing the monomer sequence.

Method Detail

setProperty

public void setProperty(int prop)
sets one property.


getProperty

public boolean getProperty(int prop)
looks up one property.


clearProperty

public void clearProperty(int prop)
clears (un-sets) one property.


clearProperties

public void clearProperties()
clears all the properties.


newMonomer

public Monomer newMonomer()
This should return a new monomer of whatever type this polymer is made of (i.e. Residue, Base). By default, this is just Monomer.


newMonomer

public Monomer newMonomer(char t)
This should return a new monomer of whatever type this polymer is made of (i.e. Residue, Base), and initialize the type from a character.


newMonomer

public Monomer newMonomer(java.lang.String s)
This should return a new monomer of whatever type this polymer is made of (i.e. Residue, Base), and initialize the type from a string.


nMonomers

public int nMonomers()
How many monomers do we have?


length

public int length()
Length is synonym for nMonomers.


getMonomers

public Monomer[] getMonomers()
get an array of the monomers.


firstMon

public Monomer firstMon()
Return first monomer if there is one, else null.


lastMon

public Monomer lastMon()
Return last monomer if there is one, else null.


nMonomers

public int nMonomers(char c)
How many monomers do we have of type c?


nonGapMonomers

public int nonGapMonomers()
How many non-gap monomers do we have?


getNonGapMonomers

public Monomer[] getNonGapMonomers()
get an array of the valid non-gap monomers.


validNonGapMonomers

public int validNonGapMonomers()
How many valid non-gap monomers do we have?


getValidNonGapMonomers

public Monomer[] getValidNonGapMonomers()
get an array of the valid non-gap monomers.


clear

public void clear()
Forget everything you know about this Polymer. This is not the Polymer you were looking for.

Overrides:
clear in class Molecule

printSequence

public void printSequence(Printf outfile)
                   throws java.io.IOException
print out the sequence in a nice 1-letter code format

Throws:
java.io.IOException

sequence

public java.lang.String sequence()
Return the sequence as a string.


sequenceValidNonGap

public java.lang.String sequenceValidNonGap()
Return the sequence (only valid non-gap monomers) as a string.


sequenceNonGap

public java.lang.String sequenceNonGap()
Return the sequence (only non-gap monomers) as a string.


monomer

public Monomer monomer(int n)
returns the N'th monomer in the sequence. This starts from zero and counts gaps, so it has no relation to the residue (if it exists) with number N. This function is slow the first time it gets called after loading the polymer in or making insertions/deletions, but otherwise fast.


makeMonDistance

public void makeMonDistance()
calculate inter-monomer distance matrix for use in threading functions.


makeMonDistanceAllAtomMin

public void makeMonDistanceAllAtomMin()
calculate inter-monomer distance matrix for use in threading functions. All atoms are examined, and the minimum distance between any 2 atoms is assigned as the inter-monomer distance.


deleteMonDistance

public final void deleteMonDistance()
get rid of the inter-monomer distance matrix and free up the memory it was using.


readFasta

public final void readFasta(java.io.BufferedReader infile,
                            Printf outfile)
                     throws java.io.IOException
read a polymer out of a Fasta file.

Parameters:
infile - an open Fasta file
outfile - if non-null, will print info on what's going on
Throws:
java.io.IOException
See Also:
read(java.io.BufferedReader, org.strbio.io.Printf, boolean), Monomer.readFasta(java.io.BufferedReader)

readSequence

public void readSequence(java.io.BufferedReader infile,
                         Printf outfile)
                  throws java.io.IOException
Read a polymer from a file containing just the sequence (all non-whitespace chars)

Throws:
java.io.IOException

readList

public final void readList(java.io.BufferedReader infile,
                           Printf outfile)
                    throws java.io.IOException
read a polymer out of a 'list' file. This just reads the name out of the file.

Parameters:
infile - an open file
outfile - if non-null, will print info on what's going on
Throws:
java.io.IOException
See Also:
PolymerSet.readList(java.lang.String, org.strbio.io.Printf)

YAPFGetNextMonomer

protected Monomer YAPFGetNextMonomer(int n)
                              throws java.io.IOException
Return the next non-gap residue with number 'n', or null if there is none. This advances the monomer pointer to the next monomer after the one returned.

Throws:
java.io.IOException - if no monomer is found

processYAPF

public void processYAPF(java.lang.String buffer)
                 throws java.io.IOException
Process a line from a YAPF file... this should ignore the line if it doesn't know what it is.

Throws:
java.io.IOException

readYAPF

public final void readYAPF(java.io.BufferedReader infile,
                           Printf outfile)
                    throws java.io.IOException
read a polymer out of a YAPF file. This reads in each line and tries to understand it, until it gets to an 'end' line.

Throws:
java.io.IOException

writeYAPFInfo

protected void writeYAPFInfo(Printf outfile)
                      throws java.io.IOException
Write applicable sections of YAPF info.

Throws:
java.io.IOException

writeYAPF

public final void writeYAPF(Printf outfile)
                     throws java.io.IOException
A portable way of writing a polymer, which is expandable to include protein/profile info also. YAPF = yet another p(polymer, protein, profile) format.

Throws:
java.io.IOException

recognizeAndRead

protected boolean recognizeAndRead(java.lang.String buffer,
                                   java.io.BufferedReader infile,
                                   Printf outfile)
                            throws java.io.IOException
This routine checks to see if the current buffer looks like the beginning of a polymer in a known file format. If so, the BufferedReader is reset, the polymer is read in, and the function returns true. If not, the function returns false.

Here are some things (when found at the beginning of a line) that signal a polymer is coming up.

Throws:
java.io.IOException

read

protected void read(java.io.BufferedReader infile,
                    Printf outfile,
                    boolean inc)
This does the work in reading a protein, but should not be called directly. inc is true if we're being told to include another file.


read

public void read(java.io.BufferedReader infile)
Find the first thing in a file that looks like a polymer, and read it.

Parameters:
infile - an open BufferedReader containing a polymer

read

public void read(java.io.BufferedReader infile,
                 Printf outfile)
Find the first thing in a file that looks like a polymer, and read it.

Parameters:
infile - an open BufferedReader containing a polymer
outfile - if non-null, will print info on what's going on

writePDBSeqres

public void writePDBSeqres(Printf outfile)
                    throws java.io.IOException
Write PDB SEQRES records for this polymer.

Parameters:
outfile - where to write to
Throws:
java.io.IOException

writePDBAtom

public void writePDBAtom(Printf outfile)
                  throws java.io.IOException
Write PDB ATOM records for this polymer.

Parameters:
outfile - where to write to
Throws:
java.io.IOException

writeYAPFAtom

public void writeYAPFAtom(Printf outfile)
                   throws java.io.IOException
Write YAPF ATOM records for this polymer.

Parameters:
outfile - where to write to
Throws:
java.io.IOException

writePDB

public void writePDB(Printf outfile)
              throws java.io.IOException
Write in PDB format, which includes SEQRES and ATOM records.

Parameters:
outfile - where to write to
Throws:
java.io.IOException

writePTS

public final void writePTS(Printf outfile)
                    throws java.io.IOException
Write in PTS format.

Parameters:
outfile - where to write to
Throws:
java.io.IOException

writeFasta

public void writeFasta(Printf outfile)
                throws java.io.IOException
Write in Fasta format.

Parameters:
outfile - where to write to
Throws:
java.io.IOException

stripType

public final void stripType(char x)
strip out all monomers with a certain type.


trimEnds

public final void trimEnds(char x)
strip out all monomers with a certain type from both ends of the sequence.


stripGaps

public final void stripGaps()
strip out all gaps.


stripCommonGaps

public final void stripCommonGaps(Polymer q)
strip out all gaps in 2 polymers which occur at the same location. If one polymer is longer than the other, an exception is thrown.


stripInvalidAndGaps

public final void stripInvalidAndGaps()
strip out all invalid monomers and gaps.


stripNoAtoms

public final void stripNoAtoms()
strip out all monomers with no atoms.


stripAllAtoms

public final void stripAllAtoms()
Strip out all atoms from all monomers.


stripAllBut

public final void stripAllBut(java.lang.String[] names)
Strip away all atoms except ones named in an array. This is a more general case of Residue.StripAllButCA, but is a bit less efficient due to having to set up the array with multiple names.


stripAllButFirstAtom

public final void stripAllButFirstAtom()
Strip all but first atom from all monomers.


keepMonomers

public final void keepMonomers(int n1,
                               int n2)
Keep the monomers not between n1 and n2 (inclusive); strip away the rest. This uses the residue numbers stored in the residues, not the internal residue numbers used by monomer().


renumberMonomers

public final void renumberMonomers(int n)
Renumbers the monomers starting with a given integer. This stores the monomer numbers in the number field of each one.


renumberValidNonGapMonomers

public final void renumberValidNonGapMonomers(int n)
Like renumberMonomers, but only does the valid, non-gap monomers. Invalid or gap monomers are labelled zero.


copy

public Polymer copy()
Return a copy of yourself.


reverse

public void reverse()
Reverse yourself. Name is prepended with an 'R' character.


reverseCopy

public Polymer reverseCopy()
Return a reversed copy of yourself.


splitCopy

protected Polymer splitCopy()
This should return a copy of all data which should be copied during AutoSplit (not including monomers, monDistance, name).


copyAtoms

public final void copyAtoms(Polymer q)
copy the atoms from another polymer.


globalAlign

public final double globalAlign(Polymer y,
                                AlignmentParameters ap,
                                Alignment nail)
a mostly generic global alignment function. This will align this polymer with another polymer, returning an Alignment object. Before alignment, all current gaps in both polymers are removed. Returns the comparison score.

Generally, 'this' is the sequence and Polymer 'y' is the fold.

This gets passed a linked list of scoring functions, which include relative weights for each function.

This function takes a GapModel containing gap penalties like gapI and gapE, or more complex models.

If the nail matrix is non-null, any pairs of nmon specified in it will be "nailed down" with a big negative score. See the Alignment class for setting up the nail matrix.

See Also:
Alignment, globalCompare(org.strbio.mol.Polymer, org.strbio.mol.lib.GapModel, org.strbio.mol.lib.ScoreList)

globalAlign

public final double globalAlign(Polymer y,
                                GapModel gm,
                                ScoreList sl,
                                int[] nail)
Deprecated. use AlignmentParameters

This is the old API for calling globalAlign.


getGlobalAlignment

public final Alignment getGlobalAlignment(Polymer y,
                                          AlignmentParameters ap,
                                          Alignment nail)
This does the above, but without actually storing the alignment as gaps in the polymers.


globalCompare

public final double globalCompare(Polymer y,
                                  GapModel gm,
                                  ScoreList sl)
Deprecated. use AlignmentParameters

Old API


globalCompare

public final double globalCompare(Polymer y,
                                  AlignmentParameters ap)
a mostly generic global comparison function. This will compute the best score for aligning this polymer with another polymer. All current gaps in both polymer are removed.

Generally, 'this' is the sequence and Polymer 'y' is the fold.

This gets passed a linked list of scoring functions, which include relative weights for each function.

This function takes a GapModel which specifies things like gap initiation (gapI) and extention (gapE) penalties, or a more complex gap scoring system.

See Also:
globalAlign(org.strbio.mol.Polymer, org.strbio.mol.lib.AlignmentParameters, org.strbio.mol.Alignment)

quickCompare

public final double quickCompare(Polymer y,
                                 double gapI,
                                 double gapE)
standard needleman-wunch comparison algorithm, with identity matrix and given gap penalties. Unlike globalCompare, this method returns a positive number indicating the number of matches minus any gap penalties (rather than a negative number indicating the actual comparison score).

See Also:
globalCompare(org.strbio.mol.Polymer, org.strbio.mol.lib.GapModel, org.strbio.mol.lib.ScoreList), ScoreID

quickCompare

public final int quickCompare(Polymer y)
standard needleman-wunch comparison algorithm, with identity matrix and a constant gap penalty of 1. Unlike globalCompare, this method returns a positive number indicating the number of matches minus any gap penalties (rather than a negative number indicating the actual comparison score).

See Also:
globalCompare(org.strbio.mol.Polymer, org.strbio.mol.lib.GapModel, org.strbio.mol.lib.ScoreList), ScoreID

quickAlign

public final void quickAlign(Polymer y,
                             double gapI,
                             double gapE)
standard needleman-wunch alignment algorithm, with identity matrix and given gap penalties

See Also:
globalAlign(org.strbio.mol.Polymer, org.strbio.mol.lib.AlignmentParameters, org.strbio.mol.Alignment), ScoreID

quickAlign

public final void quickAlign(Polymer y)
standard needleman-wunch alignment algorithm, with identity matrix, and constant gap penalty of 1.

See Also:
globalAlign(org.strbio.mol.Polymer, org.strbio.mol.lib.AlignmentParameters, org.strbio.mol.Alignment), ScoreID

alignToArray

public final void alignToArray(int[] f)
Adjust gaps in polymer to form one half of a given alignment. The alignment is an array of which residue in this sequence aligns with which residue in the other sequence. If the seq is opposite a gap, the array should contain -1.

See Also:
Alignment

correctAlignSeq

public final void correctAlignSeq(int[] correct)
Deprecated. Use alignToArray instead.


alignToInverseArray

public final void alignToInverseArray(int[] f)
Adjust gaps in polymer to match an array representation. The alignment is an array of which residue in the other sequence aligns with which residue in this sequence. If the seq is opposite a gap, the vector should contain -1.

See Also:
Alignment

correctAlignFold

public final void correctAlignFold(int[] correct)
Deprecated. use alignToInverseArray.


pad

public final void pad(int length)
pads a sequence out (at the end) to a specified number of nmon using '.' as a filler residue


translate

public void translate(DVector trans)
translate all monomers by adding a DVector(3) to their coordinates.

Overrides:
translate in class Molecule
See Also:
Monomer.translate(org.strbio.math.DVector)

rotate

public void rotate(DMatrix rot)
rotate all monomers by multiplying by a 3x3 rotation matrix.

Overrides:
rotate in class Molecule
See Also:
Monomer.rotate(org.strbio.math.DMatrix)

transform

public void transform(DMatrix trans)
transform the position of all monomers.

Overrides:
transform in class Molecule
See Also:
Monomer.transform(org.strbio.math.DMatrix)

centerOfMass

public DVector centerOfMass()
Return a new DVector(3) containing the center of mass for the polymer. Bug: Atoms don't have atomic weights, so all are treated as the same weight.


centerOfMass

public void centerOfMass(DVector cm)
Finds the center of mass for the monomer and puts in in the DVector(3) that you pass it. Bug: Atoms don't have atomic weights, so all are treated the same. No atoms will return 0,0,0.


autoSplit

protected Polymer[] autoSplit()
splits a polymer into several, if it has a break in the chain. Breaks must be indicated with a monomer of type '!'.

Chains of length zero aren't counted.

If chain ID's are known, they should be stored in the break residue's structure field.

Names chain according to the chain ID. if unknown, names them A, B, C...

Returns an array of the polymers found, or null if there is only 1 polymer here.

If an array of polymers is returned, the monomers in this polymer will be null (all were moved to polymers in the split array).


minareaSuperimpose

public static void minareaSuperimpose(Polymer a,
                                      Polymer b)
Superimpose two polymers using minarea. Which polymer is actually moved is a "feature" of minarea and cannot be determined in advance. This has been tested for proteins, but should work on any type of polymer.


kludgeChainID

public void kludgeChainID()
Kludge chain ID from the name, assuming the name is PDB-style 1abcD (D=chain id), or ASTRAL-style d1abcD_/e1abc.1D _ gives no chain id. ID will be uppercased, if applicable.


stripAtomsByName

public final void stripAtomsByName(java.lang.String atomName)
Strip away a named atom or atoms.


molecularWeight

public double molecularWeight()
Calculate molecular weight