ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/trunk/proteinstructure/SecStrucElement.java
Revision: 407
Committed: Tue Nov 20 18:41:56 2007 UTC (16 years, 11 months ago) by filippis
File size: 3866 byte(s)
Log Message:
contactTypes.dat 
-SC_CAGLY contact type added

SecStrucElement.java
-getSheetSerial method is now public

Pdb.java
-writeToDbFast added

Graph.java
-write_graph_to_db_fast
-expBB,CW,CT,CR,w,d are now taken into account in a correct way
-node_id, sssid, sheetSerial and turn are now also filled in

DbGraph.java
-expBB,CW,CT,CR,w,d are now taken into account in a correct way
-directionality is also taken into account now when reading edges

genDbGraph.java
-sequence separation added as option

createGraphDb.java added

Line User Rev File contents
1 stehr 259 package proteinstructure;
2    
3     /**
4     * A particular secondary structure element within a protein structure
5     */
6     public class SecStrucElement {
7    
8 stehr 274 /*------------------------------ constants ------------------------------*/
9 filippis 382 public enum ReducedState { THREESTATE, FOURSTATE, EIGHTSTATE };
10 stehr 274 // three/four state secondary structure types (for 3 state, skip turn)
11     public static final char HELIX = 'H'; // a helix
12     public static final char STRAND = 'S'; // a beta strand
13     public static final char TURN = 'T'; // a hydrogen bonded turn
14     public static final char OTHER = 'O'; // all other states
15 filippis 382 public static final char EXTENTED = 'E';// all extented
16     public static final char LOOP = 'L'; // all other states
17 stehr 274
18 stehr 259 /*--------------------------- member variables --------------------------*/
19    
20 stehr 274 String secStrucId; // legacy field for old ss ids (e.g. H1, S1, ...)
21     char secStrucType; // one of the above constants
22     Interval interval; // the location of this element in the sequence
23 stehr 259
24     /*----------------------------- constructors ----------------------------*/
25    
26 stehr 274 public SecStrucElement(char secStrucType, int startRes, int endRes, String legacyId) {
27     this.secStrucId = legacyId;
28     this.secStrucType = secStrucType;
29 stehr 259 this.interval = new Interval(startRes, endRes);
30     }
31    
32     /*---------------------------- public methods ---------------------------*/
33    
34 stehr 274 public SecStrucElement copy() {
35     return new SecStrucElement(secStrucType, interval.beg, interval.end, secStrucId);
36 stehr 259 }
37    
38 stehr 274 /** Returns the legacy ID of this element (e.g. H1, S1, ...) */
39     public String getId() {
40     return secStrucId;
41 stehr 259 }
42    
43 stehr 274 /** Returns the dssp type of this element. Valid values are H, S, T, O */
44     public char getType() {
45     return secStrucType;
46     }
47    
48 stehr 259 /** Returns the range of this ss element in the sequence. */
49     public Interval getInterval() {
50     return interval;
51     }
52    
53 filippis 407 public char getSheetSerial() {
54 filippis 383 if (isStrand()) {
55     return Character.isLetter(secStrucId.charAt(1))?secStrucId.charAt(1):0;
56     }
57     return 0;
58     }
59    
60 stehr 274 /** Returns true if this ss element is a helix */
61     public boolean isHelix() {
62     return secStrucType == HELIX;
63     }
64    
65     /** Returns true if this ss element is a beta strand */
66     public boolean isStrand() {
67 filippis 382 return (secStrucType == STRAND || secStrucType == EXTENTED);
68 stehr 274 }
69    
70     /** Returns true if this ss element is a hydrogen bonded turn */
71     public boolean isTurn() {
72     return secStrucType == TURN;
73     }
74 filippis 383
75     /** Returns true if this ss element is other ... */
76     public boolean isOther() {
77     return (secStrucType == OTHER || secStrucType == LOOP);
78     }
79 stehr 274
80 filippis 383 public boolean inSameSheet(SecStrucElement s) {
81     boolean inSameSheet = false;
82     if (s != null && this.isStrand() && s.isStrand() && (s.getSheetSerial() == this.getSheetSerial() && s.getSheetSerial() != 0)) {
83     inSameSheet = true;
84     }
85     return inSameSheet;
86     }
87    
88 stehr 274 /*---------------------------- static methods ---------------------------*/
89    
90 filippis 382 private static char getFourStateTypeFromDsspType(char dsspType) {
91 stehr 259 char type = dsspType;
92     switch(dsspType) {
93     case 'H':
94     case 'G':
95     case 'I':
96 stehr 274 type = HELIX;
97 stehr 259 break;
98     case 'E':
99 stehr 274 type = STRAND;
100 stehr 259 break;
101     case 'T':
102 stehr 274 type = TURN;
103 stehr 259 break;
104     case 'S':
105 stehr 274 case 'B':
106     type = OTHER;
107 stehr 259 break;
108 stehr 274 default:
109     type = OTHER;
110 stehr 259 }
111     return type;
112     }
113 stehr 274
114 filippis 382 private static char getThreeStateTypeFromDsspType(char dsspType) {
115     char type = dsspType;
116     switch(dsspType) {
117     case 'H':
118     case 'G':
119     case 'I':
120     type = HELIX;
121     break;
122     case 'E':
123     case 'B':
124     type = EXTENTED;
125     break;
126     case 'T':
127     case 'S':
128     type = LOOP;
129     break;
130     default:
131     type = LOOP;
132     }
133     return type;
134     }
135    
136     public static char getReducedStateTypeFromDsspType(char dsspType, ReducedState state) {
137     switch(state) {
138     case THREESTATE:
139     return getThreeStateTypeFromDsspType(dsspType);
140     case FOURSTATE:
141     return getFourStateTypeFromDsspType(dsspType);
142     case EIGHTSTATE:
143     default:
144     return dsspType;
145     }
146     }
147    
148 stehr 259 }