package jalview.ws.slivkaws;
import jalview.api.FeatureColourI;
+import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.SequenceI;
import jalview.datamodel.features.FeatureMatcherSetI;
+import jalview.io.AnnotationFile;
import jalview.ws.api.JobId;
import jalview.ws.api.SequenceAnnotationServiceI;
import jalview.ws.params.ArgumentI;
import jalview.ws.params.WsParamSetI;
+import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
+import java.io.IOError;
+import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
{
public SlivkaAnnotationServiceInstance(SlivkaClient client, SlivkaService service)
{
- super(client, service, "Annotations");
+ super(client, service, "Annotations disorder");
}
@Override
List<SequenceI> seqs, Map<String, FeatureColourI> featureColours,
Map<String, FeatureMatcherSetI> featureFilters) throws Throwable
{
- // TODO Auto-generated method stub
- return null;
+ RemoteFile annotFile = null;
+ RemoteFile featFile = null;
+ try
+ {
+ List<RemoteFile> files = client.getJobResults(job.getJobId());
+ for (RemoteFile f : files)
+ {
+ if (f.getMimeType().equals("application/jalview-annotations"))
+ {
+ annotFile = f;
+ }
+ else if (f.getMimeType().equals("application/jalview-features"))
+ {
+ featFile = f;
+ }
+ }
+ } catch (IOException e)
+ {
+ throw new IOError(e);
+ }
+ Alignment aln = new Alignment(seqs.toArray(new SequenceI[0]));
+ BufferedReader in = new BufferedReader(new InputStreamReader(annotFile.getContent()));
+ AnnotationFile f = new AnnotationFile();
+ f.parseAnnotationFrom(aln, null, in);
+ return Arrays.asList(aln.getAlignmentAnnotation());
}
}
import jalview.gui.AlignFrame;
import jalview.ws.WSMenuEntryProviderI;
import jalview.ws.jws2.MsaWSClient;
+import jalview.ws.jws2.SequenceAnnotationWSClient;
import java.awt.event.ActionEvent;
import java.io.IOError;
{
JMenu slivkaMenu = new JMenu("Slivka");
wsmenu.add(slivkaMenu);
- JMenu categoryMenu = new JMenu("Alignment");
- slivkaMenu.add(categoryMenu);
+ JMenu alignmentMenu = new JMenu("Sequence Alignment");
+ slivkaMenu.add(alignmentMenu);
try
{
for (SlivkaService service : client.getServices())
alignFrame.getViewport().getAlignment().getDataset(), alignFrame);
}
});
- categoryMenu.add(defaultEntry);
+ alignmentMenu.add(defaultEntry);
JMenuItem customEntry = new JMenuItem(String.format("%s with custom parameters", service.label));
customEntry.addActionListener((ActionEvent evt) -> {
}
}
});
- categoryMenu.add(customEntry);
+ alignmentMenu.add(customEntry);
- categoryMenu.addSeparator();
+ alignmentMenu.addSeparator();
}
} catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
+
+ JMenu disorderMenu = new JMenu("Protein sequence analysis");
+ slivkaMenu.add(disorderMenu);
+ try
+ {
+ for (SlivkaService service : client.getServices())
+ {
+ msaClassifier:
+ {
+ for (String classifier : service.classifiers)
+ {
+ if (classifier.contains("Protein sequence analysis"))
+ {
+ break msaClassifier;
+ }
+ }
+ continue;
+ }
+ JMenuItem menuEntry = new JMenuItem(String.format("%s with custom parameters", service.label));
+ disorderMenu.add(menuEntry);
+ SlivkaAnnotationServiceInstance serviceInstance = new SlivkaAnnotationServiceInstance(client, service);
+ menuEntry.addActionListener((ActionEvent evt) -> {
+ try
+ {
+ SlivkaParamSet paramSet = new SlivkaParamSet(service);
+ SequenceAnnotationWSClient client = new SequenceAnnotationWSClient();
+ client.initSequenceAnnotationWSClient(serviceInstance, alignFrame, paramSet, true);
+ } catch (IOException e)
+ {
+ throw new IOError(e);
+ }
+
+ });
+ }
+ } catch (IOException e)
+ {
+ throw new IOError(e);
+ }
}
@Override