import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentView;
-import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
import jalview.gui.JvSwingUtils;
MsaWSThread msathread = new MsaWSThread(server, preset, paramset,
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)
+ if (msathread.hasValidInput())
{
- JOptionPane
- .showMessageDialog(
- alignFrame,
- "A minimum of two sequences is required to perform this operation",
- "Invalid selection", JOptionPane.INFORMATION_MESSAGE);
-
- return false;
+ wsInfo.setthisService(msathread);
+ wsInfo.setVisible(true);
+ msathread.start();
}
-
- for (SequenceI seq : seqs)
+ else
{
-
- if (seq.getSequenceAsString().matches("(-*[a-zA-Z]-*){3}[a-zA-Z-]*"))
- {
- ++validSeqCount;
- }
- if (validSeqCount > 1)
- {
- return true;
- }
+ JOptionPane.showMessageDialog(alignFrame,
+ MessageManager.getString("info.invalid_msa_input_mininfo"),
+ MessageManager.getString("info.invalid_msa_notenough"),
+ JOptionPane.INFORMATION_MESSAGE);
+ wsInfo.setVisible(false);
}
-
- JOptionPane
- .showMessageDialog(
- alignFrame,
- "All selected sequence for this job must have a minimum of \nthree non-gap character to perform this operation",
- "Invalid selection", JOptionPane.INFORMATION_MESSAGE);
-
- return false;
}
public static void main(String[] args)
{
AlignmentView msa = alignFrame.gatherSequencesForAlignment();
- if (msa != null && isValidAlignment(msa))
+ if (msa != null)
{
new MsaWSClient(service, alignFrame.getTitle(), msa, withGaps,
true, alignFrame.getViewport().getAlignment()
public void actionPerformed(ActionEvent e)
{
AlignmentView msa = alignFrame.gatherSequencesForAlignment();
-
- if (msa != null && isValidAlignment(msa))
+ if (msa != null)
{
- new MsaWSClient(service, null, null, true, alignFrame
+ new MsaWSClient(service, null, null, true, alignFrame
.getTitle(), msa, withGaps, true, alignFrame
.getViewport().getAlignment().getDataset(), alignFrame);
}
AlignmentView msa = alignFrame
.gatherSequencesForAlignment();
- if (msa != null && isValidAlignment(msa))
+ if (msa != null)
{
- new MsaWSClient(service, preset, alignFrame.getTitle(),
+ MsaWSClient msac = new MsaWSClient(service, preset,
+ alignFrame.getTitle(),
msa, false, true, alignFrame.getViewport()
.getAlignment().getDataset(), alignFrame);
}