boolean ssPresent = AlignmentUtils.isSecondaryStructurePresent(alignmentAnnotations);
List<ScoreModelI> models = getApplicableScoreModels(nucleotide, pca.isSelected(),
- ssPresent);
+ ssPresent, pasimap.isSelected());
/*
* now we can actually add entries to the combobox,
* @return
*/
protected static List<ScoreModelI> getApplicableScoreModels(
- boolean nucleotide, boolean forPca, boolean ssPresent)
+ boolean nucleotide, boolean forPca, boolean ssPresent, boolean forPasimap)
{
List<ScoreModelI> filtered = new ArrayList<>();
ScoreModels scoreModels = ScoreModels.getInstance();
for (ScoreModelI sm : scoreModels.getModels())
{
- if (!nucleotide && sm.isProtein() || nucleotide && sm.isDNA()
- || ssPresent && sm.isSecondaryStructure())
+ if (!forPasimap && (!nucleotide && sm.isProtein() || nucleotide && sm.isDNA()
+ || sm.isSecondaryStructure() && ssPresent))
+
{
filtered.add(sm);
}
* special case: add BLOSUM62 as last option for nucleotide PCA,
* for backwards compatibility with Jalview < 2.8 (JAL-2962)
*/
- if (nucleotide && forPca
+ if (!forPasimap && nucleotide && forPca
&& Cache.getDefault("BLOSUM62_PCA_FOR_NUCLEOTIDE", false))
{
filtered.add(scoreModels.getBlosum62());
{
boolean doPCA = pca.isSelected();
boolean doPaSiMap = pasimap.isSelected();
- String modelName = modelNames.getSelectedItem().toString();
+ String modelName = modelNames.getSelectedItem() == null ? "" : modelNames.getSelectedItem().toString();
String ssSource = "";
Object selectedItem = ssSourceDropdown.getSelectedItem();
if (selectedItem != null) {
* peptide models for PCA
*/
List<ScoreModelI> filtered = CalculationChooser
- .getApplicableScoreModels(false, true, true);
+ .getApplicableScoreModels(false, true, true,false);
assertEquals(filtered.size(), 5);
assertSame(filtered.get(0), blosum62);
assertSame(filtered.get(1), pam250);
/*
* peptide models for Tree are the same
*/
- filtered = CalculationChooser.getApplicableScoreModels(false, false, true);
+ filtered = CalculationChooser.getApplicableScoreModels(false, false, true,false);
assertEquals(filtered.size(), 5);
assertSame(filtered.get(0), blosum62);
assertSame(filtered.get(1), pam250);
/*
* nucleotide models for PCA
*/
- filtered = CalculationChooser.getApplicableScoreModels(true, true, false);
+ filtered = CalculationChooser.getApplicableScoreModels(true, true, false,false);
assertEquals(filtered.size(), 3);
assertSame(filtered.get(0), dna);
assertEquals(filtered.get(1).getName(), "PID");
/*
* nucleotide models for Tree are the same
*/
- filtered = CalculationChooser.getApplicableScoreModels(true, false, false);
+ filtered = CalculationChooser.getApplicableScoreModels(true, false, false,false);
assertEquals(filtered.size(), 3);
assertSame(filtered.get(0), dna);
assertEquals(filtered.get(1).getName(), "PID");
/*
* nucleotide models for Tree are unchanged
*/
- filtered = CalculationChooser.getApplicableScoreModels(true, false, true);
+ filtered = CalculationChooser.getApplicableScoreModels(true, false, true,false);
assertEquals(filtered.size(), 4);
assertSame(filtered.get(0), dna);
assertEquals(filtered.get(1).getName(), "PID");
/*
* nucleotide models for PCA add BLOSUM62 as last option
*/
- filtered = CalculationChooser.getApplicableScoreModels(true, true, false);
+ filtered = CalculationChooser.getApplicableScoreModels(true, true, false,false);
assertEquals(filtered.size(), 4);
assertSame(filtered.get(0), dna);
assertEquals(filtered.get(1).getName(), "PID");
assertEquals(filtered.get(2).getName(), "Sequence Feature Similarity");
assertSame(filtered.get(3), blosum62);
+
+ filtered = CalculationChooser.getApplicableScoreModels(true, true, false,true);
+ assertEquals(filtered.size(), 0);
+ for (int i=0; i<=8;i++)
+ {
+ boolean isDna = (i & 1) != 0,isPca = (i & 2) != 0,isSS = (i & 4) != 0;
+
+ assertEquals(CalculationChooser.getApplicableScoreModels(isDna,isPca,isSS,true).size(), 0);
+ }
}
}