1 package jalview.ws.jws2;
3 import jalview.datamodel.AlignmentAnnotation;
4 import jalview.datamodel.AlignmentI;
5 import jalview.gui.AlignFrame;
6 import jalview.gui.AlignmentPanel;
7 import jalview.ws.jws2.dm.AAConsSettings;
8 import jalview.ws.jws2.jabaws2.Jws2Instance;
9 import jalview.ws.params.WsParamSetI;
11 import java.util.ArrayList;
12 import java.util.List;
15 import java.util.TreeSet;
17 import compbio.data.sequence.Score;
18 import compbio.metadata.Argument;
20 public class AAConsClient extends JabawsAlignCalcWorker
23 public AAConsClient(Jws2Instance service, AlignFrame alignFrame,
24 WsParamSetI preset, List<Argument> paramset)
26 super(service, alignFrame, preset, paramset);
29 nucleotidesAllowed = false;
30 proteinAllowed = true;
31 gapMap=new boolean[0];
35 protected void initViewportParams()
37 ((jalview.gui.AlignViewport) alignViewport).setCalcIdSettingsFor(getCalcId(), new AAConsSettings(true, service, this.preset, (arguments!=null) ? JabaParamStore.getJwsArgsfromJaba(arguments) : null), true);
40 public void updateParameters(WsParamSetI newpreset, java.util.List<Argument> newarguments) {
41 super.updateParameters(newpreset, newarguments);
44 public String getServiceActionText()
46 return "calculating Amino acid consensus using AACons service";
50 * update the consensus annotation from the sequence profile data using
51 * current visualization settings.
54 public void updateResultAnnotation(boolean immediate)
56 if (immediate || !calcMan.isWorking(this) && scoremanager != null)
58 Map<String, TreeSet<Score>> scoremap = scoremanager.asMap();
59 int alWidth = alignViewport.getAlignment().getWidth();
60 ArrayList<AlignmentAnnotation> ourAnnot = new ArrayList<AlignmentAnnotation>();
61 for (String score : scoremap.keySet())
63 Set<Score> scores = scoremap.get(score);
64 for (Score scr : scores)
66 if (scr.getRanges() != null && scr.getRanges().size() > 0)
69 * annotation in range annotation = findOrCreate(scr.getMethod(),
70 * true, null, null); Annotation[] elm = new Annotation[alWidth];
71 * Iterator<Float> vals = scr.getScores().iterator(); for (Range rng
72 * : scr.getRanges()) { float val = vals.next().floatValue(); for
73 * (int i = rng.from; i <= rng.to; i++) { elm[i] = new
74 * Annotation("", "", ' ', val); } } annotation.annotations = elm;
75 * annotation.validateRangeAndDisplay();
80 createAnnotationRowsForScores(ourAnnot, getCalcId(), alWidth,
86 if (ourAnnot.size() > 0)
88 updateOurAnnots(ourAnnot);
93 public String getCalcId()
95 return SequenceAnnotationWSClient.AAConsCalcId;
98 public static void removeAAConsAnnotation(AlignmentPanel alignPanel)
100 for (AlignmentAnnotation aa: alignPanel.getAlignment().findAnnotation(SequenceAnnotationWSClient.AAConsCalcId))
102 alignPanel.getAlignment().deleteAnnotation(aa);
104 // List<AlignmentAnnotation>
105 // ourannots=alignPanel.getAlignment().findAnnotation(Screen3D.)
106 // TODO Auto-generated method stub