1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
|
/*
* BioJava development code
*
* This code may be freely distributed and modified under the
* terms of the GNU Lesser General Public Licence. This should
* be distributed with the code. If you do not have a copy,
* see:
*
* http://www.gnu.org/copyleft/lesser.html
*
* Copyright for this code is held jointly by the individual
* authors. These should be listed in @author doc comments.
*
* For more information on the BioJava project and its aims,
* or to join the biojava-l mailing list, visit the home page
* at:
*
* http://www.biojava.org/
*
* Created on 05.03.2004
* @author Andreas Prlic
*
*/
package org.biojava.bio.structure;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.biojava.bio.structure.io.PDBParseException;
/**
*
* AminoAcid inherits most from Hetatom. Adds a few AminoAcid
* specific methods.
* @author Andreas Prlic
* @author Jules Jacobsen
* @since 1.4
* @version %I% %G%
*
*/
public class AminoAcidImpl
extends HetatomImpl
implements AminoAcid, Serializable
{
/**
*
*/
private static final long serialVersionUID = -6018854413829044230L;
/** this is an Amino acid. type is "amino". */
public static final String type = GroupType.AMINOACID;
/* IUPAC amino acid residue names
*/
Character amino_char ;
Map<String,String> secstruc;
String recordType; // allows to distinguish between AAs that have been created from SEQRES records and ATOM records
/*
* inherits most from Hetero and has just a few extensions.
*/
public AminoAcidImpl() {
super();
amino_char = null;
secstruc = new HashMap<String,String>();
recordType = ATOMRECORD;
}
public String getType(){ return type;}
/** set the secondary structure data for this amino acid. the data
* is a Map with the following indeces (@see Secstruc)
*
* @param secstr a Map object specifying the sec struc value
* @see #getSecStruc
*/
public void setSecStruc(Map<String,String> secstr) {
this.secstruc = secstr ;
}
/** get secondary structure data .
*
* @return a Map object representing the sec struc value
*
* @see #setSecStruc
*/
public Map<String,String> getSecStruc(){
return secstruc ;
}
/** get N atom.
*
* @return an Atom object
* @throws StructureException ...
*/
public Atom getN() throws StructureException {return getAtom("N"); }
/** get CA atom.
* @return an Atom object
* @throws StructureException ...
*/
public Atom getCA() throws StructureException {return getAtom(" CA "); }
/** get C atom.
* @return an Atom object
* @throws StructureException ...
*/
public Atom getC() throws StructureException {return getAtom("C"); }
/** get O atom.
* @return an Atom object
* @throws StructureException ...
*/
public Atom getO() throws StructureException {return getAtom("O"); }
/** get CB atom.
* @return an Atom object
* @throws StructureException ...
*/
public Atom getCB() throws StructureException {return getAtom("CB"); }
/** returns the name of the AA, in single letter code.
*
* @return a Character object representing the amino type value
* @see #setAminoType
*/
public Character getAminoType() {
return amino_char;
}
/** set the name of the AA, in single letter code .
*
* @param aa a Character object specifying the amino type value
* @see #getAminoType
*/
public void setAminoType(Character aa){
amino_char = aa ;
}
public void setRecordType(String recordName) {
recordType = recordName;
}
public String getRecordType() {
return recordType;
}
/** string representation. */
public String toString(){
String str = "AminoAcid "+ recordType + ":"+ pdb_name + " " + amino_char +
" " + residueNumber + " "+ pdb_flag + " " + recordType ;
if (pdb_flag) {
str = str + " atoms: "+atoms.size();
}
if ( altLocs != null)
str += " has altLocs :" + altLocs.size();
return str ;
}
/** set three character name of AminoAcid.
*
* @param s a String specifying the PDBName value
* @see #getPDBName()
* @throws PDBParseException ...
*/
public void setPDBName(String s)
throws PDBParseException
{
if (s != null && s.length() != 3) {
throw new PDBParseException("amino acid name is not of length 3! (" + s +")");
}
pdb_name =s ;
}
/** returns and identical copy of this Group object .
* @return and identical copy of this Group object
*/
public Object clone(){
AminoAcidImpl n = new AminoAcidImpl();
n.setPDBFlag(has3D());
n.setResidueNumber(getResidueNumber());
try {
n.setPDBName(getPDBName());
} catch (PDBParseException e) {
e.printStackTrace();
}
n.setAminoType(getAminoType());
n.setRecordType(recordType);
// copy the atoms
for (int i=0;i<atoms.size();i++){
Atom atom = (Atom)atoms.get(i);
n.addAtom((Atom)atom.clone());
}
return n;
}
}
|