modelIndex++;
for (BioPolymer bp : ((BioModel) model).bioPolymers)
{
- int _lastChainId = 0;
+ int lastChainId = 0; // int value of character e.g. 65 for A
+ String lastChainIdAlpha = "";
+
int[] groups = bp.getLeadAtomIndices();
char seq[] = new char[groups.length], secstr[] = new char[groups.length], secstrcode[] = new char[groups.length];
int groupc = 0, len = 0, firstrnum = 1, lastrnum = 0;
do
{
if (groupc >= groups.length
- || ms.at[groups[groupc]].group.chain.chainID != _lastChainId)
+ || ms.at[groups[groupc]].group.chain.chainID != lastChainId)
{
/*
* on change of chain (or at end), construct the sequence and
String modelTitle = (String) ms
.getInfo(modelIndex, "title");
SequenceI sq = new Sequence("" + getDataName() + "|"
- + modelTitle + "|" + _lastChainId, newseq,
+ + modelTitle + "|" + lastChainIdAlpha, newseq,
firstrnum, lastrnum);
PDBEntry pdbe = new PDBEntry();
pdbe.setFile(getDataName());
pdbe.setId(getDataName());
pdbe.setProperty(new Hashtable());
// pdbe.getProperty().put("CHAIN", "" + _lastChainId);
- pdbe.setChainCode(String.valueOf(_lastChainId));
+ pdbe.setChainCode(lastChainIdAlpha);
sq.addPDBId(pdbe);
// JAL-1533
// Need to put the number of models for this polymer somewhere
{
String mt = modelTitle == null ? getDataName()
: modelTitle;
- if (_lastChainId >= ' ')
+ if (lastChainId >= ' ')
{
- mt += _lastChainId;
+ mt += lastChainIdAlpha;
}
AlignmentAnnotation ann = new AlignmentAnnotation(
"Secondary Structure", "Secondary Structure for "
if (len == 0)
{
firstrnum = group.getResno();
- _lastChainId = group.chain.chainID;
+ lastChainId = group.chain.chainID;
+ lastChainIdAlpha = group.chain.getIDStr();
}
else
{
import java.awt.Color;
import java.util.Vector;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class PDBChainTest
{
- PDBChain c = new PDBChain("1GAQ", "A");
+ PDBChain c;
- Atom a1 = new Atom(1f, 2f, 3f);
+ final Atom a1 = new Atom(1f, 2f, 3f);
- Atom a2 = new Atom(5f, 6f, 4f);
+ final Atom a2 = new Atom(5f, 6f, 4f);
- Atom a3 = new Atom(2f, 5f, 6f);
+ final Atom a3 = new Atom(2f, 5f, 6f);
- Atom a4 = new Atom(2f, 1f, 7f);
+ final Atom a4 = new Atom(2f, 1f, 7f);
+
+ @BeforeMethod
+ public void setUp()
+ {
+ System.out.println("setup");
+ c = new PDBChain("1GAQ", "A");
+ }
@Test
public void testGetNewlineString()
import jalview.io.AppletFormatAdapter;
import java.io.IOException;
+import java.util.List;
import org.testng.annotations.Test;
assertTrue(chainD.sequence.getSequenceAsString().startsWith("ATYNVK"));
assertTrue(chainD.sequence.getSequenceAsString().endsWith("KEEELT"));
assertEquals("3W5V|D", chainD.sequence.getName());
+
+ /*
+ * verify PDB-related data in parsed sequences
+ */
+ List<SequenceI> seqs = pf.getSeqs();
+ assertEquals(4, seqs.size());
+ assertEquals("3W5V|A", seqs.get(0).getName());
+ assertEquals("3W5V|B", seqs.get(1).getName());
+ assertEquals("3W5V|C", seqs.get(2).getName());
+ assertEquals("3W5V|D", seqs.get(3).getName());
+ assertEquals(1, seqs.get(0).getPDBId().size());
+ PDBEntry pdbe = seqs.get(0).getPDBId().get(0);
+ assertEquals("A", pdbe.getChainCode());
+ assertEquals("3W5V", pdbe.getId());
+ assertEquals(PDBEntry.Type.PDB.toString(), pdbe.getType());
}
/**
private AlignmentAnnotation[] getAlignmentAnnotations(PDBfile pf)
{
AlignmentI al = new Alignment(pf.getSeqsAsArray());
- pf.addAnnotations((Alignment) al);
+ pf.addAnnotations(al);
return al.getAlignmentAnnotation();
}
}