| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package jalview.commands; |
| 22 |
|
|
| 23 |
|
import jalview.datamodel.AlignmentI; |
| 24 |
|
import jalview.datamodel.SequenceI; |
| 25 |
|
|
| |
|
| 86.7% |
Uncovered Elements: 6 (45) |
Complexity: 13 |
Complexity Density: 0.48 |
|
| 26 |
|
public class RemoveGapColCommand extends EditCommand |
| 27 |
|
{ |
| 28 |
|
int columnsDeleted; |
| 29 |
|
|
| |
|
| 90.5% |
Uncovered Elements: 4 (42) |
Complexity: 12 |
Complexity Density: 0.46 |
|
| 30 |
3 |
public RemoveGapColCommand(String description, SequenceI[] seqs,... |
| 31 |
|
int start, int end, AlignmentI al) |
| 32 |
|
{ |
| 33 |
3 |
this.description = description; |
| 34 |
|
|
| 35 |
3 |
int j, jSize = seqs.length; |
| 36 |
|
|
| 37 |
3 |
int startCol = -1, endCol = -1; |
| 38 |
3 |
columnsDeleted = 0; |
| 39 |
|
|
| 40 |
3 |
clearEdits(); |
| 41 |
|
|
| 42 |
3 |
boolean delete = true; |
| 43 |
58 |
for (int i = start; i <= end; i++) |
| 44 |
|
{ |
| 45 |
55 |
delete = true; |
| 46 |
|
|
| 47 |
89 |
for (j = 0; j < jSize; j++) |
| 48 |
|
{ |
| 49 |
81 |
if (seqs[j].getLength() > i) |
| 50 |
|
{ |
| 51 |
72 |
if (!jalview.util.Comparison.isGap(seqs[j].getCharAt(i))) |
| 52 |
|
{ |
| 53 |
47 |
if (delete) |
| 54 |
|
{ |
| 55 |
47 |
endCol = i; |
| 56 |
|
} |
| 57 |
|
|
| 58 |
47 |
delete = false; |
| 59 |
47 |
break; |
| 60 |
|
} |
| 61 |
|
} |
| 62 |
|
} |
| 63 |
|
|
| 64 |
55 |
if (delete && startCol == -1) |
| 65 |
|
{ |
| 66 |
7 |
startCol = i; |
| 67 |
|
} |
| 68 |
|
|
| 69 |
55 |
if (!delete && startCol > -1) |
| 70 |
|
{ |
| 71 |
7 |
this.appendEdit(Action.DELETE_GAP, seqs, startCol - columnsDeleted, |
| 72 |
|
endCol - startCol, al, false, null); |
| 73 |
|
|
| 74 |
7 |
columnsDeleted += (endCol - startCol); |
| 75 |
7 |
startCol = -1; |
| 76 |
7 |
endCol = -1; |
| 77 |
|
} |
| 78 |
|
} |
| 79 |
|
|
| 80 |
3 |
if (delete && startCol > -1) |
| 81 |
|
{ |
| 82 |
|
|
| 83 |
|
|
| 84 |
|
|
| 85 |
0 |
this.appendEdit(Action.DELETE_GAP, seqs, startCol - columnsDeleted, |
| 86 |
|
end - startCol + 1, al, false, null); |
| 87 |
|
|
| 88 |
0 |
columnsDeleted += (end - startCol + 1); |
| 89 |
|
} |
| 90 |
|
|
| 91 |
3 |
performEdit(0, null); |
| 92 |
|
} |
| 93 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 94 |
0 |
@Override... |
| 95 |
|
public int getSize() |
| 96 |
|
{ |
| 97 |
|
|
| 98 |
|
|
| 99 |
0 |
return columnsDeleted; |
| 100 |
|
} |
| 101 |
|
|
| 102 |
|
} |