import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentView;
+import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
import jalview.gui.JvSwingUtils;
return;
}
+
startMsaWSClient(altitle, msa, submitGaps, preserveOrder, seqdataset);
+
}
public MsaWSClient()
WsURL, wsInfo, alignFrame, WebServiceName, jobtitle, msa,
submitGaps, preserveOrder, seqdataset);
wsInfo.setthisService(msathread);
+
msathread.start();
+
}
+ private boolean isValidAlignment(AlignmentView av)
+ {
+ int validSeqCount = 0;
+ List<SequenceI> seqs = av.getVisibleAlignment('c').getSequences(); // .getSequences();
+ if (seqs.size() < 2)
+ {
+ JOptionPane
+ .showMessageDialog(
+ alignFrame,
+ "A minimum of two sequences is required to perform this operation",
+ "Invalid selection", JOptionPane.INFORMATION_MESSAGE);
+
+ return false;
+ }
+
+ for (SequenceI seq : seqs)
+ {
+
+ if (seq.getSequenceAsString().matches("(-*[a-zA-Z]-*){3}[a-zA-Z-]*"))
+ {
+ ++validSeqCount;
+ }
+ if (validSeqCount > 1)
+ {
+ return true;
+ }
+ }
+
+ JOptionPane
+ .showMessageDialog(
+ alignFrame,
+ "A minimum of two sequences with at least three non-gap character \nis required to perform this operation",
+ "Invalid selection", JOptionPane.INFORMATION_MESSAGE);
+
+ return false;
+ }
+
+ public static void main(String[] args)
+ {
+ System.out.println("A".matches("(-*[a-zA-Z]-*){1}[a-zA-Z-]*"));
+ }
+
+
+
protected String getServiceActionKey()
{
return "MsaWS";
public void actionPerformed(ActionEvent e)
{
AlignmentView msa = alignFrame.gatherSequencesForAlignment();
+
+ if (isValidAlignment(msa))
+ {
new MsaWSClient(service, alignFrame.getTitle(), msa, withGaps,
true, alignFrame.getViewport().getAlignment()
.getDataset(), alignFrame);
+ }
}
});
public void actionPerformed(ActionEvent e)
{
AlignmentView msa = alignFrame.gatherSequencesForAlignment();
+
+ if (isValidAlignment(msa))
+ {
new MsaWSClient(service, null, null, true, alignFrame
.getTitle(), msa, withGaps, true, alignFrame
.getViewport().getAlignment().getDataset(), alignFrame);
+ }
}
});
{
AlignmentView msa = alignFrame
.gatherSequencesForAlignment();
+
+ if (isValidAlignment(msa))
+ {
new MsaWSClient(service, preset, alignFrame.getTitle(),
msa, false, true, alignFrame.getViewport()
.getAlignment().getDataset(), alignFrame);
+ }
}