X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignmentAnnotation.java;h=c4268e2c35785cf5101690455ed44f27e0f804b3;hb=323a457c9d0643be2406b6661246e8e988c0d0f6;hp=236e8ee0cb95d0d05742333eacd04f108d5f71dc;hpb=513e985e6781095eaafc3d9fa72c135325e8dd49;p=jalview.git diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 236e8ee..c4268e2 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -17,6 +17,8 @@ */ package jalview.datamodel; +import jalview.analysis.Rna; + import java.util.Enumeration; import java.util.Hashtable; @@ -47,6 +49,31 @@ public class AlignmentAnnotation /** DOCUMENT ME!! */ public Annotation[] annotations; + /** + * RNA secondary structure contact positions + */ + public SequenceFeature[] _rnasecstr = null; + + /** + * Updates the _rnasecstr field Determines the positions that base pair and + * the positions of helices based on secondary structure from a Stockholm file + * + * @param RNAannot + */ + private void _updateRnaSecStr(String RNAannot) + { + _rnasecstr = Rna.GetBasePairs(RNAannot); + Rna.HelixMap(_rnasecstr); + + if (_rnasecstr != null && _rnasecstr.length > 0) + { + // show all the RNA secondary structure annotation symbols. + showAllColLabels = true; + scaleColLabel = true; + } + // System.out.println("featuregroup " + _rnasecstr[0].getFeatureGroup()); + } + public java.util.Hashtable sequenceMapping; /** DOCUMENT ME!! */ @@ -167,9 +194,16 @@ public class AlignmentAnnotation validateRangeAndDisplay(); } + /** + * Checks if annotation labels represent secondary structures + * + */ void areLabelsSecondaryStructure() { boolean nonSSLabel = false; + boolean isrna = false; + StringBuffer rnastring = new StringBuffer(); + char firstChar = 0; for (int i = 0; i < annotations.length; i++) { @@ -182,9 +216,22 @@ public class AlignmentAnnotation { hasIcons |= true; } + else + // Check for RNA secondary structure + { + if (annotations[i].secondaryStructure == 'S') + { + hasIcons |= true; + isrna |= true; + } + } - if (annotations[i].displayCharacter == null) + // System.out.println("displaychar " + annotations[i].displayCharacter); + + if (annotations[i].displayCharacter == null + || annotations[i].displayCharacter.length() == 0) { + rnastring.append('.'); continue; } if (annotations[i].displayCharacter.length() == 1) @@ -205,6 +252,7 @@ public class AlignmentAnnotation firstChar != ' ' && firstChar != 'H' && firstChar != 'E' + && firstChar != 'S' && firstChar != '-' && firstChar < jalview.schemes.ResidueProperties.aaIndex.length) { @@ -219,6 +267,10 @@ public class AlignmentAnnotation } } } + else + { + rnastring.append(annotations[i].displayCharacter.charAt(1)); + } if (annotations[i].displayCharacter.length() > 0) { @@ -241,6 +293,13 @@ public class AlignmentAnnotation } } + else + { + if (isrna) + { + _updateRnaSecStr(rnastring.toString()); + } + } annotationId = this.hashCode() + ""; }