Clover icon

Coverage Report

  1. Project Clover database Thu Nov 7 2024 17:01:39 GMT
  2. Package jalview.ws.jws2

File AAConClient.java

 

Coverage histogram

../../../img/srcFileCovDistChart0.png
0% of files have more coverage

Code metrics

6
23
6
1
131
85
12
0.52
3.83
6
2

Classes

Class Line # Actions
AAConClient 40 23 12
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
20    */
21    package jalview.ws.jws2;
22   
23    import jalview.datamodel.AlignmentAnnotation;
24    import jalview.gui.AlignFrame;
25    import jalview.util.MessageManager;
26    import jalview.ws.jws2.jabaws2.Jws2Instance;
27    import jalview.ws.params.WsParamSetI;
28    import jalview.ws.uimodel.AlignAnalysisUIText;
29   
30    import java.util.ArrayList;
31    import java.util.List;
32    import java.util.Map;
33    import java.util.Set;
34    import java.util.TreeSet;
35   
36    import compbio.data.sequence.FastaSequence;
37    import compbio.data.sequence.Score;
38    import compbio.metadata.Argument;
39   
 
40    public class AAConClient extends JabawsCalcWorker
41    {
42   
 
43  0 toggle public AAConClient(Jws2Instance service, AlignFrame alignFrame,
44    WsParamSetI preset, List<Argument> paramset)
45    {
46  0 super(service, alignFrame, preset, paramset);
47  0 submitGaps = true;
48  0 alignedSeqs = true;
49  0 nucleotidesAllowed = false;
50  0 proteinAllowed = true;
51  0 filterNonStandardResidues = true;
52  0 gapMap = new boolean[0];
53  0 initViewportParams();
54    }
55   
 
56  0 toggle @Override
57    public String getServiceActionText()
58    {
59  0 return "calculating Amino acid consensus using AACon service";
60    }
61   
62    /**
63    * update the consensus annotation from the sequence profile data using
64    * current visualization settings.
65    */
66   
 
67  0 toggle @Override
68    public void updateResultAnnotation(boolean immediate)
69    {
70  0 if (immediate || !calcMan.isWorking(this) && scoremanager != null)
71    {
72  0 Map<String, TreeSet<Score>> scoremap = scoremanager.asMap();
73  0 int alWidth = alignViewport.getAlignment().getWidth();
74  0 ArrayList<AlignmentAnnotation> ourAnnot = new ArrayList<>();
75  0 for (String score : scoremap.keySet())
76    {
77  0 Set<Score> scores = scoremap.get(score);
78  0 for (Score scr : scores)
79    {
80  0 if (scr.getRanges() != null && scr.getRanges().size() > 0)
81    {
82    /**
83    * annotation in range annotation = findOrCreate(scr.getMethod(),
84    * true, null, null); Annotation[] elm = new Annotation[alWidth];
85    * Iterator<Float> vals = scr.getScores().iterator(); for (Range rng
86    * : scr.getRanges()) { float val = vals.next().floatValue(); for
87    * (int i = rng.from; i <= rng.to; i++) { elm[i] = new
88    * Annotation("", "", ' ', val); } } annotation.annotations = elm;
89    * annotation.validateRangeAndDisplay();
90    */
91    }
92    else
93    {
94  0 createAnnotationRowsForScores(ourAnnot, getCalcId(), alWidth,
95    scr);
96    }
97    }
98    }
99   
100  0 if (ourAnnot.size() > 0)
101    {
102  0 updateOurAnnots(ourAnnot);
103    }
104    }
105    }
106   
 
107  0 toggle @Override
108    boolean checkValidInputSeqs(boolean dynamic, List<FastaSequence> seqs)
109    {
110  0 return (seqs.size() > 1);
111    }
112   
 
113  0 toggle @Override
114    public String getCalcId()
115    {
116  0 return CALC_ID;
117    }
118   
119    private static String CALC_ID = "jabaws2.AACon";
120   
 
121  0 toggle public static AlignAnalysisUIText getAlignAnalysisUITest()
122    {
123  0 return new AlignAnalysisUIText(
124    compbio.ws.client.Services.AAConWS.toString(),
125    jalview.ws.jws2.AAConClient.class, CALC_ID, false, true, true,
126    MessageManager.getString("label.aacon_calculations"),
127    MessageManager.getString("tooltip.aacon_calculations"),
128    MessageManager.getString("label.aacon_settings"),
129    MessageManager.getString("tooltip.aacon_settings"));
130    }
131    }