+ public void updateView(AlignmentViewport view)
+ {
+ viewAl = view;
+ for (Runnable op : viewOps)
+ {
+ op.run();
+ }
+ }
+
+ private void addRedundantSeqGroup(final SequenceI firsthit,
+ long alisqfrom, long alisqto, JSONArray others, boolean justDelete)
+ {
+ if (others != null)
+ {
+ final SequenceGroup repgroup = new SequenceGroup();
+ repgroup.setSeqrep(firsthit);
+ repgroup.addOrRemove(firsthit, false);
+ repgroup.setStartRes(0);
+ repgroup.setEndRes(resultAl.getWidth() - 1);
+ for (Object otherseq : others.toArray(new JSONObject[0]))
+ {
+ String repseq = (String) ((JSONObject) otherseq).get("dn");
+ SequenceI[] other = resultAl.findSequenceMatch(repseq);
+ if (other != null && other.length > 0)
+ {
+ if (justDelete)
+ {
+ for (SequenceI oth : other)
+ {
+ resultAl.deleteSequence(oth);
+ }
+ ;
+ }
+ else
+ {
+ int ofound = 0;
+ for (SequenceI oth : other)
+ {
+ if (oth.getStart() == alisqfrom && oth.getEnd() == alisqto)
+ {
+ ofound++;
+ repgroup.addSequence(oth, false);
+ }
+ }
+ if (ofound == 0)
+ {
+ System.err.println("Warn - no match for redundant hit "
+ + repseq + "/" + alisqfrom + "-" + alisqto);
+ }
+ if (ofound > 1)
+ {
+ System.err
+ .println("Warn - multiple matches for redundant hit "
+ + repseq + "/" + alisqfrom + "-" + alisqto);
+ }
+ }
+ }
+ }
+ if (repgroup.getSequences().size() > 1)
+ {
+ // queue a hide operation
+ final HmmerJSONProcessor me = this;
+ viewOps.add(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ me.viewAl.hideRepSequences(firsthit, repgroup);
+ }
+ });
+ }
+ }
+ }
+
+ Map<String, SequenceGroup> groups = new HashMap<String, SequenceGroup>();
+
+ private void addArchGroup(SequenceI seqToAdd, String groupNam)
+ {
+ SequenceGroup sg = groups.get(groupNam);
+ if (sg == null)
+ {
+ sg = new SequenceGroup();
+ sg.setName(groupNam);
+ sg.addSequence(seqToAdd, false);
+ sg.setStartRes(0);
+ sg.setEndRes(resultAl.getWidth() - 1);
+ groups.put(groupNam, sg);
+ resultAl.addGroup(sg);
+ }
+ else
+ {
+ sg.addSequence(seqToAdd, false);
+ }
+ }
+
+ private AlignmentAnnotation parsePosteriorProb(String ppline)
+ {
+ Annotation[] ae = new Annotation[ppline.length()];
+ int spos = 0;
+ for (int i = 0, iSize = ppline.length(); i < iSize; i++)
+ {
+ char pp = ppline.charAt(i);
+ if (pp == '*')
+ {
+ ae[spos++] = new Annotation(10f);
+ }
+ else
+ {
+ if (pp >= '0' && pp <= '9')
+ {
+ ae[spos++] = new Annotation(Integer.valueOf("" + pp));
+ }