switch (proteinStructureSubType)
{
case HELIX310:
- if (secstr[pos] == 0)
- {
- secstr[pos] = '3';
- }
+ secstr[pos] = '3';
+ break;
+ case HELIX:
+ case HELIXALPHA:
+ secstr[pos] = 'H';
+ break;
+ case HELIXPI:
+ secstr[pos] = 'P';
+ break;
+ case SHEET:
+ secstr[pos] = 'E';
+ break;
+ default:
+ secstr[pos] = 0;
+ }
+
+ switch (proteinStructureSubType)
+ {
+ case HELIX310:
case HELIXALPHA:
- if (secstr[pos] == 0)
- {
- secstr[pos] = 'H';
- }
case HELIXPI:
- if (secstr[pos] == 0)
- {
- secstr[pos] = 'P';
- }
case HELIX:
- if (secstr[pos] == 0)
- {
- secstr[pos] = 'H';
- }
secstrcode[pos] = 'H';
break;
case SHEET:
- secstr[pos] = 'E';
secstrcode[pos] = 'E';
break;
default:
- secstr[pos] = 0;
secstrcode[pos] = 0;
}
}
waitForScript(jmolModel);
/*
- * Convert one or more Jmol Model objects to Jalview objects.
+ * Convert one or more Jmol Model objects to Jalview sequences
*/
if (jmolModel.ms.mc > 0)
{
String modelTitle = (String) ms.getInfo(modelIndex, "title");
/*
- * as chains can span BioPolymers, we first make a flattened list,
+ * Chains can span BioPolymers, so first make a flattened list,
* and then work out the lengths of chains present
*/
List<Monomer> monomers = getMonomers(ms, (BioModel) model);
/*
* construct and add the Jalview sequence
*/
- SequenceI sq = new Sequence("" + getDataName() + "|" + modelTitle + "|"
- + chainId, seq, firstResNum, firstResNum + length - 1);
+ String seqName = "" + getDataName() + "|" + modelTitle + "|"
+ + chainId;
+ SequenceI sq = new Sequence(seqName, seq, firstResNum, firstResNum + length - 1);
seqs.add(sq);
/*
}
/**
+ * Add a PDBEntry giving the source of PDB data to the sequence
+ *
* @param sq
* @param chainId
*/
pdbe.setFile(getDataName());
pdbe.setId(getDataName());
pdbe.setProperty(new Hashtable());
- // pdbe.getProperty().put("CHAIN", "" + _lastChainId);
pdbe.setChainCode(chainId);
sq.addPDBId(pdbe);
}
}
/**
- * Returns a flattened list of Monomer (residue) in order, across all
+ * Returns a flattened list of Monomer (residues) in order, across all
* BioPolymers in the model. This simplifies assembling chains which span
- * BioPolymers. The result does not include any alternate residues reported
- * for the same sequence position (RESNUM value).
+ * BioPolymers. The result omits any alternate residues reported for the same
+ * sequence position (RESNUM value).
*
* @param ms
* @param model
protected List<Monomer> getMonomers(ModelSet ms, BioModel model)
{
List<Monomer> result = new ArrayList<Monomer>();
- String lastSeqCode = "";
+ int lastResNo = Integer.MIN_VALUE;
- for (BioPolymer bp : model.bioPolymers) {
+ for (BioPolymer bp : model.bioPolymers)
+ {
for (int groupLeadAtoms : bp.getLeadAtomIndices())
{
Group group = ms.at[groupLeadAtoms].group;
{
/*
* ignore alternate residue at same position
- * example: 1ejg has residues A:LEU, B:ILE, C:ILE at RESNUM=25
+ * example: 1ejg has residues A:LEU, B:ILE at RESNUM=25
*/
- String seqcodeString = group.getSeqcodeString();
- if (!lastSeqCode.equals(seqcodeString))
+ int resNo = group.getResno();
+ if (lastResNo != resNo)
{
result.add((Monomer) group);
}
- else
- {
- System.out.println("skipping");
- }
- lastSeqCode = seqcodeString;
+ lastResNo = resNo;
}
}
}
import java.util.Vector;
+import org.jmol.c.STR;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
assertEquals("ALC", seqs.get(0).getSequenceAsString());
assertEquals("ALC", mcseqs.get(0).getSequenceAsString());
}
+
+ @Test(groups = "Functional")
+ public void testSetSecondaryStructure()
+ {
+ PDBFileWithJmol testee = new PDBFileWithJmol();
+ char[] struct = new char[10];
+ char[] structCode = new char[10];
+ struct[0] = '1';
+ structCode[0] = '1';
+
+ testee.setSecondaryStructure(STR.NONE, 0, struct, structCode);
+ testee.setSecondaryStructure(STR.HELIX, 1, struct, structCode);
+ testee.setSecondaryStructure(STR.HELIX310, 2, struct, structCode);
+ testee.setSecondaryStructure(STR.HELIXALPHA, 3, struct, structCode);
+ testee.setSecondaryStructure(STR.HELIXPI, 4, struct, structCode);
+ testee.setSecondaryStructure(STR.SHEET, 5, struct, structCode);
+
+ assertEquals(0, struct[0]);
+ assertEquals('H', struct[1]);
+ assertEquals('3', struct[2]);
+ assertEquals('H', struct[3]);
+ assertEquals('P', struct[4]);
+ assertEquals('E', struct[5]);
+
+ assertEquals(0, structCode[0]);
+ assertEquals('H', structCode[1]);
+ assertEquals('H', structCode[2]);
+ assertEquals('H', structCode[3]);
+ assertEquals('H', structCode[4]);
+ assertEquals('E', structCode[5]);
+ }
}