boolean validCharWidth;
int wrappedWidth;
Font font;
+ boolean seqNameItalics;
AlignmentI alignment;
ColumnSelection colSel = new ColumnSelection();
int threshold;
boolean gatherViewsHere = false;
+ Stack historyList = new Stack();
+ Stack redoList = new Stack();
+
+ Hashtable sequenceColours;
+
+ int thresholdTextColour = 0;
+ Color textColour = Color.black;
+ Color textColour2 = Color.white;
+
+ boolean rightAlignIds = false;
+
+ Hashtable hiddenRepSequences;
+
+
/**
* Creates a new AlignViewport object.
*
showJVSuffix = Cache.getDefault("SHOW_JVSUFFIX", true);
showAnnotation = Cache.getDefault("SHOW_ANNOTATIONS", true);
+ rightAlignIds = Cache.getDefault("RIGHT_ALIGN_IDS", false);
+
autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true);
padGaps = Cache.getDefault("PAD_GAPS", true);
String fontStyle = Cache.getDefault("FONT_STYLE", Font.PLAIN + "") ;
String fontSize = Cache.getDefault("FONT_SIZE", "10");
+ seqNameItalics = Cache.getDefault("ID_ITALICS", true);
+
int style = 0;
if (fontStyle.equals("bold"))
11f,
AlignmentAnnotation.BAR_GRAPH);
conservation.hasText = true;
+ conservation.autoCalculated = true;
if (Cache.getDefault("SHOW_CONSERVATION", true))
11f,
AlignmentAnnotation.BAR_GRAPH);
quality.hasText = true;
+ quality.autoCalculated = true;
alignment.addAnnotation(quality);
}
new Annotation[1], 0f, 100f,
AlignmentAnnotation.BAR_GRAPH);
consensus.hasText = true;
+ consensus.autoCalculated = true;
if (Cache.getDefault("SHOW_IDENTITY", true))
{
globalColourScheme.setConsensus(hconsensus);
}
}
+
+ wrapAlignment = jalview.bin.Cache.getDefault("WRAP_ALIGNMENT", false);
}
{
try
{
- while (updatingConservation)
+ updatingConservation = true;
+
+ while (UPDATING_CONSERVATION)
{
try
{
+ if (ap != null)
+ {
+ ap.repaint();
+ }
Thread.sleep(200);
}
catch (Exception ex)
}
}
- updatingConservation = true;
+ UPDATING_CONSERVATION = true;
int alWidth = alignment.getWidth();
cons.findQuality();
}
- String sequence = cons.getConsSequence().getSequence();
+ char [] sequence = cons.getConsSequence().getSequence();
float minR;
float minG;
float minB;
{
float value = 0;
- c = sequence.charAt(i);
+ c = sequence[i];
if (Character.isDigit(c))
value = (int) (c - '0');
}
+ UPDATING_CONSERVATION = false;
+ updatingConservation = false;
+
if(ap!=null)
{
ap.repaint();
}
- updatingConservation = false;
+
}
}
boolean consUpdateNeeded = false;
- static boolean updatingConsensus = false;
+ static boolean UPDATING_CONSENSUS = false;
+
+ static boolean UPDATING_CONSERVATION = false;
+
+ boolean updatingConsensus = false;
- static boolean updatingConservation = false;
+ boolean updatingConservation = false;
/**
* DOCUMENT ME!
}
public void run()
{
- while (updatingConsensus)
+ updatingConsensus = true;
+ while (UPDATING_CONSENSUS)
{
try
{
+ if (ap != null)
+ {
+ ap.repaint();
+ }
+
Thread.sleep(200);
}
catch (Exception ex)
}
}
- updatingConsensus = true;
+
+ UPDATING_CONSENSUS = true;
try
{
}
catch (OutOfMemoryError error)
{
+ alignment.deleteAnnotation(consensus);
+
consensus = null;
hconsensus = null;
javax.swing.SwingUtilities.invokeLater(new Runnable()
System.out.println("Consensus calculation: " + error);
System.gc();
}
+ UPDATING_CONSENSUS = false;
+ updatingConsensus = false;
if (ap != null)
{
ap.repaint();
}
-
-
- updatingConsensus = false;
}
}
/**
seqs.append(consensus.annotations[i].displayCharacter);
}
}
+
SequenceI sq = new Sequence("Consensus", seqs.toString());
sq.setDescription("Percentage Identity Consensus "+((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
return sq;
hasHiddenColumns = true;
}
+ public void hideRepSequences(SequenceI repSequence, SequenceGroup sg)
+ {
+ int sSize = sg.getSize();
+ if(sSize < 2)
+ return;
+
+ if(hiddenRepSequences==null)
+ hiddenRepSequences = new Hashtable();
+
+ hiddenRepSequences.put(repSequence, sg);
+
+ //Hide all sequences except the repSequence
+ SequenceI [] seqs = new SequenceI[sSize-1];
+ int index = 0;
+ for(int i=0; i<sSize; i++)
+ if(sg.getSequenceAt(i)!=repSequence)
+ {
+ if(index==sSize-1)
+ return;
+
+ seqs[index++] = sg.getSequenceAt(i);
+ }
+
+ hideSequence(seqs);
+
+ }
+
public void hideAllSelectedSeqs()
{
if (selectionGroup == null)
if(seq!=null)
{
for (int i = 0; i < seq.length; i++)
+ {
alignment.getHiddenSequences().hideSequence(seq[i]);
-
+ }
hasHiddenRows = true;
firePropertyChange("alignment", null, alignment.getSequences());
}
public void showSequence(int index)
{
- Vector tmp = alignment.getHiddenSequences().showSequence(index);
+ Vector tmp = alignment.getHiddenSequences().showSequence(index
+ , hiddenRepSequences);
if(tmp.size()>0)
{
if(selectionGroup==null)
selectionGroup = new SequenceGroup();
selectionGroup.setEndRes(alignment.getWidth()-1);
}
- Vector tmp = alignment.getHiddenSequences().showAll();
+ Vector tmp = alignment.getHiddenSequences().showAll(hiddenRepSequences);
for(int t=0; t<tmp.size(); t++)
{
selectionGroup.addSequence(
}
firePropertyChange("alignment", null, alignment.getSequences());
hasHiddenRows = false;
+ hiddenRepSequences = null;
}
}
+
+
public void invertColumnSelection()
{
- int column;
for(int i=0; i<alignment.getWidth(); i++)
{
- column = i;
-
- if(colSel.contains(column))
- colSel.removeElement(column);
+ if(colSel.contains(i))
+ colSel.removeElement(i);
else
- colSel.addElement(column);
-
+ {
+ if (!hasHiddenColumns || colSel.isVisible(i))
+ {
+ colSel.addElement(i);
+ }
+ }
}
-
}
public int adjustForHiddenSeqs(int alignmentIndex)
int start = 0, end = 0;
if(selectedRegionOnly && selectionGroup!=null)
{
- iSize = selectionGroup.getSize(false);
+ iSize = selectionGroup.getSize();
seqs = selectionGroup.getSequencesInOrder(alignment);
start = selectionGroup.getStartRes();
end = selectionGroup.getEndRes(); // inclusive for start and end in SeqCigar constructor
int start = 0, end = 0;
if(selectedRegionOnly && selectionGroup!=null)
{
- iSize = selectionGroup.getSize(false);
+ iSize = selectionGroup.getSize();
seqs = selectionGroup.getSequencesInOrder(alignment);
start = selectionGroup.getStartRes();
end = selectionGroup.getEndRes()+1;
} else {
for(i=0; i<iSize; i++)
{
- selection[i] = seqs[i].getSequence(start, end);
+ selection[i] = seqs[i].getSequenceAsString(start, end);
}
}
updateConservation(ap);
}
- resetAllColourSchemes();
+ //Reset endRes of groups if beyond alignment width
+ int alWidth = alignment.getWidth();
+ Vector groups = alignment.getGroups();
+ if(groups!=null)
+ {
+ for(int i=0; i<groups.size(); i++)
+ {
+ SequenceGroup sg = (SequenceGroup)groups.elementAt(i);
+ if(sg.getEndRes()>alWidth)
+ sg.setEndRes(alWidth-1);
+ }
+ }
- alignment.adjustSequenceAnnotations();
+ if(selectionGroup!=null && selectionGroup.getEndRes()>alWidth)
+ selectionGroup.setEndRes(alWidth-1);
+
+ resetAllColourSchemes();
+ // alignment.adjustSequenceAnnotations();
}
if(sg.cs!=null && sg.cs instanceof ClustalxColourScheme)
{
((ClustalxColourScheme)sg.cs).resetClustalX(
- sg.getSequences(true), sg.getWidth());
+ sg.getSequences(hiddenRepSequences), sg.getWidth());
}
sg.recalcConservation();
}
}
+ public Color getSequenceColour(SequenceI seq)
+ {
+ if(sequenceColours==null || !sequenceColours.containsKey(seq))
+ return Color.white;
+ else
+ return (Color)sequenceColours.get(seq);
+ }
+
+ public void setSequenceColour(SequenceI seq, Color col)
+ {
+ if(sequenceColours==null)
+ sequenceColours = new Hashtable();
+
+ if(col == null)
+ sequenceColours.remove(seq);
+ else
+ sequenceColours.put(seq, col);
+ }
+
}