From: janengelhardt Date: Fri, 22 Jul 2011 11:11:03 +0000 (+0200) Subject: JAL-878; Additional structures with a 'GR' tag in StockholmFiles are X-Git-Tag: Jalview_2_9~576^2~22 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f7bce11fb6036cd7f94e17c9f136970984a9402a;p=jalview.git JAL-878; Additional structures with a 'GR' tag in StockholmFiles are associated their specific sequence. Change-Id: I26913db05bef3983b63397304c97351f5361d61d --- diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 6a03b53..a57c2e4 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -1303,7 +1303,7 @@ public class SeqPanel extends JPanel implements MouseListener, else // ///Editing a single sequence/////////// { - if (insertGap && !editSeq) + if (insertGap) { // dragging to the right if (fixedColumns && fixedRight != -1) @@ -1312,17 +1312,13 @@ public class SeqPanel extends JPanel implements MouseListener, { insertChar(j, new SequenceI[] { seq }, fixedRight); - System.out.println("InsertGap1"); - } } else { editCommand.appendEdit(EditCommand.INSERT_GAP, new SequenceI[] { seq }, lastres, startres - lastres, av.alignment, true); - System.out.println("InsertGap2 - lastres: "+lastres+" startres: "+startres); - - } + } } else { @@ -1368,14 +1364,11 @@ public class SeqPanel extends JPanel implements MouseListener, insertChar(j, new SequenceI[] { seq }, fixedRight); } - System.out.println("EditSeq1"); - - } + } else { editCommand.appendEdit(EditCommand.INSERT_NUC, new SequenceI[] { seq }, lastres, startres - lastres, av.alignment, true); - System.out.println("EditSeq2"); } } } diff --git a/src/jalview/io/StockholmFile.java b/src/jalview/io/StockholmFile.java index 2e0fea7..8f6a12f 100644 --- a/src/jalview/io/StockholmFile.java +++ b/src/jalview/io/StockholmFile.java @@ -149,12 +149,16 @@ public class StockholmFile extends AlignFile int start = 1; int end = -1; String sid = acc; - // Retrieve hash of annotations for this accession + /* + * Retrieve hash of annotations for this accession + * Associate Annotation with accession + */ Hashtable accAnnotations = null; if (seqAnn != null && seqAnn.containsKey(acc)) { accAnnotations = (Hashtable) seqAnn.remove(acc); + //TODO: add structures to sequence } // Split accession in id and from/to @@ -184,7 +188,19 @@ public class StockholmFile extends AlignFile jalview.util.DBRefUtils.parseToDbRef(seqO, src, "0", acn); // seqO.addDBRef(dbref); } + } + if (accAnnotations != null && accAnnotations.containsKey("SS")) + { + Vector v = (Vector) accAnnotations.get("SS"); + + for (int i = 0; i < v.size(); i++) + { + AlignmentAnnotation an = (AlignmentAnnotation) v.elementAt(i); + seqO.addAlignmentAnnotation(an); + //annotations.add(an); + } } + Hashtable features = null; // We need to adjust the positions of all features to account for gaps try @@ -426,7 +442,7 @@ public class StockholmFile extends AlignFile ann = new Hashtable(); seqAnn.put(acc, ann); } - + //TODO test structure, call parseAnnotationRow with vector from hashtable for specific sequence Hashtable features; // Get an object with all the content for an annotation if (ann.containsKey("features")) @@ -461,6 +477,24 @@ public class StockholmFile extends AlignFile } ns += seq; content.put(description, ns); + + if(type.equals("SS")){ + Hashtable strucAnn; + if (seqAnn.containsKey(acc)) + { + strucAnn = (Hashtable) seqAnn.get(acc); + } + else + { + strucAnn = new Hashtable(); + } + + Vector newStruc=new Vector(); + parseAnnotationRow(newStruc, type,ns); + + strucAnn.put(type, newStruc); + seqAnn.put(acc, strucAnn); + } } else { @@ -566,6 +600,7 @@ public class StockholmFile extends AlignFile annot.annotations.length); System.arraycopy(els, 0, anns, annot.annotations.length, els.length); annot.annotations = anns; + //System.out.println("else: "); } return annot; }