| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package jalview.workers; |
| 22 |
|
|
| 23 |
|
import jalview.analysis.StructureFrequency; |
| 24 |
|
import jalview.api.AlignViewportI; |
| 25 |
|
import jalview.api.AlignmentViewPanel; |
| 26 |
|
import jalview.datamodel.AlignmentAnnotation; |
| 27 |
|
import jalview.datamodel.AlignmentI; |
| 28 |
|
import jalview.datamodel.Annotation; |
| 29 |
|
import jalview.datamodel.SequenceI; |
| 30 |
|
|
| 31 |
|
import java.util.Hashtable; |
| 32 |
|
|
| |
|
| 70% |
Uncovered Elements: 15 (50) |
Complexity: 19 |
Complexity Density: 0.59 |
|
| 33 |
|
public class StrucConsensusThread extends AlignCalcWorker |
| 34 |
|
{ |
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 35 |
2 |
public StrucConsensusThread(AlignViewportI alignViewport,... |
| 36 |
|
AlignmentViewPanel alignPanel) |
| 37 |
|
{ |
| 38 |
2 |
super(alignViewport, alignPanel); |
| 39 |
|
} |
| 40 |
|
|
| 41 |
|
AlignmentAnnotation strucConsensus; |
| 42 |
|
|
| 43 |
|
Hashtable[] hStrucConsensus; |
| 44 |
|
|
| 45 |
|
private long nseq = -1; |
| 46 |
|
|
| |
|
| 70% |
Uncovered Elements: 12 (40) |
Complexity: 12 |
Complexity Density: 0.43 |
|
| 47 |
2 |
@Override... |
| 48 |
|
public void run() |
| 49 |
|
{ |
| 50 |
2 |
if (alignViewport.isClosed()) |
| 51 |
|
{ |
| 52 |
0 |
abortAndDestroy(); |
| 53 |
0 |
return; |
| 54 |
|
} |
| 55 |
2 |
AlignmentI alignment = alignViewport.getAlignment(); |
| 56 |
|
|
| 57 |
2 |
int aWidth = -1; |
| 58 |
|
|
| 59 |
? |
if (alignment == null || (aWidth = alignment.getWidth()) < 0) |
| 60 |
|
{ |
| 61 |
0 |
return; |
| 62 |
|
} |
| 63 |
2 |
strucConsensus = alignViewport.getAlignmentStrucConsensusAnnotation(); |
| 64 |
2 |
hStrucConsensus = alignViewport.getRnaStructureConsensusHash(); |
| 65 |
2 |
strucConsensus.annotations = null; |
| 66 |
2 |
strucConsensus.annotations = new Annotation[aWidth]; |
| 67 |
|
|
| 68 |
2 |
hStrucConsensus = new Hashtable[aWidth]; |
| 69 |
|
|
| 70 |
2 |
AlignmentAnnotation[] aa = alignViewport.getAlignment() |
| 71 |
|
.getAlignmentAnnotation(); |
| 72 |
2 |
AlignmentAnnotation rnaStruc = null; |
| 73 |
|
|
| 74 |
2 |
if (aa != null) |
| 75 |
|
{ |
| 76 |
2 |
for (int i = 0; i < aa.length; i++) |
| 77 |
|
{ |
| 78 |
2 |
if (aa[i].isForDisplay() && aa[i].isRNA() && aa[i].isValidStruc()) |
| 79 |
|
{ |
| 80 |
2 |
rnaStruc = aa[i]; |
| 81 |
2 |
break; |
| 82 |
|
} |
| 83 |
|
} |
| 84 |
|
} |
| 85 |
|
|
| 86 |
|
|
| 87 |
2 |
if (rnaStruc == null || !rnaStruc.isValidStruc()) |
| 88 |
|
{ |
| 89 |
0 |
return; |
| 90 |
|
} |
| 91 |
|
|
| 92 |
2 |
try |
| 93 |
|
{ |
| 94 |
2 |
final SequenceI[] arr = alignment.getSequencesArray(); |
| 95 |
2 |
nseq = arr.length; |
| 96 |
2 |
jalview.analysis.StructureFrequency.calculate(arr, 0, |
| 97 |
|
alignment.getWidth(), hStrucConsensus, true, rnaStruc); |
| 98 |
|
} catch (ArrayIndexOutOfBoundsException x) |
| 99 |
|
{ |
| 100 |
0 |
return; |
| 101 |
|
} |
| 102 |
2 |
alignViewport.setRnaStructureConsensusHash(hStrucConsensus); |
| 103 |
|
|
| 104 |
2 |
updateResultAnnotation(true); |
| 105 |
|
|
| 106 |
|
} |
| 107 |
|
|
| 108 |
|
|
| 109 |
|
|
| 110 |
|
|
| 111 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 112 |
0 |
@Override... |
| 113 |
|
public void updateAnnotation() |
| 114 |
|
{ |
| 115 |
0 |
updateResultAnnotation(false); |
| 116 |
|
} |
| 117 |
|
|
| |
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 5 |
Complexity Density: 2.5 |
|
| 118 |
2 |
public void updateResultAnnotation(boolean immediate)... |
| 119 |
|
{ |
| 120 |
2 |
if (immediate || !calcMan.isWorking(this) && strucConsensus != null |
| 121 |
|
&& hStrucConsensus != null) |
| 122 |
|
{ |
| 123 |
2 |
StructureFrequency.completeConsensus(strucConsensus, hStrucConsensus, |
| 124 |
|
0, hStrucConsensus.length, |
| 125 |
|
alignViewport.isIgnoreGapsConsensus(), |
| 126 |
|
alignViewport.isShowSequenceLogo(), nseq); |
| 127 |
|
} |
| 128 |
|
} |
| 129 |
|
|
| 130 |
|
} |