Repository navigation
Expand file tree
/
Copy pathNucleotideImpl.java
More file actions
121 lines (95 loc) · 2.59 KB
/
Copy pathNucleotideImpl.java
File metadata and controls
121 lines (95 loc) · 2.59 KB
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
/*
* 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.nbio.structure;
/**
* A nucleotide group is almost the same as a Hetatm group.
* @see HetatomImpl
* @see AminoAcidImpl
* @author Andreas Prlic
* @since 1.4
* @version %I% %G%
*/
public class NucleotideImpl extends HetatomImpl {
private static final long serialVersionUID = -7467726932980288712L;
/** this is a "nucleotide", a special occurance of a Hetatom. */
public static final GroupType type = GroupType.NUCLEOTIDE;
/*
* inherits most from Hetero and has just a few extensions.
*/
public NucleotideImpl() {
super();
}
@Override
public GroupType getType(){ return type;}
@Override
public String toString(){
String str = "PDB: "+ pdb_name + " " + residueNumber + " "+ pdb_flag;
if (pdb_flag) {
str = str + "atoms: "+atoms.size();
}
return str ;
}
/**
* Returns the O3' atom if present, otherwise null
* @return O3' atom or null
*/
public Atom getO3Prime() {
return getAtom("O3'");
}
/**
* Returns the O5' atom if present, otherwise null
* @return O5' atom or null
*/
public Atom getO5Prime() {
return getAtom("O5'");
}
/**
* Returns the P atom if present, otherwise null
* @return P atom or null
*/
public Atom getP() {
return getAtom("P");
}
// note we need to implement a clone here, despite there's one in super class already,
// that's due to issue https://github.com/biojava/biojava/issues/631 - JD 2017-01-21
@Override
public Object clone() {
NucleotideImpl n = new NucleotideImpl();
n.setPDBFlag(has3D());
n.setResidueNumber(getResidueNumber());
n.setPDBName(getPDBName());
//clone atoms and bonds.
cloneAtomsAndBonds(n);
// copying the alt loc groups if present, otherwise they stay null
if (getAltLocs()!=null && !getAltLocs().isEmpty()) {
for (Group altLocGroup:this.getAltLocs()) {
Group nAltLocGroup = (Group)altLocGroup.clone();
n.addAltLoc(nAltLocGroup);
}
}
if (chemComp!=null)
n.setChemComp(chemComp);
return n;
}
}