package jalview.analysis.scoremodels;
import java.awt.Color;
+import java.util.List;
import jalview.analysis.AlignSeq;
import jalview.api.analysis.ScoreModelI;
import jalview.datamodel.SequenceI;
import jalview.util.Comparison;
-public class FeatureScoreModel implements ScoreModelI,ViewBasedAnalysisI
+public class FeatureScoreModel implements ScoreModelI, ViewBasedAnalysisI
{
jalview.api.FeatureRenderer fr;
-
- @Override
- public boolean configureFromAlignmentView(jalview.api.AlignmentViewPanel view)
+
+ @Override
+ public boolean configureFromAlignmentView(
+ jalview.api.AlignmentViewPanel view)
{
fr = view.cloneFeatureRenderer();
return true;
@Override
public float[][] findDistances(AlignmentView seqData)
{
-
- SequenceI[] sequenceString = seqData
- .getVisibleAlignment(Comparison.GapChars.charAt(0)).getSequencesArray();
+
+ SequenceI[] sequenceString = seqData.getVisibleAlignment(
+ Comparison.GapChars.charAt(0)).getSequencesArray();
int noseqs = sequenceString.length;
int cpwidth = seqData.getWidth();
float[][] distance = new float[noseqs][noseqs];
- float max=0;
- for (int cpos = 0;cpos<cpwidth;cpos++)
+ float max = 0;
+ for (int cpos = 0; cpos < cpwidth; cpos++)
{
- // get visible features at cpos under view's display settings and compare them
+ // get visible features at cpos under view's display settings and compare
+ // them
for (int i = 0; i < (noseqs - 1); i++)
{
- SequenceFeature[] sf = fr.getVisible(sequenceString[i],cpos);
- for (int j=i+1;j<noseqs;j++)
+ List<SequenceFeature> sf = fr.findFeaturesAtRes(sequenceString[i],
+ cpos);
+ for (int j = i + 1; j < noseqs; j++)
{
- SequenceFeature[] jsf = fr.getVisible(sequenceString[i],cpos);
+ List<SequenceFeature> jsf = fr.findFeaturesAtRes(
+ sequenceString[i], cpos);
+ // compare the two lists of features...
-
- if (max < distance[i][j])
- {
- max = distance[i][j];
+ if (max < distance[i][j])
+ {
+ max = distance[i][j];
+ }
}
}
}
- }
for (int i = 0; i < (noseqs - 1); i++)
{
distance[j][i] = distance[i][j];
}
}
-
+
return distance;
}
{
return "Smith Waterman Score";
}
+
@Override
public boolean isDNA()
{
return true;
}
+
@Override
public boolean isProtein()
{
return true;
}
- public String toString() {
+
+ public String toString()
+ {
return "Score between two sequences aligned with Smith Waterman with default Peptide/Nucleotide matrix";
}
}