X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignment.java;h=04977e852fcd85d83afaee169af0423b76b7468f;hb=797df64fa2a0a30773d0f48f5494d4155e5a8be3;hp=2352ac58060cabe44e44d70e8fee74a9f3463a1b;hpb=153dd62dc91da13ae732600e6ea55ddbe15eab39;p=jalview.git diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 2352ac5..04977e8 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) - * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle * * This file is part of Jalview. * @@ -43,6 +43,8 @@ public class Alignment implements AlignmentI public static final int PROTEIN = 0; public static final int NUCLEOTIDE = 1; + + public boolean hasRNAStructure = false; /** DOCUMENT ME!! */ public AlignmentAnnotation[] annotations; @@ -143,7 +145,7 @@ public class Alignment implements AlignmentI */ public SequenceI getSequenceAt(int i) { - if (i < sequences.size()) + if (i>-1 && i < sequences.size()) { return (SequenceI) sequences.elementAt(i); } @@ -593,8 +595,8 @@ public class Alignment implements AlignmentI for (int i = 0; i < sequences.size(); i++) { Sequence seq = (Sequence) sequences.elementAt(i); - seq.setSequence(seq.getSequenceAsString().replace('.', gc).replace( - '-', gc).replace(' ', gc)); + seq.setSequence(seq.getSequenceAsString().replace('.', gc) + .replace('-', gc).replace(' ', gc)); } } @@ -652,6 +654,11 @@ public class Alignment implements AlignmentI */ public boolean deleteAnnotation(AlignmentAnnotation aa) { + return deleteAnnotation(aa, true); + } + + public boolean deleteAnnotation(AlignmentAnnotation aa, boolean unhook) + { int aSize = 1; if (annotations != null) @@ -683,7 +690,9 @@ public class Alignment implements AlignmentI if (swap) { annotations = temp; - unhookAnnotation(aa); + if (unhook) { + unhookAnnotation(aa); + } } return swap; } @@ -725,6 +734,10 @@ public class Alignment implements AlignmentI */ public void addAnnotation(AlignmentAnnotation aa, int pos) { + if(aa.getRNAStruc()!= null){ + hasRNAStructure=true; + } + int aSize = 1; if (annotations != null) { @@ -825,6 +838,11 @@ public class Alignment implements AlignmentI return false; } } + + public boolean hasRNAStructure(){ + //TODO can it happen that structure is removed from alignment? + return hasRNAStructure; + } public void setDataset(Alignment data) {