2929import org .biojava .nbio .structure .Structure ;
3030import org .biojava .nbio .structure .StructureImpl ;
3131import org .biojava .nbio .structure .StructureTools ;
32+ import org .biojava .nbio .structure .io .mmcif .chem .PolymerType ;
3233import org .biojava .nbio .structure .io .mmcif .chem .ResidueType ;
3334import org .biojava .nbio .structure .io .mmcif .model .ChemComp ;
3435import 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
0 commit comments