package jalview.schemes;
import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.AnnotatedCollectionI;
import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceI;
public class RNAHelicesColour extends ResidueColourScheme
{
-
/**
* Maps sequence positions to the RNA helix they belong to. Key: position,
* Value: helix TODO: Revise or drop in favour of annotation position numbers
public AlignmentAnnotation annotation;
/**
+ * Default constructor (required for ColourSchemes cache)
+ */
+ public RNAHelicesColour()
+ {
+
+ }
+
+ /**
* Creates a new RNAHelicesColour object.
*/
public RNAHelicesColour(AlignmentAnnotation annotation)
{
super(ResidueProperties.nucleotideIndex);
this.annotation = annotation;
+ ColourSchemeProperty.resetRnaHelicesShading();
refresh();
}
public RNAHelicesColour(AnnotatedCollectionI alignment)
{
super(ResidueProperties.nucleotideIndex);
+ ColourSchemeProperty.resetRnaHelicesShading();
alignmentChanged(alignment, null);
}
// 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++)
{
}
@Override
- public ColourSchemeI applyTo(AnnotatedCollectionI sg,
+ public ColourSchemeI getInstance(AnnotatedCollectionI sg,
Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
- return new RNAHelicesColour(this);
+ return new RNAHelicesColour(sg);
+ }
+
+ @Override
+ public boolean isNucleotideSpecific()
+ {
+ return true;
+ }
+
+ /**
+ * Answers true if the data has RNA secondary structure annotation
+ */
+ @Override
+ public boolean isApplicableTo(AnnotatedCollectionI ac)
+ {
+ if (ac instanceof AlignmentI && ((AlignmentI) ac).hasRNAStructure())
+ {
+ return true;
+ }
+
+ /*
+ * not currently supporting this option for group annotation / colouring
+ */
+ return false;
+ }
+
+ @Override
+ public String getSchemeName()
+ {
+ return JalviewColourScheme.RNAHelices.toString();
+ }
+
+ @Override
+ public boolean isSimple()
+ {
+ return false;
}
-}
\ No newline at end of file
+}