Skip to content

Commit 566d41c

Browse files
committed
Fixed the logic of working out which type of group a group is.
Fixed a typo
1 parent ad85634 commit 566d41c

2 files changed

Lines changed: 8 additions & 26 deletions

File tree

biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfStructureReader.java

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.biojava.nbio.structure.Structure;
3030
import org.biojava.nbio.structure.StructureImpl;
3131
import org.biojava.nbio.structure.StructureTools;
32+
import org.biojava.nbio.structure.io.mmcif.chem.PolymerType;
3233
import org.biojava.nbio.structure.io.mmcif.chem.ResidueType;
3334
import org.biojava.nbio.structure.io.mmcif.model.ChemComp;
3435
import org.biojava.nbio.structure.quaternary.BioAssemblyInfo;
@@ -185,7 +186,8 @@ public void setGroupInfo(String groupName, int groupNumber,
185186
char insertionCode, String chemCompType, int atomCount, int bondCount,
186187
char singleLetterCode, int sequenceIndexId, int secStructType) {
187188
// Get the polymer type
188-
int polymerType = getGroupTypIndicator(chemCompType);
189+
ResidueType residueType = ResidueType.getResidueTypeFromString(chemCompType);
190+
int polymerType = getGroupTypIndicator(residueType.polymerType);
189191
switch (polymerType) {
190192
case 1:
191193
AminoAcid aa = new AminoAcidImpl();
@@ -204,7 +206,6 @@ public void setGroupInfo(String groupName, int groupNumber,
204206
ChemComp chemComp = new ChemComp();
205207
chemComp.setOne_letter_code(String.valueOf(singleLetterCode));
206208
chemComp.setType(chemCompType.toUpperCase());
207-
ResidueType residueType = ResidueType.getResidueTypeFromString(chemCompType);
208209
chemComp.setResidueType(residueType);
209210
chemComp.setPolymerType(residueType.polymerType);
210211
group.setChemComp(chemComp);
@@ -400,33 +401,14 @@ public void setXtalInfo(String spaceGroupString, float[] unitCell, double[][] nc
400401
* @param currentGroup
401402
* @return The type of group. (0,1 or 2) depending on whether it is an amino aicd (1), nucleic acid (2) or ligand (0)
402403
*/
403-
private int getGroupTypIndicator(String currentGroupType) {
404-
// At the moment - peptide like is a HETATM group (consistent with biojava)
405-
if("PEPTIDE-LIKE".equalsIgnoreCase(currentGroupType)){
406-
return 0;
407-
}
408-
// Again to correspond with Biojava - but I suspect we really want this to be 1
409-
if("D-PEPTIDE LINKING".equalsIgnoreCase(currentGroupType)){
410-
return 0;
411-
}
412-
if(currentGroupType.toUpperCase().contains("D-GAMMA-PEPTIDE")){
413-
return 0;
414-
}
415-
if(currentGroupType.toUpperCase().contains("D-BETA-PEPTIDE")){
416-
return 0;
417-
}
418-
if(currentGroupType.toUpperCase().contains("D-PEPTIDE")){
419-
return 0;
420-
}
421-
if(currentGroupType.toUpperCase().contains("PEPTIDE")){
404+
private int getGroupTypIndicator(PolymerType polymerType) {
405+
if(PolymerType.PROTEIN_ONLY.contains(polymerType)){
422406
return 1;
423407
}
424-
if(currentGroupType.toUpperCase().contains("DNA") || currentGroupType.toUpperCase().contains("RNA")){
408+
if(PolymerType.POLYNUCLEOTIDE_ONLY.contains(polymerType)){
425409
return 2;
426410
}
427-
else{
428-
return 0;
429-
}
411+
return 0;
430412
}
431413

432414

biojava-structure/src/test/java/org/biojava/nbio/structure/TestBond.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public void testWeirdCase() throws IOException, StructureException {
318318

319319

320320
/**
321-
* Test that Sulphur atoms are not found to be bonded to them selves
321+
* Test that Sulphur atoms are not found to be bonded to themselves
322322
* @throws IOException an error getting the required file
323323
* @throws StructureException an error parsing the required file
324324
*/

0 commit comments

Comments
 (0)