Collection<String> types, List<SequenceI> forSequences,
boolean anyType, boolean doShow)
{
- for (AlignmentAnnotation aa : al.getAlignmentAnnotation())
+ AlignmentAnnotation[] anns = al.getAlignmentAnnotation();
+ if (anns != null)
{
- if (anyType || types.contains(aa.label))
+ for (AlignmentAnnotation aa : anns)
{
- if ((aa.sequenceRef != null)
- && (forSequences == null || forSequences
- .contains(aa.sequenceRef)))
+ if (anyType || types.contains(aa.label))
{
- aa.visible = doShow;
+ if ((aa.sequenceRef != null)
+ && (forSequences == null || forSequences
+ .contains(aa.sequenceRef)))
+ {
+ aa.visible = doShow;
+ }
}
}
}
*/
public String printCSVAnnotations(AlignmentAnnotation[] annotations)
{
+ if (annotations == null)
+ {
+ return "";
+ }
StringBuffer sp = new StringBuffer();
for (int i = 0; i < annotations.length; i++)
{
fr = avpanel.cloneFeatureRenderer();
// Add non auto calculated annotation to AlignFile
- for (AlignmentAnnotation annot : annots)
+ if (annots != null)
{
- if (annot != null && !annot.autoCalculated)
+ for (AlignmentAnnotation annot : annots)
{
- annotations.add(annot);
+ if (annot != null && !annot.autoCalculated)
+ {
+ annotations.add(annot);
+ }
}
}
globalColourScheme = ColourSchemeProperty.getColourName(viewport
// This loop will find the first rna structure annotation by which to colour
// the sequences.
AlignmentAnnotation[] annotations = alignment.getAlignmentAnnotation();
+ if (annotations == null)
+ {
+ return;
+ }
for (int i = 0; i < annotations.length; i++)
{
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.SequenceGroup;
import java.awt.event.ActionEvent;
adjusting = true;
Vector list = new Vector();
int index = 1;
- for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
+ AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation();
+ if (anns != null)
{
- String label = av.getAlignment().getAlignmentAnnotation()[i].label;
- if (!list.contains(label))
+ for (int i = 0; i < anns.length; i++)
{
- list.addElement(label);
- }
- else
- {
- list.addElement(label + "_" + (index++));
+ String label = anns[i].label;
+ if (!list.contains(label))
+ {
+ list.addElement(label);
+ }
+ else
+ {
+ list.addElement(label + "_" + (index++));
+ }
}
}
protected void setSequenceAnnotationsVisible(SequenceI sequenceI,
boolean visible)
{
- for (AlignmentAnnotation ann : alignment.getAlignmentAnnotation())
+ AlignmentAnnotation[] anns = alignment.getAlignmentAnnotation();
+ if (anns != null)
{
- if (ann.sequenceRef == sequenceI)
+ for (AlignmentAnnotation ann : anns)
{
- ann.visible = visible;
+ if (ann.sequenceRef == sequenceI)
+ {
+ ann.visible = visible;
+ }
}
}
}
.getAlignmentAnnotation();
AlignmentAnnotation rnaStruc = null;
// select rna struct to use for calculation
- for (int i = 0; i < aa.length; i++)
+ if (aa != null)
{
- if (aa[i].visible && aa[i].isRNA() && aa[i].isValidStruc())
+ for (int i = 0; i < aa.length; i++)
{
- rnaStruc = aa[i];
- break;
+ if (aa[i].visible && aa[i].isRNA() && aa[i].isValidStruc())
+ {
+ rnaStruc = aa[i];
+ break;
+ }
}
}
// check to see if its valid