1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.io; |
22 |
|
|
23 |
|
import jalview.datamodel.ContactMatrix; |
24 |
|
import jalview.datamodel.SequenceI; |
25 |
|
|
26 |
|
import java.io.IOException; |
27 |
|
import java.util.ArrayList; |
28 |
|
import java.util.BitSet; |
29 |
|
import java.util.HashMap; |
30 |
|
import java.util.List; |
31 |
|
import java.util.Map; |
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
@author |
44 |
|
|
45 |
|
|
|
|
| 0% |
Uncovered Elements: 41 (41) |
Complexity: 12 |
Complexity Density: 0.44 |
|
46 |
|
public class PContactPredictionFile extends AlignFile |
47 |
|
{ |
48 |
|
protected static final String CONTACT_PREDICTION = "CONTACT_PREDICTION"; |
49 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
50 |
0 |
public PContactPredictionFile(String inFile,... |
51 |
|
DataSourceType fileSourceType) throws IOException |
52 |
|
{ |
53 |
0 |
super(inFile, fileSourceType); |
54 |
|
|
55 |
|
} |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
0 |
public PContactPredictionFile(FileParse source) throws IOException... |
58 |
|
{ |
59 |
0 |
super(source); |
60 |
|
} |
61 |
|
|
62 |
|
Integer fWidth; |
63 |
|
|
64 |
|
List<ContactMatrix> models = new ArrayList<ContactMatrix>(); |
65 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
66 |
0 |
public List<ContactMatrix> getContactMatrices()... |
67 |
|
{ |
68 |
0 |
return models; |
69 |
|
} |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
@see |
84 |
|
|
|
|
| 0% |
Uncovered Elements: 26 (26) |
Complexity: 5 |
Complexity Density: 0.25 |
|
85 |
0 |
@Override... |
86 |
|
public void parse() throws IOException |
87 |
|
{ |
88 |
0 |
String line; |
89 |
|
|
90 |
|
|
91 |
|
|
92 |
0 |
Map<String, String> header = new HashMap<String, String>(); |
93 |
0 |
ContactMatrix cm = null; |
94 |
|
|
95 |
0 |
while ((line = nextLine()) != null) |
96 |
|
{ |
97 |
0 |
int left, right; |
98 |
0 |
double strength = Float.NaN; |
99 |
0 |
String parts[] = line.split("\\s+"); |
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
0 |
if (parts.length == 3) |
108 |
|
{ |
109 |
|
|
110 |
0 |
if (cm == null) |
111 |
|
{ |
112 |
0 |
cm = new ContactMatrix(true) |
113 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
114 |
0 |
@Override... |
115 |
|
public String getType() |
116 |
|
{ |
117 |
0 |
return CONTACT_PREDICTION; |
118 |
|
} |
119 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
120 |
0 |
@Override... |
121 |
|
public int getHeight() |
122 |
|
{ |
123 |
|
|
124 |
|
|
125 |
0 |
return 0; |
126 |
|
} |
127 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
128 |
0 |
@Override... |
129 |
|
public int getWidth() |
130 |
|
{ |
131 |
|
|
132 |
|
|
133 |
0 |
return 0; |
134 |
|
} |
135 |
|
}; |
136 |
0 |
models.add(cm); |
137 |
|
} |
138 |
|
|
139 |
0 |
try |
140 |
|
{ |
141 |
0 |
left = Integer.parseInt(parts[0]); |
142 |
0 |
right = Integer.parseInt(parts[1]); |
143 |
0 |
strength = Double.parseDouble(parts[2]); |
144 |
|
} catch (Exception x) |
145 |
|
{ |
146 |
0 |
error = true; |
147 |
0 |
errormessage = "Couldn't process line: " + x.getLocalizedMessage() |
148 |
|
+ "\n" + line; |
149 |
0 |
return; |
150 |
|
} |
151 |
0 |
cm.addContact(left, right, (float) strength); |
152 |
|
} |
153 |
|
} |
154 |
|
|
155 |
0 |
throw (new Error("Not Implemented yet.")); |
156 |
|
} |
157 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
158 |
0 |
@Override... |
159 |
|
public String print(SequenceI[] sqs, boolean jvsuffix) |
160 |
|
{ |
161 |
|
|
162 |
0 |
return "Not valid."; |
163 |
|
} |
164 |
|
} |