From cce26350d1d8106b82701deab38a8b20022b4737 Mon Sep 17 00:00:00 2001 From: "j.procter@dundee.ac.uk" Date: Fri, 18 Jul 2014 12:08:09 +0100 Subject: [PATCH] JAL-1520 switch between Protein and non-canonical RNA secondary structure rendering styles for an annotation row --- src/jalview/datamodel/AlignmentAnnotation.java | 5 ++ src/jalview/renderer/AnnotationRenderer.java | 76 ++++++++++++++---------- 2 files changed, 51 insertions(+), 30 deletions(-) diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 9659cd7..601339a 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -1112,4 +1112,9 @@ public class AlignmentAnnotation { this.calcId = calcId; } + + public boolean isRNA() + { + return isrna; + } } diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index 5b89772..e731910 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -297,6 +297,7 @@ public class AnnotationRenderer profcolour = av.getAlignment().isNucleotide() ? new jalview.schemes.NucleotideColourScheme() : new jalview.schemes.ZappoColourScheme(); } + boolean rna = av.getAlignment().isNucleotide(); columnSelection = av.getColumnSelection(); hconsensus = av.getSequenceConsensusHash();// hconsensus; hStrucConsensus = av.getRnaStructureConsensusHash(); // hStrucConsensus; @@ -353,6 +354,8 @@ public class AnnotationRenderer return null; } + boolean rna = false; + /** * Render the annotation rows associated with an alignment. * @@ -402,7 +405,7 @@ public class AnnotationRenderer AlignmentAnnotation consensusAnnot = av .getAlignmentConsensusAnnotation(), structConsensusAnnot = av .getAlignmentStrucConsensusAnnotation(); - boolean renderHistogram = true, renderProfile = true, normaliseProfile = false; + boolean renderHistogram = true, renderProfile = true, normaliseProfile = false, isRNA = rna; BitSet graphGroupDrawn = new BitSet(); int charOffset = 0; // offset for a label @@ -416,6 +419,7 @@ public class AnnotationRenderer for (int i = 0; i < aa.length; i++) { AlignmentAnnotation row = aa[i]; + isRNA = row.isRNA(); { // check if this is a consensus annotation row and set the display // settings appropriately @@ -696,23 +700,31 @@ public class AnnotationRenderer // System.out.println("\t type :"+lastSS+"\t x :"+x+"\t nbre annot :"+nb_annot); switch (lastSS) { - - case '$': - drawHelixAnnot(g, row_annotations, lastSSX, x, y, - iconOffset, startRes, column, validRes, validEnd); - break; - - case 0xCE: - drawSheetAnnot(g, row_annotations, lastSSX, x, y, - iconOffset, startRes, column, validRes, validEnd); - break; - case '(': // Stem case for RNA secondary structure case ')': // and opposite direction drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd); temp = x; break; + + case 'H': + if (!isRNA) + { + drawHelixAnnot(g, row_annotations, lastSSX, x, y, + iconOffset, startRes, column, validRes, + validEnd); + break; + } + + case 'E': + if (!isRNA) + { + drawSheetAnnot(g, row_annotations, lastSSX, x, y, + iconOffset, startRes, column, validRes, + validEnd); + break; + } + case '{': case '}': case '[': @@ -727,13 +739,11 @@ public class AnnotationRenderer case 'c': case 'D': case 'd': - case 'E': case 'e': case 'F': case 'f': case 'G': case 'g': - case 'H': case 'h': case 'I': case 'i': @@ -828,17 +838,25 @@ public class AnnotationRenderer { switch (lastSS) { - case '$': - drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset, - startRes, column, validRes, validEnd); - break; - case 0xCE: - drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset, - startRes, column, validRes, validEnd); - break; - case 's': - case 'S': // Stem case for RNA secondary structure + case 'H': + if (!isRNA) + { + drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset, + startRes, column, validRes, validEnd); + break; + } + + case 'E': + if (!isRNA) + { + drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset, + startRes, column, validRes, validEnd); + break; + } + + case '(': + case ')': // Stem case for RNA secondary structure drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes, column, validRes, validEnd); @@ -858,13 +876,11 @@ public class AnnotationRenderer case 'c': case 'D': case 'd': - case 'E': case 'e': case 'F': case 'f': case 'G': case 'g': - case 'H': case 'h': case 'I': case 'i': @@ -1008,13 +1024,13 @@ public class AnnotationRenderer return !usedFaded; } - private final Color GLYPHLINE_COLOR = Color.gray; + public static final Color GLYPHLINE_COLOR = Color.gray; - private final Color SHEET_COLOUR = Color.green; + public static final Color SHEET_COLOUR = Color.green; - private final Color HELIX_COLOUR = Color.red; + public static final Color HELIX_COLOUR = Color.red; - private final Color STEM_COLOUR = Color.blue; + public static final Color STEM_COLOUR = Color.blue; private Color sdNOTCANONICAL_COLOUR; -- 1.7.10.2