| 1 |
|
package jalview.ws.slivkaws; |
| 2 |
|
|
| 3 |
|
import jalview.api.FeatureColourI; |
| 4 |
|
import jalview.bin.Cache; |
| 5 |
|
import jalview.bin.Console; |
| 6 |
|
import jalview.datamodel.Alignment; |
| 7 |
|
import jalview.datamodel.AlignmentAnnotation; |
| 8 |
|
import jalview.datamodel.SequenceI; |
| 9 |
|
import jalview.datamodel.features.FeatureMatcherSetI; |
| 10 |
|
import jalview.io.AnnotationFile; |
| 11 |
|
import jalview.io.DataSourceType; |
| 12 |
|
import jalview.io.FeaturesFile; |
| 13 |
|
import jalview.util.MessageManager; |
| 14 |
|
import jalview.ws.api.JobId; |
| 15 |
|
import jalview.ws.api.SequenceAnnotationServiceI; |
| 16 |
|
import jalview.ws.params.ArgumentI; |
| 17 |
|
import jalview.ws.params.WsParamSetI; |
| 18 |
|
import jalview.ws.uimodel.AlignAnalysisUIText; |
| 19 |
|
|
| 20 |
|
import java.io.IOError; |
| 21 |
|
import java.io.IOException; |
| 22 |
|
import java.util.Arrays; |
| 23 |
|
import java.util.Collection; |
| 24 |
|
import java.util.List; |
| 25 |
|
import java.util.Map; |
| 26 |
|
|
| 27 |
|
import compbio.data.msa.Category; |
| 28 |
|
import uk.ac.dundee.compbio.slivkaclient.RemoteFile; |
| 29 |
|
import uk.ac.dundee.compbio.slivkaclient.SlivkaClient; |
| 30 |
|
import uk.ac.dundee.compbio.slivkaclient.SlivkaService; |
| 31 |
|
|
| |
|
| 0% |
Uncovered Elements: 36 (36) |
Complexity: 11 |
Complexity Density: 0.48 |
|
| 32 |
|
public class SlivkaAnnotationServiceInstance extends SlivkaWSInstance implements SequenceAnnotationServiceI |
| 33 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 34 |
0 |
public SlivkaAnnotationServiceInstance(SlivkaClient client,... |
| 35 |
|
SlivkaService service, String category) |
| 36 |
|
{ |
| 37 |
0 |
super(client, service, category); |
| 38 |
0 |
if (category == Category.CATEGORY_CONSERVATION) |
| 39 |
|
{ |
| 40 |
|
|
| 41 |
|
|
| 42 |
0 |
setAlignAnalysisUI(new AlignAnalysisUIText(getName(), |
| 43 |
|
SlivkaAnnotationServiceInstance.class, |
| 44 |
|
"Slivka.AACons", false, true, true, true, true, 2, |
| 45 |
|
MessageManager.getString("label.aacon_calculations"), |
| 46 |
|
MessageManager.getString("tooltip.aacon_calculations"), |
| 47 |
|
MessageManager.getString("label.aacon_settings"), |
| 48 |
|
MessageManager.getString("tooltip.aacon_settings"))); |
| 49 |
|
} |
| 50 |
0 |
style = ServiceClient.SEQUENCEANNOTATIONWSCLIENT; |
| 51 |
|
} |
| 52 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 53 |
0 |
@Override... |
| 54 |
|
public JobId submitToService(List<SequenceI> seqs, WsParamSetI preset, List<ArgumentI> paramset) throws Throwable |
| 55 |
|
{ |
| 56 |
0 |
return super.submit(seqs, preset, paramset); |
| 57 |
|
} |
| 58 |
|
|
| |
|
| 0% |
Uncovered Elements: 26 (26) |
Complexity: 8 |
Complexity Density: 0.44 |
|
| 59 |
0 |
@Override... |
| 60 |
|
public List<AlignmentAnnotation> getAnnotationResult(JobId jobId, |
| 61 |
|
List<SequenceI> seqs, Map<String, FeatureColourI> featureColours, |
| 62 |
|
Map<String, FeatureMatcherSetI> featureFilters) throws Throwable |
| 63 |
|
{ |
| 64 |
0 |
RemoteFile annotFile = null; |
| 65 |
0 |
RemoteFile featFile = null; |
| 66 |
0 |
try |
| 67 |
|
{ |
| 68 |
0 |
Collection<RemoteFile> files = client.fetchFilesList(jobId.getJobId()); |
| 69 |
0 |
for (RemoteFile f : files) |
| 70 |
|
{ |
| 71 |
0 |
if (f.getMediaType().equals("application/jalview-annotations")) |
| 72 |
|
{ |
| 73 |
0 |
annotFile = f; |
| 74 |
|
} |
| 75 |
0 |
else if (f.getMediaType().equals("application/jalview-features")) |
| 76 |
|
{ |
| 77 |
0 |
featFile = f; |
| 78 |
|
} |
| 79 |
|
} |
| 80 |
|
} catch (IOException e) |
| 81 |
|
{ |
| 82 |
0 |
throw new IOError(e); |
| 83 |
|
} |
| 84 |
0 |
Alignment aln = new Alignment(seqs.toArray(new SequenceI[0])); |
| 85 |
0 |
if (annotFile == null |
| 86 |
|
|| !new AnnotationFile().readAnnotationFileWithCalcId(aln, service.getId(), annotFile.getContentUrl().toString(), DataSourceType.URL)) |
| 87 |
|
{ |
| 88 |
0 |
Console.debug("No annotation from slivka job\n" + annotFile); |
| 89 |
|
} |
| 90 |
|
else { |
| 91 |
0 |
Console.debug("Annotation file loaded " + annotFile); |
| 92 |
|
} |
| 93 |
0 |
if (featFile == null |
| 94 |
|
|| !new FeaturesFile(featFile.getContentUrl().toString(), DataSourceType.URL).parse(aln, featureColours, true)) |
| 95 |
|
{ |
| 96 |
0 |
Console.debug("No features from slivka job\n" + featFile); |
| 97 |
|
} |
| 98 |
|
else { |
| 99 |
0 |
Console.debug("Features feil loaded " + featFile); |
| 100 |
|
} |
| 101 |
0 |
return Arrays.asList(aln.getAlignmentAnnotation()); |
| 102 |
|
} |
| 103 |
|
} |