From: gmungoc Date: Thu, 27 Nov 2014 11:53:50 +0000 (+0000) Subject: Merge branch 'Release_2_8_2_Branch' of https://source.jalview.org/git/jalview.git... X-Git-Tag: Release_2_8_2b1^2~12 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=412eb268cebc4e1e4408e79c90c17a7e269c1a9c;hp=a035778e620ea034ae474d7553e3de06605be171;p=jalview.git Merge branch 'Release_2_8_2_Branch' of https://source.jalview.org/git/jalview.git into Release_2_8_2_Branch --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 07c4a54..2a804ad 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -4184,6 +4184,21 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ msa = viewport.getAlignmentView(true); } + else if (viewport.getSelectionGroup() != null + && viewport.getSelectionGroup().getSize() == 1) + { + int option = JOptionPane + .showConfirmDialog( +this, + "More than one sequece group selection is required for this Job, click \n'Cancel' to edit your selection or 'Ok' to submit the entire sequence.", + "Invalid selection", + JOptionPane.OK_CANCEL_OPTION); + if (option == JOptionPane.OK_OPTION) + { + msa = viewport.getAlignmentView(false); + } + + } else { /* diff --git a/src/jalview/ws/jws2/MsaWSClient.java b/src/jalview/ws/jws2/MsaWSClient.java index 09a6d8d..39be454 100644 --- a/src/jalview/ws/jws2/MsaWSClient.java +++ b/src/jalview/ws/jws2/MsaWSClient.java @@ -22,6 +22,7 @@ package jalview.ws.jws2; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentView; +import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; import jalview.gui.Desktop; import jalview.gui.JvSwingUtils; @@ -127,8 +128,10 @@ public class MsaWSClient extends Jws2Client return; } + startMsaWSClient(altitle, msa, submitGaps, preserveOrder, seqdataset); + } public MsaWSClient() @@ -173,9 +176,55 @@ public class MsaWSClient extends Jws2Client WsURL, wsInfo, alignFrame, WebServiceName, jobtitle, msa, submitGaps, preserveOrder, seqdataset); wsInfo.setthisService(msathread); + msathread.start(); + } + private boolean isValidAlignment(AlignmentView av) + { + int validSeqCount = 0; + List 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, + "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) + { + System.out.println("A".matches("(-*[a-zA-Z]-*){1}[a-zA-Z-]*")); + } + + + protected String getServiceActionKey() { return "MsaWS"; @@ -250,9 +299,13 @@ public class MsaWSClient extends Jws2Client public void actionPerformed(ActionEvent e) { AlignmentView msa = alignFrame.gatherSequencesForAlignment(); + + if (msa != null && isValidAlignment(msa)) + { new MsaWSClient(service, alignFrame.getTitle(), msa, withGaps, true, alignFrame.getViewport().getAlignment() .getDataset(), alignFrame); + } } }); @@ -271,9 +324,13 @@ public class MsaWSClient extends Jws2Client public void actionPerformed(ActionEvent e) { AlignmentView msa = alignFrame.gatherSequencesForAlignment(); + + if (msa != null && isValidAlignment(msa)) + { new MsaWSClient(service, null, null, true, alignFrame .getTitle(), msa, withGaps, true, alignFrame .getViewport().getAlignment().getDataset(), alignFrame); + } } }); @@ -324,9 +381,13 @@ public class MsaWSClient extends Jws2Client { AlignmentView msa = alignFrame .gatherSequencesForAlignment(); + + if (msa != null && isValidAlignment(msa)) + { new MsaWSClient(service, preset, alignFrame.getTitle(), msa, false, true, alignFrame.getViewport() .getAlignment().getDataset(), alignFrame); + } }