patches that I showed you yesterday - just for the record

Hi Lauren,

Here are the modifications I talked about yesterday and on Monday. I don't think they need to be patched in, now you'll be doing things in a far better way:

Modification to alignfile so any annotation imported with an alignment would be checked and processed for RNA secondary structure content.

Index: src/jalview/io/AlignFile.java

···

===================================================================
--- src/jalview/io/AlignFile.java (revision 18)
+++ src/jalview/io/AlignFile.java (working copy)
@@ -127,6 +127,13 @@
      addProperties(al);
      for (int i = 0; i < annotations.size(); i++)
      {
+ // detect if annotations.elementAt(i) rna secondary structure
+ // if so then do:
+ /*
+ * SequenceFeature[] pairArray = Rna.GetBasePairsFromAlignmentAnnotation(annotations.elementAt(i));
+ Rna.HelixMap(pairArray);
+
+ */
        al.addAnnotation((AlignmentAnnotation) annotations.elementAt(i));
      }

Modification to stk parser so sequence features attached to each sequence are in the correct coordinate frame. Note also that sequence:sequenceFeature is a 1:1 relationship - bad things may happen if one sequence feature object is shared by many sequences.

Index: src/jalview/io/StockholmFile.java

--- src/jalview/io/StockholmFile.java (revision 18)
+++ src/jalview/io/StockholmFile.java (working copy)
@@ -239,6 +239,7 @@
              }
            }
          //System.out.println("RNAannot: " + RNAannot);
+
            if(RNAannot.length() > 1)
              {
                   SequenceFeature[] pairArray = Rna.GetBasePairs(RNAannot);
@@ -247,7 +248,13 @@
                   for(int i=0; i< pairArray.length; i++)
                   {
                     System.out.println("start " + pairArray[i].getBegin() + " end " + pairArray[i].getEnd() + " helix " + pairArray[i].getFeatureGroup());
- seqO.addSequenceFeature(pairArray[i]);
+ int bg = seqO.findPosition(pairArray[i].getBegin());
+ int en = seqO.findPosition(pairArray[i].getEnd());
+ SequenceFeature nsf = new SequenceFeature(pairArray[i]);
+ nsf.setBegin(bg);
+ nsf.setEnd(en);
+
+ seqO.addSequenceFeature(nsf);

Jim.

--
-------------------------------------------------------------------
J. B. Procter (JALVIEW/ENFIN) Barton Bioinformatics Research Group
Phone/Fax:+44(0)1382 388734/345764 http://www.compbio.dundee.ac.uk
The University of Dundee is a Scottish Registered Charity, No. SC015096.