int seqPosition = seq.findPosition(columnPosition);
AlignmentAnnotation[] aa = seq.getRefSeq().getAnnotation("Secondary Structure");
if (aa != null) {
+ if (aa[0].getAnnotationForPosition(seqPosition) != null) {
Annotation a = aa[0].getAnnotationForPosition(seqPosition);
ss = a.secondaryStructure;
if (ss == ' ') {
- ss = 'C'; // In JalView, 'C' is represented as ' '
- }
- if (ss != '\0') { // Check if ss is not the default null character
- secondaryStructure.add(String.valueOf(ss));
+ ss = 'C'; // In JalView, 'C' is represented as ' '
}
+ }
+ else {
+ ss = 'C';
+ }
+ if (ss != '\0') { // Check if ss is not the default null character
+ secondaryStructure.add(String.valueOf(ss));
+ }
}
return secondaryStructure;
}
import jalview.api.analysis.ScoreModelI;
import jalview.api.analysis.SimilarityParamsI;
import jalview.bin.Cache;
+import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
import jalview.util.MessageManager;
/**
* select the score models applicable to the alignment type
*/
boolean nucleotide = af.getViewport().getAlignment().isNucleotide();
- List<ScoreModelI> models = getApplicableScoreModels(nucleotide,
- pca.isSelected());
+ AlignmentAnnotation[] alignmentAnnotation = af.getViewport().getAlignment().getAlignmentAnnotation();
+
+ boolean ssPresent = false;
+
+ for (AlignmentAnnotation aa : alignmentAnnotation)
+
+ {
+ if(ssPresent) {
+ break;
+ }
+
+ if (aa.label.equals("Secondary Structure"))
+
+ {
+ ssPresent = true;
+ break;
+ }
+ }
+
+ List<ScoreModelI> models = getApplicableScoreModels(nucleotide, pca.isSelected(),
+ ssPresent);
/*
* now we can actually add entries to the combobox,
* @return
*/
protected static List<ScoreModelI> getApplicableScoreModels(
- boolean nucleotide, boolean forPca)
+ boolean nucleotide, boolean forPca, boolean ssPresent)
{
List<ScoreModelI> filtered = new ArrayList<>();
ScoreModels scoreModels = ScoreModels.getInstance();
for (ScoreModelI sm : scoreModels.getModels())
{
- if (!nucleotide && sm.isProtein() || nucleotide && sm.isDNA())
+ if (!nucleotide && sm.isProtein() || nucleotide && sm.isDNA()
+ || ssPresent && sm.isSecondaryStructure())
{
filtered.add(sm);
}
{
filtered.add(scoreModels.getBlosum62());
}
-
+
return filtered;
}
* peptide models for PCA
*/
List<ScoreModelI> filtered = CalculationChooser
- .getApplicableScoreModels(false, true);
+ .getApplicableScoreModels(false, true, true);
assertEquals(filtered.size(), 4);
assertSame(filtered.get(0), blosum62);
assertSame(filtered.get(1), pam250);
/*
* peptide models for Tree are the same
*/
- filtered = CalculationChooser.getApplicableScoreModels(false, false);
+ filtered = CalculationChooser.getApplicableScoreModels(false, false, true);
assertEquals(filtered.size(), 4);
assertSame(filtered.get(0), blosum62);
assertSame(filtered.get(1), pam250);
/*
* nucleotide models for PCA
*/
- filtered = CalculationChooser.getApplicableScoreModels(true, true);
+ filtered = CalculationChooser.getApplicableScoreModels(true, true, true);
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);
+ filtered = CalculationChooser.getApplicableScoreModels(true, false, true);
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);
+ filtered = CalculationChooser.getApplicableScoreModels(true, false, true);
assertEquals(filtered.size(), 3);
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);
+ filtered = CalculationChooser.getApplicableScoreModels(true, true, true);
assertEquals(filtered.size(), 4);
assertSame(filtered.get(0), dna);
assertEquals(filtered.get(1).getName(), "PID");