public static List < Structure > divideStructure ( CeSymmResult symmetry ) throws StructureException { if ( ! symmetry . isRefined ( ) ) throw new IllegalArgumentException ( "The symmetry result " + "is not refined, repeats cannot be defined" ) ; int order = symmetry . getMultipleAlignment ( ) . size ( ) ; Atom [ ] atoms = symmetry . getAtoms ( ) ; Set < Group > allGroups = StructureTools . getAllGroupsFromSubset ( atoms , GroupType . HETATM ) ; List < StructureIdentifier > repeatsId = symmetry . getRepeatsID ( ) ; List < Structure > repeats = new ArrayList < Structure > ( order ) ; // Create new structure containing the repeat atoms for ( int i = 0 ; i < order ; i ++ ) { Structure s = new StructureImpl ( ) ; s . addModel ( new ArrayList < Chain > ( 1 ) ) ; s . setStructureIdentifier ( repeatsId . get ( i ) ) ; Block align = symmetry . getMultipleAlignment ( ) . getBlock ( 0 ) ; // Get the start and end of the repeat // Repeats are always sequential blocks int res1 = align . getStartResidue ( i ) ; int res2 = align . getFinalResidue ( i ) ; // All atoms from the repeat, used for ligand search // AA have an average of 8.45 atoms, so guess capacity with that List < Atom > repeat = new ArrayList <> ( Math . max ( 9 * ( res2 - res1 + 1 ) , 9 ) ) ; // speedy chain lookup Chain prevChain = null ; for ( int k = res1 ; k <= res2 ; k ++ ) { Group g = atoms [ k ] . getGroup ( ) ; prevChain = StructureTools . addGroupToStructure ( s , g , 0 , prevChain , true ) ; repeat . addAll ( g . getAtoms ( ) ) ; } List < Group > ligands = StructureTools . getLigandsByProximity ( allGroups , repeat . toArray ( new Atom [ repeat . size ( ) ] ) , StructureTools . DEFAULT_LIGAND_PROXIMITY_CUTOFF ) ; logger . warn ( "Adding {} ligands to {}" , ligands . size ( ) , symmetry . getMultipleAlignment ( ) . getStructureIdentifier ( i ) ) ; for ( Group ligand : ligands ) { prevChain = StructureTools . addGroupToStructure ( s , ligand , 0 , prevChain , true ) ; } repeats . add ( s ) ; } return repeats ; }
Method that converts the symmetric units of a structure into different structures so that they can be individually visualized .