|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.strbio.mol.Molecule org.strbio.mol.Polymer
public class Polymer
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
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 |
---|
protected int properties
public DLinkedList monomers
public char chainID
public DHalfMatrix monDistance
protected static boolean includingFile
protected static java.io.BufferedReader includeFile
Constructor Detail |
---|
public Polymer()
public Polymer(Polymer q)
public Polymer(java.lang.String sequence)
Method Detail |
---|
public void setProperty(int prop)
public boolean getProperty(int prop)
public void clearProperty(int prop)
public void clearProperties()
public Monomer newMonomer()
public Monomer newMonomer(char t)
public Monomer newMonomer(java.lang.String s)
public int nMonomers()
public int length()
public Monomer[] getMonomers()
public Monomer firstMon()
public Monomer lastMon()
public int nMonomers(char c)
public int nonGapMonomers()
public Monomer[] getNonGapMonomers()
public int validNonGapMonomers()
public Monomer[] getValidNonGapMonomers()
public void clear()
clear
in class Molecule
public void printSequence(Printf outfile) throws java.io.IOException
java.io.IOException
public java.lang.String sequence()
public java.lang.String sequenceValidNonGap()
public java.lang.String sequenceNonGap()
public Monomer monomer(int n)
public void makeMonDistance()
public void makeMonDistanceAllAtomMin()
public final void deleteMonDistance()
public final void readFasta(java.io.BufferedReader infile, Printf outfile) throws java.io.IOException
infile
- an open Fasta fileoutfile
- if non-null, will print info on what's going on
java.io.IOException
read(java.io.BufferedReader, org.strbio.io.Printf, boolean)
,
Monomer.readFasta(java.io.BufferedReader)
public void readSequence(java.io.BufferedReader infile, Printf outfile) throws java.io.IOException
java.io.IOException
public final void readList(java.io.BufferedReader infile, Printf outfile) throws java.io.IOException
infile
- an open fileoutfile
- if non-null, will print info on what's going on
java.io.IOException
PolymerSet.readList(java.lang.String, org.strbio.io.Printf)
protected Monomer YAPFGetNextMonomer(int n) throws java.io.IOException
java.io.IOException
- if no monomer is foundpublic void processYAPF(java.lang.String buffer) throws java.io.IOException
java.io.IOException
public final void readYAPF(java.io.BufferedReader infile, Printf outfile) throws java.io.IOException
java.io.IOException
protected void writeYAPFInfo(Printf outfile) throws java.io.IOException
java.io.IOException
public final void writeYAPF(Printf outfile) throws java.io.IOException
java.io.IOException
protected boolean recognizeAndRead(java.lang.String buffer, java.io.BufferedReader infile, Printf outfile) throws java.io.IOException
Here are some things (when found at the beginning of a line) that signal a polymer is coming up.
java.io.IOException
protected void read(java.io.BufferedReader infile, Printf outfile, boolean inc)
public void read(java.io.BufferedReader infile)
infile
- an open BufferedReader containing a polymerpublic void read(java.io.BufferedReader infile, Printf outfile)
infile
- an open BufferedReader containing a polymeroutfile
- if non-null, will print info on what's going onpublic void writePDBSeqres(Printf outfile) throws java.io.IOException
outfile
- where to write to
java.io.IOException
public void writePDBAtom(Printf outfile) throws java.io.IOException
outfile
- where to write to
java.io.IOException
public void writeYAPFAtom(Printf outfile) throws java.io.IOException
outfile
- where to write to
java.io.IOException
public void writePDB(Printf outfile) throws java.io.IOException
outfile
- where to write to
java.io.IOException
public final void writePTS(Printf outfile) throws java.io.IOException
outfile
- where to write to
java.io.IOException
public void writeFasta(Printf outfile) throws java.io.IOException
outfile
- where to write to
java.io.IOException
public final void stripType(char x)
public final void trimEnds(char x)
public final void stripGaps()
public final void stripCommonGaps(Polymer q)
public final void stripInvalidAndGaps()
public final void stripNoAtoms()
public final void stripAllAtoms()
public final void stripAllBut(java.lang.String[] names)
public final void stripAllButFirstAtom()
public final void keepMonomers(int n1, int n2)
public final void renumberMonomers(int n)
public final void renumberValidNonGapMonomers(int n)
public Polymer copy()
public void reverse()
public Polymer reverseCopy()
protected Polymer splitCopy()
public final void copyAtoms(Polymer q)
public final double globalAlign(Polymer y, AlignmentParameters ap, Alignment nail)
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.
Alignment
,
globalCompare(org.strbio.mol.Polymer, org.strbio.mol.lib.GapModel, org.strbio.mol.lib.ScoreList)
public final double globalAlign(Polymer y, GapModel gm, ScoreList sl, int[] nail)
public final Alignment getGlobalAlignment(Polymer y, AlignmentParameters ap, Alignment nail)
public final double globalCompare(Polymer y, GapModel gm, ScoreList sl)
public final double globalCompare(Polymer y, AlignmentParameters ap)
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.
globalAlign(org.strbio.mol.Polymer, org.strbio.mol.lib.AlignmentParameters, org.strbio.mol.Alignment)
public final double quickCompare(Polymer y, double gapI, double gapE)
globalCompare(org.strbio.mol.Polymer, org.strbio.mol.lib.GapModel, org.strbio.mol.lib.ScoreList)
,
ScoreID
public final int quickCompare(Polymer y)
globalCompare(org.strbio.mol.Polymer, org.strbio.mol.lib.GapModel, org.strbio.mol.lib.ScoreList)
,
ScoreID
public final void quickAlign(Polymer y, double gapI, double gapE)
globalAlign(org.strbio.mol.Polymer, org.strbio.mol.lib.AlignmentParameters, org.strbio.mol.Alignment)
,
ScoreID
public final void quickAlign(Polymer y)
globalAlign(org.strbio.mol.Polymer, org.strbio.mol.lib.AlignmentParameters, org.strbio.mol.Alignment)
,
ScoreID
public final void alignToArray(int[] f)
Alignment
public final void correctAlignSeq(int[] correct)
public final void alignToInverseArray(int[] f)
Alignment
public final void correctAlignFold(int[] correct)
public final void pad(int length)
public void translate(DVector trans)
translate
in class Molecule
Monomer.translate(org.strbio.math.DVector)
public void rotate(DMatrix rot)
rotate
in class Molecule
Monomer.rotate(org.strbio.math.DMatrix)
public void transform(DMatrix trans)
transform
in class Molecule
Monomer.transform(org.strbio.math.DMatrix)
public DVector centerOfMass()
public void centerOfMass(DVector cm)
protected Polymer[] autoSplit()
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).
public static void minareaSuperimpose(Polymer a, Polymer b)
public void kludgeChainID()
public final void stripAtomsByName(java.lang.String atomName)
public double molecularWeight()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |