Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,24 @@
*/
package org.biojava.nbio.aaproperties.xml;

import org.biojava.nbio.aaproperties.PeptideProperties;
import org.biojava.nbio.aaproperties.xml.*;
import org.junit.Test;
import static org.junit.Assert.assertEquals;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import java.io.*;
import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.assertEquals;
import org.biojava.nbio.aaproperties.PeptideProperties;
import org.junit.Test;

public class AminoAcidTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
*/
package org.biojava.nbio.core.sequence.io;

import java.util.LinkedHashMap;

import org.biojava.nbio.core.sequence.DNASequence;
import org.biojava.nbio.core.sequence.ProteinSequence;
import org.biojava.nbio.core.sequence.compound.AminoAcidCompound;
Expand All @@ -32,14 +34,14 @@
import org.biojava.nbio.core.sequence.compound.NucleotideCompound;
import org.biojava.nbio.core.sequence.io.util.ClasspathResource;
import org.biojava.nbio.core.sequence.loader.GenbankProxySequenceReader;
import org.junit.*;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.FileInputStream;
import java.util.LinkedHashMap;

/**
*
* @author Scooter Willis <willishf at gmail dot com>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public void setPDBName(String s) {
* @return and identical copy of this Group object
*/
@Override
public Object clone() {
public AminoAcidImpl clone() {

AminoAcidImpl n = new AminoAcidImpl();
n.setPDBFlag(has3D());
Expand All @@ -193,7 +193,7 @@ public Object clone() {

// copy the atoms
for (Atom atom1 : atoms) {
Atom atom = (Atom) atom1.clone();
Atom atom = atom1.clone();
n.addAtom(atom);
atom.setGroup(n);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public interface Atom extends Cloneable, PDBRecord {
* Return an identical copy of this object .
* @return an identical copy of this object
*/
public Object clone();
public Atom clone();

/**
* Set the back-reference to its parent Group.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public String toString() {
* @return and identical copy of this object
*/
@Override
public Object clone() {
public Atom clone() {
AtomImpl n = new AtomImpl();
n.setOccupancy(getOccupancy());
n.setTempFactor(getTempFactor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ public static final void plus(Structure s, Matrix matrix){
} catch (Exception e){
logger.error("Exception: ", e);
}
oldAtom = (Atom)atom.clone();
oldAtom = atom.clone();

double x = atom.getX();
double y = atom.getY() ;
Expand All @@ -596,7 +596,7 @@ public static final void plus(Structure s, Matrix matrix){
} catch (Exception e){
logger.error("Exception: ", e);
}
rotOldAtom = (Atom) atom.clone();
rotOldAtom = atom.clone();
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public interface Chain {
/** returns an identical copy of this Chain.
* @return an identical copy of this Chain
*/
public Object clone();
public Chain clone();

/** add a group to the list of ATOM record group of this chain.
* To add SEQRES records a more complex alignment between ATOM and SEQRES residues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public Structure getParent() {
* @return an identical copy of this Chain
*/
@Override
public Object clone() {
public ChainImpl clone() {
// go through all groups and add to new Chain.
ChainImpl n = new ChainImpl();
// copy chain data:
Expand All @@ -143,7 +143,7 @@ public Object clone() {
n.setInternalChainID(internalChainID);

for (Group group : groups) {
Group g = (Group) group.clone();
Group g = group.clone();
n.addGroup(g);
g.setChain(n);
}
Expand All @@ -155,7 +155,7 @@ public Object clone() {

List<Group> tmpSeqRes = new ArrayList<Group>();
for (Group seqResGroup : seqResGroups) {
Group g = (Group) seqResGroup.clone();
Group g = seqResGroup.clone();
g.setChain(n);
tmpSeqRes.add(g);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public interface Group {
/** returns and identical copy of this Group object .
* @return and identical copy of this Group object
*/
public Object clone();
public Group clone();

/**
* Sets the back-reference to its parent Chain.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public Iterator<Atom> iterator() {
* @return and identical copy of this Group object
*/
@Override
public Object clone() {
public HetatomImpl clone() {

HetatomImpl n = new HetatomImpl();
n.setPDBFlag(has3D());
Expand All @@ -339,7 +339,7 @@ public Object clone() {

// copy the atoms
for (Atom atom1 : atoms) {
Atom atom = (Atom) atom1.clone();
Atom atom = atom1.clone();
n.addAtom(atom);
atom.setGroup(n);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public Atom getP() {
}

@Override
public Object clone(){
public NucleotideImpl clone(){
NucleotideImpl n = new NucleotideImpl();

n.setPDBFlag(has3D());
Expand All @@ -105,7 +105,7 @@ public Object clone(){

// copy the atoms
for (Atom atom1 : atoms) {
Atom atom = (Atom) atom1.clone();
Atom atom = atom1.clone();
n.addAtom(atom);
atom.setGroup(n);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public Structure clone() {

for (int j=0;j<size(i);j++){

Chain cloned_chain = (Chain) getChain(i,j).clone();
Chain cloned_chain = getChain(i,j).clone();

// setting the parent: can only be done from the parent
cloned_chain.setParent(n);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ public static final Atom[] cloneCAArray(Atom[] ca) throws StructureException{
model.add(newChain);
}

Group parentN = (Group)parentG.clone();
Group parentN = parentG.clone();

newCA[apos] = parentN.getAtom(CA_ATOM_NAME);
newChain.addGroup(parentN);
Expand Down Expand Up @@ -522,7 +522,7 @@ public static Group[] cloneGroups(Atom[] ca) {
model.add(newChain);
}

Group ng = (Group)parentG.clone();
Group ng = parentG.clone();
newGroup[apos] = ng;
newChain.addGroup(ng);
}
Expand All @@ -546,7 +546,7 @@ public static Atom[] duplicateCA2(Atom[] ca2) throws StructureException{
Chain c = null;
String prevChainId = "";
for (Atom a : ca2){
Group g = (Group) a.getGroup().clone(); // works because each group has only a CA atom
Group g = a.getGroup().clone(); // works because each group has only a CA atom

if (c == null ) {
c = new ChainImpl();
Expand All @@ -570,7 +570,7 @@ public static Atom[] duplicateCA2(Atom[] ca2) throws StructureException{
c = null;
prevChainId = "";
for (Atom a : ca2){
Group g = (Group)a.getGroup().clone();
Group g = a.getGroup().clone();

if (c == null ) {
c = new ChainImpl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ private static Atom[] getAtoms(Atom[] ca, int[] positions, int length, boolean c
int p = positions[i];
Atom a;
if ( clone ){
a = (Atom)ca[p].clone();
a.setGroup((Group)ca[p].getGroup().clone());
a = ca[p].clone();
a.setGroup(ca[p].getGroup().clone());
}
else {
a = ca[p];
Expand Down Expand Up @@ -322,7 +322,7 @@ private static void cloneAtomRange(Atom[] p1, Atom[] p2, int r1, int r2)
for(int i = r1; i < r2; i ++) {

Group g = p2[i].getGroup();
Group newG = (Group)g.clone();
Group newG = g.clone();

p1[i] = newG.getAtom(StructureTools.CA_ATOM_NAME);
Chain parentC = g.getChain();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ public void align(Atom[] ca1, Atom[] ca2, StrucAligParameters params)
Matrix rotmat = svd.getRotation();
f.setRot(rotmat);

Atom aunitv = (Atom)unitvector.clone();
Atom aunitv = unitvector.clone();
Calc.rotate(aunitv,rotmat);
f.setUnitv(aunitv);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1842,7 +1842,7 @@ private void rot_mol(Atom[] caA, Atom[] caB, int nse2, Matrix m , Atom shift) th

for(int l=0; l<nse2; l++) {
Atom a = caA[l];
Group g = (Group)a.getGroup().clone();
Group g = a.getGroup().clone();
//Group g = (Group)a.getParent();

Calc.rotate( g, m);
Expand Down Expand Up @@ -1933,7 +1933,7 @@ private Atom[] getAtoms(Atom[] ca, int length, boolean clone) throws StructureE

Atom a;
if ( clone ){
Group g = (Group)ca[i].getGroup().clone();
Group g = ca[i].getGroup().clone();
a = g.getAtom(StructureTools.CA_ATOM_NAME);
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ public static AFPChain filterDuplicateAFPs(AFPChain afpChain, CECalculator ceCal
atoms1[pos] = ca1[pair.a];
// Clone residue to allow modification
Atom atom2 = ca2duplicated[pair.b];
Group g = (Group) atom2.getGroup().clone();
Group g = atom2.getGroup().clone();
atoms2[pos] = g.getAtom( atom2.getName() );
pos++;
}
Expand Down Expand Up @@ -516,7 +516,7 @@ public static AFPChain filterDuplicateAFPs(AFPChain afpChain, CECalculator ceCal
for(int i=1;i<blocks.size();i++) {
blockRMSDs[i] = -1; //TODO Recalculate for the FATCAT text format
blockRotationMatrices[i] = (Matrix) blockRotationMatrices[0].clone();
blockShifts[i] = (Atom) blockShifts[0].clone();
blockShifts[i] = blockShifts[0].clone();
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1922,7 +1922,7 @@ private void rot_mol(Atom[] caA, Atom[] caB, int nse2, Matrix m , Atom shift) th

for(int l=0; l<nse2; l++) {
Atom a = caA[l];
Group g = (Group)a.getGroup().clone();
Group g = a.getGroup().clone();
//Group g = (Group)a.getParent();

Calc.rotate( g, m);
Expand Down Expand Up @@ -2018,7 +2018,7 @@ private Atom[] getAtoms(Atom[] ca, int length, boolean clone) throws StructureE

Atom a;
if ( clone ){
Group g = (Group)ca[i].getGroup().clone();
Group g = ca[i].getGroup().clone();
a = g.getAtom(StructureTools.CA_ATOM_NAME);
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public AFPChain align(Atom[] ca1, Atom[] ca2, Object param) throws StructureExce

int pos = 0;
for (Atom a : ca2){
Group g = (Group)a.getGroup().clone(); // works because each group has only a CA atom
Group g = a.getGroup().clone(); // works because each group has only a CA atom

ca2clone[pos] = g.getAtom(StructureTools.CA_ATOM_NAME);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private static final Atom[] getFragment(Atom[] caall, int pos, int fragmentLengt

for (int i=0;i< fragmentLength;i++){
if (clone){
tmp[i] = (Atom)caall[i+pos].clone();
tmp[i] = caall[i+pos].clone();
} else {
tmp[i] = caall[i+pos];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ private static double getRmsd(int focusResn, int[] focusRes1, int[] focusRes2, A

for ( int i =0 ; i< focusResn;i++){
tmp1[i] = ca1[focusRes1[i]];
tmp2[i] = (Atom)ca2[focusRes2[i]].clone();
tmp2[i] = ca2[focusRes2[i]].clone();
if (tmp1[i].getCoords() == null){
System.err.println("tmp1 got null: " +i + " pos: " + focusRes1[i]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ public StructureAlignmentOptimizer(int b1, int end1, Atom[] c1, int b2, int end2
for(int i = 0; i < len1; i ++) {
Atom a = c1[i+b1];
//cod1[i] = (Atom)a.clone();
Group parent = (Group)a.getGroup().clone();
Group parent = a.getGroup().clone();
//cod1[i].setParent(parent);
cod1[i] = parent.getAtom(StructureTools.CA_ATOM_NAME);
//cod1[i] = c1[i];
}
for(int i = 0; i < len2; i ++) {
Atom a = c2[i+b2];
//cod2[i]= (Atom)a.clone();
Group parent = (Group)a.getGroup().clone();
Group parent = a.getGroup().clone();
//cod2[i].setParent(parent);
cod2[i] = parent.getAtom(StructureTools.CA_ATOM_NAME);
//cod2[i] = c2[i];
Expand Down Expand Up @@ -247,7 +247,7 @@ private void superimposeBySet ()
r2 = equSet[1][i];

tmp1[i] = cod1[ r1 ];
tmp2[i] = (Atom)cod2[ r2 ].clone(); // have to be cloned!
tmp2[i] = cod2[ r2 ].clone(); // have to be cloned!
//tmp2[i] = cod2[ r2 ];


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static Atom[] getFragmentFromIdxList(Atom[] caall, int[] idx){
for (int p = 0 ; p < idx.length;p++){

int pos1 = idx[p];
subset[p] = (Atom) caall[pos1].clone();
subset[p] = caall[pos1].clone();
}
return subset;
}
Expand All @@ -61,7 +61,7 @@ public static Atom[] getFragment(Atom[] caall, int pos, int fragmentLength){
Atom[] tmp = new Atom[fragmentLength];

for (int i=0;i< fragmentLength;i++){
tmp[i] = (Atom)caall[i+pos].clone();
tmp[i] = caall[i+pos].clone();
}
return tmp;

Expand Down
Loading