From f22d8c3bfc1892fe88b4aad3f6381e5018f175f1 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 5 Feb 2007 10:57:02 +0000 Subject: [PATCH] applet can define groups as parameters --- src/jalview/bin/JalviewLite.java | 38 +++++++++++++++++++++++++++++++----- src/jalview/io/AnnotationFile.java | 18 ++++++++++++++--- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index 35fc82f..222d049 100755 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -461,27 +461,55 @@ public class JalviewLite extends Applet } - String pdbfile = applet.getParameter("PDBFILE"); - if(pdbfile!=null) + param = getParameter("PDBFILE"); + if(param!=null) { - if( inArchive(pdbfile) ) + if( inArchive(param) ) protocol = AppletFormatAdapter.CLASSLOADER; else { protocol = AppletFormatAdapter.URL; - pdbfile = addProtocol(pdbfile); + param = addProtocol(param); } String sequence = applet.getParameter("PDBSEQ"); if(sequence!=null) { - new MCview.AppletPDBViewer(pdbfile, protocol, + new MCview.AppletPDBViewer(param, protocol, (Sequence)currentAlignFrame.getAlignViewport().getAlignment().findName(sequence), currentAlignFrame.getSeqcanvas()); } } + + int gIndex = 1; + param = getParameter("SEQUENCE_GROUP"+gIndex); + if(param!=null) + do{ + new AnnotationFile().readAnnotationFile( + currentAlignFrame.viewport.getAlignment(), + "JALVIEW_ANNOTATION\nSEQUENCE_GROUP\t"+param, + AppletFormatAdapter.PASTE); + gIndex++; + param = applet.getParameter("SEQUENCE_GROUP"+gIndex); + currentAlignFrame.alignPanel.repaint(); + }while(param!=null); + + gIndex = 1; + param = getParameter("PROPERTIES" + gIndex); + if (param != null) + do + { + new AnnotationFile().readAnnotationFile( + currentAlignFrame.viewport.getAlignment(), + "JALVIEW_ANNOTATION\nPROPERTIES\t" + param, + AppletFormatAdapter.PASTE); + gIndex++; + param = applet.getParameter("PROPERTIES" + gIndex); + currentAlignFrame.alignPanel.repaint(); + } + while (param != null); } else { diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index 56040d9..8ec234d 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -225,7 +225,6 @@ public class AnnotationFile SequenceI refSeq = null; - Hashtable annotationsHash = new Hashtable(); public boolean readAnnotationFile(AlignmentI al, String file, String protocol) @@ -591,7 +590,6 @@ public class AnnotationFile if(sg.getSize()>0) { al.addGroup(sg); - annotationsHash.put(sg.getName(), sg); } } @@ -601,7 +599,21 @@ public class AnnotationFile //So far we have only added groups to the annotationHash, //the idea is in the future properties can be added to //alignments, other annotations etc - SequenceGroup sg = (SequenceGroup)annotationsHash.get(st.nextToken()); + if(al.getGroups()==null) + return; + SequenceGroup sg = null; + + String name = st.nextToken(); + + Vector groups = al.getGroups(); + for(int i=0; i