public static List<SecStrucElement> getSecStrucElements(Structure s) {

		List<SecStrucElement> listSSE = new ArrayList<SecStrucElement>();
		GroupIterator iter = new GroupIterator(s);

		// SecStruc information - initialize
		SecStrucType type = SecStrucType.coil;
		ResidueNumber previous = new ResidueNumber();
		ResidueNumber start = new ResidueNumber();
		String chainId = "";
		int count = 0; // counts the number of residues in SSE

		// Create a map for the IDs of the SSE in the structure
		Map<SecStrucType, Integer> ids = new TreeMap<SecStrucType, Integer>();
		for (SecStrucType t : SecStrucType.values())
			ids.put(t, 1);

		while (iter.hasNext()) {
			Group g = iter.next();

			if (g.hasAminoAtoms()) {
				Object p = g.getProperty(Group.SEC_STRUC);
				if (p == null)
					continue;
				SecStrucInfo ss = (SecStrucInfo) p;

				if (count > 0) {
					// If chain and type are equal increment counter
					if (ss.type == type && chainId == g.getChainId()) {
						previous = g.getResidueNumber();
						count++;
						continue;
					} else {
						// Save the current SSE if chain or type change
						SecStrucElement sse = new SecStrucElement(type, start,
								previous, count, ids.get(type), chainId);
						listSSE.add(sse);
						ids.put(type, ids.get(type) + 1);
						count = 0;

						// Initialize a new SSE one
						if (ss.type != SecStrucType.coil) {
							type = ss.type;
							start = g.getResidueNumber();
							previous = start;
							chainId = g.getChainId();
							count = 1;
						}
					}
				} else {
					// This is for the first residue only
					if (ss.type != SecStrucType.coil) {
						type = ss.type;
						start = g.getResidueNumber();
						previous = start;
						chainId = g.getChainId();
						count = 1;
					}
				}
			}
		}
		return listSSE;
	}
public static List < SecStrucElement > getSecStrucElements ( Structure s ) { List < SecStrucElement > listSSE = new ArrayList < SecStrucElement > ( ) ; GroupIterator iter = new GroupIterator ( s ) ; SecStrucType type = SecStrucType . coil ; ResidueNumber previous = new ResidueNumber ( ) ; ResidueNumber start = new ResidueNumber ( ) ; String chainId = "" ; int count = 0 ; Map < SecStrucType , Integer > ids = new TreeMap < SecStrucType , Integer > ( ) ; for ( SecStrucType t : SecStrucType . values ( ) ) ids . put ( t , 1 ) ; while ( iter . hasNext ( ) ) { Group g = iter . next ( ) ; if ( g . hasAminoAtoms ( ) ) { Object p = g . getProperty ( Group . SEC_STRUC ) ; if ( p == null ) continue ; SecStrucInfo ss = ( SecStrucInfo ) p ; if ( count > 0 ) { if ( ss . type == type && chainId == g . getChainId ( ) ) { previous = g . getResidueNumber ( ) ; count ++ ; continue ; } else { SecStrucElement sse = new SecStrucElement ( type , start , previous , count , ids . get ( type ) , chainId ) ; listSSE . add ( sse ) ; ids . put ( type , ids . get ( type ) + 1 ) ; count = 0 ; if ( ss . type != SecStrucType . coil ) { type = ss . type ; start = g . getResidueNumber ( ) ; previous = start ; chainId = g . getChainId ( ) ; count = 1 ; } } } else { if ( ss . type != SecStrucType . coil ) { type = ss . type ; start = g . getResidueNumber ( ) ; previous = start ; chainId = g . getChainId ( ) ; count = 1 ; } } } } return listSSE ; }
Obtain the List of secondary structure elements (SecStrucElement) of a
Structure.

@param s
Structure with SS assignments
@return List of SecStrucElement objects