001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org/ 019 * 020 */ 021package org.biojava.nbio.structure.secstruc; 022 023/** 024 * This enum contains all of the secondary structure types found in the DSSP 025 * output. It also contains some methods to operate with the SS types. 026 * <p> 027 * When compared, the types are sorted in the declaration order of the enum, 028 * which is the DSSP preference of type assignment. 029 * 030 * @author Andreas Prlic 031 * @author Aleix Lafita 032 * 033 */ 034public enum SecStrucType { 035 036 helix4("alpha Helix", 'H'), 037 extended("Extended", 'E'), 038 bridge("Bridge", 'B'), 039 helix3("3-10 Helix", 'G'), 040 helix5("pi Helix", 'I'), 041 turn("Turn", 'T'), 042 bend("Bend", 'S'), 043 coil("Coil", ' '); 044 045 public final Character type; 046 public final String name; 047 048 private SecStrucType(String name, Character stype) { 049 this.name = name; 050 this.type = stype; 051 } 052 053 /** 054 * Converts a Character representing a Secondary Structure type into the 055 * corresponding enum object. 056 * 057 * @param stype 058 * the character representing the SS type 059 * @return SecStrucType or null if the character is invalid 060 */ 061 public static SecStrucType fromCharacter(Character stype) { 062 063 for (SecStrucType c : SecStrucType.values()) { 064 if (c.type.equals(stype)) { 065 return c; 066 } 067 } 068 return null; 069 } 070 071 @Override 072 public String toString() { 073 return type.toString(); 074 } 075 076 /** 077 * Helix type can be 3-10 helix, pi-helix or alpha-helix. 078 * 079 * @return true if the type is any of the helix types, false otherwise 080 */ 081 public boolean isHelixType() { 082 if (type.equals(helix4.type) || type.equals(helix3.type) 083 || type.equals(helix5.type)) 084 return true; 085 else 086 return false; 087 } 088 089 /** 090 * A Beta-Strand is an extended set of sequential Bridges that, together 091 * with other Beta-Strands, is part of a Beta-Sheet. 092 * 093 * @return true if the type is a Beta-Strand 094 */ 095 public boolean isBetaStrand() { 096 if (type.equals(extended.type)) 097 return true; 098 else 099 return false; 100 } 101 102}