X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fext%2Fjmol%2FPDBFileWithJmol.java;h=d32a10de9b8b0ed2bb2ec2d9a478784690c183a1;hb=6e5b1229ad6b5fd71036fb14a15eec7382204a8b;hp=49cb6d55b587abd19d55c17b47f6f3d378cdc814;hpb=d8d34047253ad28418f5478d9185a9b840114072;p=jalview.git diff --git a/src/jalview/ext/jmol/PDBFileWithJmol.java b/src/jalview/ext/jmol/PDBFileWithJmol.java index 49cb6d5..d32a10d 100644 --- a/src/jalview/ext/jmol/PDBFileWithJmol.java +++ b/src/jalview/ext/jmol/PDBFileWithJmol.java @@ -130,33 +130,34 @@ public class PDBFileWithJmol extends AlignFile implements 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; } } @@ -365,7 +366,7 @@ public class PDBFileWithJmol extends AlignFile implements 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) { @@ -389,7 +390,7 @@ public class PDBFileWithJmol extends AlignFile implements 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 monomers = getMonomers(ms, (BioModel) model); @@ -452,8 +453,9 @@ public class PDBFileWithJmol extends AlignFile implements /* * 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); /* @@ -574,6 +576,8 @@ public class PDBFileWithJmol extends AlignFile implements } /** + * Add a PDBEntry giving the source of PDB data to the sequence + * * @param sq * @param chainId */ @@ -583,7 +587,6 @@ public class PDBFileWithJmol extends AlignFile implements pdbe.setFile(getDataName()); pdbe.setId(getDataName()); pdbe.setProperty(new Hashtable()); - // pdbe.getProperty().put("CHAIN", "" + _lastChainId); pdbe.setChainCode(chainId); sq.addPDBId(pdbe); } @@ -628,10 +631,10 @@ public class PDBFileWithJmol extends AlignFile implements } /** - * 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 @@ -640,9 +643,10 @@ public class PDBFileWithJmol extends AlignFile implements protected List getMonomers(ModelSet ms, BioModel model) { List result = new ArrayList(); - 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; @@ -650,18 +654,14 @@ public class PDBFileWithJmol extends AlignFile implements { /* * 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; } } }