X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignmentAnnotation.java;h=e137225e1920aec2c477fae897bb38024e85f5a8;hp=073199161041e109db44ad439fe48238f5ae8564;hb=2273eba5668e5340354da60fed329c6c716cc439;hpb=497958b4e5217efaa3ddeece38f38c3a6e98cb96 diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 0731991..e137225 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -75,9 +75,10 @@ public class AlignmentAnnotation public SequenceFeature[] _rnasecstr = null; /** - * position of annotation resulting in invalid WUSS parsing or -1 + * position of annotation resulting in invalid WUSS parsing or -1. -2 means + * there was no RNA structure in this annotation */ - private long invalidrnastruc = -1; + private long invalidrnastruc = -2; /** * Updates the _rnasecstr field Determines the positions that base pair and @@ -110,10 +111,47 @@ public class AlignmentAnnotation isrna = true; showAllColLabels = true; scaleColLabel = true; + _markRnaHelices(); } // System.out.println("featuregroup " + _rnasecstr[0].getFeatureGroup()); + } + private void _markRnaHelices() + { + int mxval = 0; + // Figure out number of helices + // Length of rnasecstr is the number of pairs of positions that base pair + // with each other in the secondary structure + for (int x = 0; x < _rnasecstr.length; x++) + { + + /* + * System.out.println(this.annotation._rnasecstr[x] + " Begin" + + * this.annotation._rnasecstr[x].getBegin()); + */ + // System.out.println(this.annotation._rnasecstr[x].getFeatureGroup()); + int val = 0; + try + { + val = Integer.valueOf(_rnasecstr[x].getFeatureGroup()); + if (mxval < val) + { + mxval = val; + } + } catch (NumberFormatException q) + { + } + ; + + annotations[_rnasecstr[x].getBegin()].value = val; + annotations[_rnasecstr[x].getEnd()].value = val; + + // annotations[_rnasecstr[x].getBegin()].displayCharacter = "" + val; + // annotations[_rnasecstr[x].getEnd()].displayCharacter = "" + val; + } + setScore(mxval); + } /** * map of positions in the associated annotation */ @@ -455,11 +493,10 @@ public class AlignmentAnnotation @Override public char charAt(int index) { - String dc; return ((index + offset < 0) || (index + offset) >= max - || annotations[index + offset] == null || (dc = annotations[index - + offset].displayCharacter.trim()).length() < 1) ? '.' : dc - .charAt(0); + || annotations[index + offset] == null || (annotations[index + + offset].secondaryStructure < ' ') ? ' ' + : annotations[index + offset].secondaryStructure); } public String toString() @@ -469,9 +506,8 @@ public class AlignmentAnnotation for (int i = offset; i < mx; i++) { - String dc; - string[i] = (annotations[i] == null || (dc = annotations[i].displayCharacter - .trim()).length() < 1) ? '.' : dc.charAt(0); + string[i] = (annotations[i] == null || (annotations[i].secondaryStructure < 32)) ? ' ' + : annotations[i].secondaryStructure; } return new String(string); }